Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
e8a36957
Commit
e8a36957
authored
May 30, 2017
by
Andy Armstrong
Committed by
GitHub
May 30, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15205 from edx/andya/clean-imports-cms
Reorder Studio imports using isort
parents
f4b0a76c
ebb04ca3
Hide whitespace changes
Inline
Side-by-side
Showing
146 changed files
with
799 additions
and
817 deletions
+799
-817
cms/celery.py
+3
-0
cms/djangoapps/cms_user_tasks/signals.py
+2
-1
cms/djangoapps/cms_user_tasks/tasks.py
+2
-3
cms/djangoapps/cms_user_tasks/tests.py
+5
-6
cms/djangoapps/contentstore/admin.py
+2
-2
cms/djangoapps/contentstore/course_group_config.py
+3
-3
cms/djangoapps/contentstore/course_info_model.py
+5
-6
cms/djangoapps/contentstore/courseware_index.py
+8
-6
cms/djangoapps/contentstore/debug_file_uploader.py
+2
-1
cms/djangoapps/contentstore/features/advanced_settings.py
+4
-3
cms/djangoapps/contentstore/features/common.py
+9
-9
cms/djangoapps/contentstore/features/component.py
+2
-2
cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
+3
-2
cms/djangoapps/contentstore/features/course-settings.py
+4
-4
cms/djangoapps/contentstore/features/course-updates.py
+3
-2
cms/djangoapps/contentstore/features/course_import.py
+2
-1
cms/djangoapps/contentstore/features/courses.py
+3
-1
cms/djangoapps/contentstore/features/discussion-editor.py
+1
-1
cms/djangoapps/contentstore/features/grading.py
+5
-4
cms/djangoapps/contentstore/features/html-editor.py
+4
-3
cms/djangoapps/contentstore/features/pages.py
+1
-2
cms/djangoapps/contentstore/features/problem-editor.py
+5
-3
cms/djangoapps/contentstore/features/signup.py
+2
-2
cms/djangoapps/contentstore/features/textbooks.py
+3
-2
cms/djangoapps/contentstore/features/transcripts.py
+2
-2
cms/djangoapps/contentstore/features/upload.py
+9
-7
cms/djangoapps/contentstore/features/video.py
+1
-1
cms/djangoapps/contentstore/management/commands/clean_cert_name.py
+1
-1
cms/djangoapps/contentstore/management/commands/cleanup_assets.py
+1
-1
cms/djangoapps/contentstore/management/commands/clone_course.py
+4
-3
cms/djangoapps/contentstore/management/commands/create_course.py
+4
-3
cms/djangoapps/contentstore/management/commands/delete_course.py
+5
-3
cms/djangoapps/contentstore/management/commands/delete_orphans.py
+3
-2
cms/djangoapps/contentstore/management/commands/edit_course_tabs.py
+5
-5
cms/djangoapps/contentstore/management/commands/empty_asset_trashcan.py
+5
-3
cms/djangoapps/contentstore/management/commands/export.py
+5
-4
cms/djangoapps/contentstore/management/commands/export_all_courses.py
+3
-2
cms/djangoapps/contentstore/management/commands/export_olx.py
+4
-5
cms/djangoapps/contentstore/management/commands/fix_not_found.py
+3
-1
cms/djangoapps/contentstore/management/commands/force_publish.py
+5
-2
cms/djangoapps/contentstore/management/commands/git_export.py
+3
-3
cms/djangoapps/contentstore/management/commands/import.py
+4
-4
cms/djangoapps/contentstore/management/commands/migrate_to_split.py
+6
-5
cms/djangoapps/contentstore/management/commands/populate_creators.py
+4
-3
cms/djangoapps/contentstore/management/commands/reindex_course.py
+6
-7
cms/djangoapps/contentstore/management/commands/reindex_library.py
+5
-6
cms/djangoapps/contentstore/management/commands/restore_asset_from_trashcan.py
+1
-0
cms/djangoapps/contentstore/management/commands/utils.py
+1
-0
cms/djangoapps/contentstore/management/commands/xlint.py
+1
-0
cms/djangoapps/contentstore/migrations/0001_initial.py
+1
-1
cms/djangoapps/contentstore/models.py
+1
-2
cms/djangoapps/contentstore/proctoring.py
+9
-13
cms/djangoapps/contentstore/push_notification.py
+5
-4
cms/djangoapps/contentstore/signals/handlers.py
+2
-3
cms/djangoapps/contentstore/storage.py
+0
-1
cms/djangoapps/contentstore/tasks.py
+7
-10
cms/djangoapps/contentstore/tests/test_clone_course.py
+7
-7
cms/djangoapps/contentstore/tests/test_contentstore.py
+26
-35
cms/djangoapps/contentstore/tests/test_core_caching.py
+2
-2
cms/djangoapps/contentstore/tests/test_course_create_rerun.py
+10
-13
cms/djangoapps/contentstore/tests/test_course_listing.py
+15
-18
cms/djangoapps/contentstore/tests/test_course_settings.py
+8
-8
cms/djangoapps/contentstore/tests/test_courseware_index.py
+24
-23
cms/djangoapps/contentstore/tests/test_crud.py
+5
-5
cms/djangoapps/contentstore/tests/test_export_git.py
+3
-2
cms/djangoapps/contentstore/tests/test_gating.py
+3
-2
cms/djangoapps/contentstore/tests/test_i18n.py
+7
-5
cms/djangoapps/contentstore/tests/test_import.py
+8
-7
cms/djangoapps/contentstore/tests/test_import_draft_order.py
+3
-3
cms/djangoapps/contentstore/tests/test_import_pure_xblock.py
+4
-4
cms/djangoapps/contentstore/tests/test_libraries.py
+16
-12
cms/djangoapps/contentstore/tests/test_orphan.py
+2
-1
cms/djangoapps/contentstore/tests/test_permissions.py
+3
-3
cms/djangoapps/contentstore/tests/test_proctoring.py
+6
-9
cms/djangoapps/contentstore/tests/test_request_event.py
+2
-2
cms/djangoapps/contentstore/tests/test_tasks.py
+2
-2
cms/djangoapps/contentstore/tests/test_transcripts_utils.py
+8
-9
cms/djangoapps/contentstore/tests/test_users_default_role.py
+1
-2
cms/djangoapps/contentstore/tests/test_utils.py
+7
-8
cms/djangoapps/contentstore/tests/tests.py
+9
-10
cms/djangoapps/contentstore/tests/utils.py
+4
-4
cms/djangoapps/contentstore/utils.py
+7
-9
cms/djangoapps/contentstore/views/access.py
+1
-1
cms/djangoapps/contentstore/views/assets.py
+5
-5
cms/djangoapps/contentstore/views/certificates.py
+9
-10
cms/djangoapps/contentstore/views/component.py
+12
-18
cms/djangoapps/contentstore/views/course.py
+24
-37
cms/djangoapps/contentstore/views/entrance_exam.py
+7
-7
cms/djangoapps/contentstore/views/error.py
+4
-3
cms/djangoapps/contentstore/views/export_git.py
+3
-3
cms/djangoapps/contentstore/views/helpers.py
+6
-7
cms/djangoapps/contentstore/views/import_export.py
+10
-15
cms/djangoapps/contentstore/views/item.py
+28
-21
cms/djangoapps/contentstore/views/library.py
+18
-13
cms/djangoapps/contentstore/views/organization.py
+1
-1
cms/djangoapps/contentstore/views/preview.py
+26
-25
cms/djangoapps/contentstore/views/public.py
+4
-9
cms/djangoapps/contentstore/views/tabs.py
+6
-7
cms/djangoapps/contentstore/views/tests/test_access.py
+4
-4
cms/djangoapps/contentstore/views/tests/test_assets.py
+12
-12
cms/djangoapps/contentstore/views/tests/test_certificates.py
+8
-12
cms/djangoapps/contentstore/views/tests/test_container_page.py
+4
-4
cms/djangoapps/contentstore/views/tests/test_course_index.py
+11
-9
cms/djangoapps/contentstore/views/tests/test_course_updates.py
+3
-2
cms/djangoapps/contentstore/views/tests/test_credit_eligibility.py
+1
-2
cms/djangoapps/contentstore/views/tests/test_entrance_exam.py
+11
-7
cms/djangoapps/contentstore/views/tests/test_gating.py
+3
-2
cms/djangoapps/contentstore/views/tests/test_helpers.py
+2
-1
cms/djangoapps/contentstore/views/tests/test_import_export.py
+15
-19
cms/djangoapps/contentstore/views/tests/test_library.py
+7
-7
cms/djangoapps/contentstore/views/tests/test_organizations.py
+4
-2
cms/djangoapps/contentstore/views/tests/test_preview.py
+8
-11
cms/djangoapps/contentstore/views/tests/test_tabs.py
+4
-4
cms/djangoapps/contentstore/views/tests/test_textbooks.py
+2
-3
cms/djangoapps/contentstore/views/tests/test_transcripts.py
+5
-5
cms/djangoapps/contentstore/views/tests/test_user.py
+4
-3
cms/djangoapps/contentstore/views/tests/test_videos.py
+6
-7
cms/djangoapps/contentstore/views/transcripts_ajax.py
+18
-20
cms/djangoapps/contentstore/views/user.py
+10
-14
cms/djangoapps/contentstore/views/videos.py
+9
-11
cms/djangoapps/course_creators/admin.py
+7
-7
cms/djangoapps/course_creators/migrations/0001_initial.py
+1
-1
cms/djangoapps/course_creators/models.py
+2
-3
cms/djangoapps/course_creators/tests/test_admin.py
+5
-5
cms/djangoapps/course_creators/tests/test_views.py
+10
-5
cms/djangoapps/course_creators/views.py
+1
-1
cms/djangoapps/maintenance/tests.py
+3
-6
cms/djangoapps/maintenance/urls.py
+1
-2
cms/djangoapps/maintenance/views.py
+6
-7
cms/djangoapps/models/settings/course_metadata.py
+3
-3
cms/djangoapps/models/settings/encoder.py
+1
-0
cms/djangoapps/pipeline_js/urls.py
+1
-1
cms/djangoapps/pipeline_js/views.py
+1
-1
cms/djangoapps/xblock_config/admin.py
+2
-5
cms/djangoapps/xblock_config/forms.py
+1
-1
cms/djangoapps/xblock_config/migrations/0001_initial.py
+1
-1
cms/djangoapps/xblock_config/migrations/0002_courseeditltifieldsenabledflag.py
+3
-2
cms/djangoapps/xblock_config/models.py
+2
-2
cms/djangoapps/xblock_config/tests/test_models.py
+3
-3
cms/lib/xblock/authoring_mixin.py
+0
-1
cms/lib/xblock/tagging/admin.py
+2
-1
cms/lib/xblock/tagging/tagging.py
+8
-7
cms/lib/xblock/tagging/test.py
+17
-15
cms/lib/xblock/test/test_runtime.py
+2
-1
cms/startup.py
+9
-11
cms/urls.py
+1
-1
No files found.
cms/celery.py
View file @
e8a36957
...
...
@@ -5,9 +5,12 @@ and auto discover tasks in all installed django apps.
Taken from: http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html
"""
from
__future__
import
absolute_import
import
os
from
celery
import
Celery
from
django.conf
import
settings
from
openedx.core.lib.celery.routers
import
AlternateEnvironmentRouter
# set the default Django settings module for the 'celery' program.
...
...
cms/djangoapps/cms_user_tasks/signals.py
View file @
e8a36957
...
...
@@ -4,13 +4,14 @@ Receivers of signals sent from django-user-tasks
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
import
logging
from
six.moves.urllib.parse
import
urljoin
# pylint: disable=import-error
from
django.core.urlresolvers
import
reverse
from
django.dispatch
import
receiver
from
user_tasks.models
import
UserTaskArtifact
from
user_tasks.signals
import
user_task_stopped
from
six.moves.urllib.parse
import
urljoin
# pylint: disable=import-error
from
.tasks
import
send_task_complete_email
LOGGER
=
logging
.
getLogger
(
__name__
)
...
...
cms/djangoapps/cms_user_tasks/tasks.py
View file @
e8a36957
...
...
@@ -2,11 +2,10 @@
Celery tasks used by cms_user_tasks
"""
from
celery.task
import
task
from
boto.exception
import
NoAuthHandlerFound
from
celery.exceptions
import
MaxRetriesExceededError
from
celery.task
import
task
from
celery.utils.log
import
get_task_logger
from
boto.exception
import
NoAuthHandlerFound
from
django.conf
import
settings
from
django.core
import
mail
...
...
cms/djangoapps/cms_user_tasks/tests.py
View file @
e8a36957
...
...
@@ -4,21 +4,20 @@ Unit tests for integration of the django-user-tasks app and its REST API.
from
__future__
import
absolute_import
,
print_function
,
unicode_literals
from
uuid
import
uuid4
import
logging
from
uuid
import
uuid4
import
mock
from
boto.exception
import
NoAuthHandlerFound
from
rest_framework.test
import
APITestCase
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.core
import
mail
from
django.core.urlresolvers
import
reverse
from
django.test
import
override_settings
from
django.conf
import
settings
from
django.core
import
mail
from
rest_framework.test
import
APITestCase
from
user_tasks.models
import
UserTaskArtifact
,
UserTaskStatus
from
user_tasks.serializers
import
ArtifactSerializer
,
StatusSerializer
from
.signals
import
user_task_stopped
...
...
cms/djangoapps/contentstore/admin.py
View file @
e8a36957
...
...
@@ -2,10 +2,10 @@
Admin site bindings for contentstore
"""
from
config_models.admin
import
ConfigurationModelAdmin
from
django.contrib
import
admin
from
config_models.admin
import
ConfigurationModelAdmin
from
contentstore.models
import
VideoUploadConfig
,
PushNotificationConfig
from
contentstore.models
import
PushNotificationConfig
,
VideoUploadConfig
admin
.
site
.
register
(
VideoUploadConfig
,
ConfigurationModelAdmin
)
admin
.
site
.
register
(
PushNotificationConfig
,
ConfigurationModelAdmin
)
cms/djangoapps/contentstore/course_group_config.py
View file @
e8a36957
...
...
@@ -4,12 +4,12 @@ Class for manipulating groups configuration on a course object.
import
json
import
logging
from
util.db
import
generate_int_id
,
MYSQL_MAX_INT
from
django.utils.translation
import
ugettext
as
_
from
contentstore.utils
import
reverse_usage_url
from
openedx.core.djangoapps.course_groups.partition_scheme
import
get_cohorted_user_partition
from
xmodule.partitions.partitions
import
UserPartition
,
MINIMUM_STATIC_PARTITION_ID
from
util.db
import
MYSQL_MAX_INT
,
generate_int_id
from
xmodule.partitions.partitions
import
MINIMUM_STATIC_PARTITION_ID
,
UserPartition
from
xmodule.partitions.partitions_service
import
get_all_partitions_for_course
from
xmodule.split_test_module
import
get_split_user_partitions
...
...
cms/djangoapps/contentstore/course_info_model.py
View file @
e8a36957
...
...
@@ -12,18 +12,17 @@ Current db representation:
}
"""
import
re
import
logging
import
re
from
django.http
import
HttpResponseBadRequest
from
django.utils.translation
import
ugettext
as
_
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
xmodule.modulestore.django
import
modulestore
from
xmodule.html_module
import
CourseInfoModule
from
openedx.core.lib.xblock_utils
import
get_course_update_items
from
cms.djangoapps.contentstore.push_notification
import
enqueue_push_course_update
from
openedx.core.lib.xblock_utils
import
get_course_update_items
from
xmodule.html_module
import
CourseInfoModule
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
# # This should be in a class which inherits from XmlDescriptor
log
=
logging
.
getLogger
(
__name__
)
...
...
cms/djangoapps/contentstore/courseware_index.py
View file @
e8a36957
""" Code to allow module store to interface with courseware index """
from
__future__
import
absolute_import
from
abc
import
ABCMeta
,
abstractmethod
from
datetime
import
timedelta
import
logging
import
re
from
six
import
add_metaclass
from
abc
import
ABCMeta
,
abstractmethod
from
datetime
import
timedelta
from
django.conf
import
settings
from
django.utils.translation
import
ugettext_lazy
,
ugettext
as
_
from
django.core.urlresolvers
import
resolve
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext_lazy
from
search.search_engine_base
import
SearchEngine
from
six
import
add_metaclass
from
contentstore.course_group_config
import
GroupConfiguration
from
course_modes.models
import
CourseMode
from
eventtracking
import
tracker
from
openedx.core.lib.courses
import
course_image_url
from
search.search_engine_base
import
SearchEngine
from
xmodule.annotator_mixin
import
html_to_text
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.library_tools
import
normalize_key_for_search
from
xmodule.modulestore
import
ModuleStoreEnum
# REINDEX_AGE is the default amount of time that we look back for changes
# that might have happened. If we are provided with a time at which the
...
...
cms/djangoapps/contentstore/debug_file_uploader.py
View file @
e8a36957
from
django.core.files.uploadhandler
import
FileUploadHandler
import
time
from
django.core.files.uploadhandler
import
FileUploadHandler
class
DebugFileUploader
(
FileUploadHandler
):
def
__init__
(
self
,
request
=
None
):
...
...
cms/djangoapps/contentstore/features/advanced_settings.py
View file @
e8a36957
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from
lettuce
import
world
,
step
from
nose.tools
import
assert_false
,
assert_equal
,
assert_regexp_matches
from
common
import
type_in_codemirror
,
press_the_notification_button
,
get_codemirror_value
from
lettuce
import
step
,
world
from
nose.tools
import
assert_equal
,
assert_false
,
assert_regexp_matches
from
common
import
get_codemirror_value
,
press_the_notification_button
,
type_in_codemirror
KEY_CSS
=
'.key h3.title'
DISPLAY_NAME_KEY
=
"Course Display Name"
...
...
cms/djangoapps/contentstore/features/common.py
View file @
e8a36957
...
...
@@ -2,21 +2,21 @@
# pylint: disable=redefined-outer-name
import
os
from
lettuce
import
world
,
step
from
nose.tools
import
assert_true
,
assert_in
from
django.conf
import
settings
from
student.roles
import
CourseStaffRole
,
CourseInstructorRole
,
GlobalStaff
from
student.models
import
get_user
from
logging
import
getLogger
from
django.conf
import
settings
from
lettuce
import
step
,
world
from
nose.tools
import
assert_in
,
assert_true
from
selenium.webdriver.common.keys
import
Keys
from
logging
import
getLogger
from
student.tests.factories
import
AdminFactory
from
student
import
auth
from
student.models
import
get_user
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
,
GlobalStaff
from
student.tests.factories
import
AdminFactory
from
terrain.browser
import
reset_data
logger
=
getLogger
(
__name__
)
from
terrain.browser
import
reset_data
TEST_ROOT
=
settings
.
COMMON_TEST_DATA_ROOT
...
...
cms/djangoapps/contentstore/features/component.py
View file @
e8a36957
...
...
@@ -5,8 +5,8 @@
# argument name "step" instead of "_step" and pylint does not like that.
# pylint: disable=unused-argument
from
lettuce
import
world
,
step
from
nose.tools
import
assert_
true
,
assert_in
,
assert_equal
from
lettuce
import
step
,
world
from
nose.tools
import
assert_
equal
,
assert_in
,
assert_true
DISPLAY_NAME
=
"Display Name"
...
...
cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
View file @
e8a36957
...
...
@@ -3,10 +3,11 @@
from
lettuce
import
world
from
nose.tools
import
assert_equal
,
assert_in
from
terrain.steps
import
reload_the_page
from
common
import
type_in_codemirror
from
selenium.webdriver.common.keys
import
Keys
from
common
import
type_in_codemirror
from
terrain.steps
import
reload_the_page
@world.absorb
def
create_component_instance
(
step
,
category
,
component_type
=
None
,
is_advanced
=
False
,
advanced_component
=
None
):
...
...
cms/djangoapps/contentstore/features/course-settings.py
View file @
e8a36957
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from
lettuce
import
world
,
step
from
selenium.webdriver.common.keys
import
Keys
from
cms.djangoapps.contentstore.features.common
import
type_in_codemirror
from
django.conf
import
settings
from
lettuce
import
step
,
world
from
nose.tools
import
assert_false
,
assert_true
from
selenium.webdriver.common.keys
import
Keys
from
nose.tools
import
assert_true
,
assert_false
from
cms.djangoapps.contentstore.features.common
import
type_in_codemirror
TEST_ROOT
=
settings
.
COMMON_TEST_DATA_ROOT
...
...
cms/djangoapps/contentstore/features/course-updates.py
View file @
e8a36957
# pylint: disable=missing-docstring
from
cms.djangoapps.contentstore.features.common
import
type_in_codemirror
,
get_codemirror_value
from
lettuce
import
world
,
step
from
lettuce
import
step
,
world
from
nose.tools
import
assert_in
from
cms.djangoapps.contentstore.features.common
import
get_codemirror_value
,
type_in_codemirror
@step
(
u'I go to the course updates page'
)
def
go_to_updates
(
_step
):
...
...
cms/djangoapps/contentstore/features/course_import.py
View file @
e8a36957
...
...
@@ -3,8 +3,9 @@
# pylint: disable=unused-argument
import
os
from
lettuce
import
world
,
step
from
django.conf
import
settings
from
lettuce
import
step
,
world
def
import_file
(
filename
):
...
...
cms/djangoapps/contentstore/features/courses.py
View file @
e8a36957
...
...
@@ -2,9 +2,11 @@
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
from
lettuce
import
world
,
step
from
lettuce
import
step
,
world
from
common
import
*
############### ACTIONS ####################
...
...
cms/djangoapps/contentstore/features/discussion-editor.py
View file @
e8a36957
# disable missing docstring
# pylint: disable=missing-docstring
from
lettuce
import
world
,
step
from
lettuce
import
step
,
world
@step
(
'I have created a Discussion Tag$'
)
...
...
cms/djangoapps/contentstore/features/grading.py
View file @
e8a36957
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from
lettuce
import
world
,
step
from
common
import
*
from
terrain.steps
import
reload_the_page
from
lettuce
import
step
,
world
from
nose.tools
import
assert_equal
,
assert_in
,
assert_not_equal
from
selenium.common.exceptions
import
InvalidElementStateException
from
common
import
*
from
contentstore.utils
import
reverse_course_url
from
nose.tools
import
assert_in
,
assert_equal
,
assert_not_equal
from
terrain.steps
import
reload_the_page
@step
(
u'I am viewing the grading settings'
)
...
...
cms/djangoapps/contentstore/features/html-editor.py
View file @
e8a36957
...
...
@@ -3,9 +3,10 @@
from
collections
import
OrderedDict
from
lettuce
import
world
,
step
from
nose.tools
import
assert_in
,
assert_false
,
assert_true
,
assert_equal
from
common
import
type_in_codemirror
,
get_codemirror_value
from
lettuce
import
step
,
world
from
nose.tools
import
assert_equal
,
assert_false
,
assert_in
,
assert_true
from
common
import
get_codemirror_value
,
type_in_codemirror
CODEMIRROR_SELECTOR_PREFIX
=
"$('iframe').contents().find"
...
...
cms/djangoapps/contentstore/features/pages.py
View file @
e8a36957
...
...
@@ -2,10 +2,9 @@
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
from
lettuce
import
world
,
step
from
lettuce
import
step
,
world
from
nose.tools
import
assert_equal
,
assert_in
CSS_FOR_TAB_ELEMENT
=
"li[data-tab-id='{0}'] input.toggle-checkbox"
...
...
cms/djangoapps/contentstore/features/problem-editor.py
View file @
e8a36957
...
...
@@ -2,10 +2,12 @@
# pylint: disable=missing-docstring
import
json
from
lettuce
import
world
,
step
from
lettuce
import
step
,
world
from
nose.tools
import
assert_equal
,
assert_true
from
common
import
type_in_codemirror
,
open_new_course
from
advanced_settings
import
change_value
,
ADVANCED_MODULES_KEY
from
advanced_settings
import
ADVANCED_MODULES_KEY
,
change_value
from
common
import
open_new_course
,
type_in_codemirror
from
course_import
import
import_file
DISPLAY_NAME
=
"Display Name"
...
...
cms/djangoapps/contentstore/features/signup.py
View file @
e8a36957
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from
lettuce
import
world
,
step
from
nose.tools
import
assert_
true
,
assert_fals
e
from
lettuce
import
step
,
world
from
nose.tools
import
assert_
false
,
assert_tru
e
@step
(
'I fill in the registration form$'
)
...
...
cms/djangoapps/contentstore/features/textbooks.py
View file @
e8a36957
# pylint: disable=missing-docstring
from
lettuce
import
world
,
step
from
django.conf
import
settings
from
common
import
upload_file
from
lettuce
import
step
,
world
from
nose.tools
import
assert_equal
from
common
import
upload_file
TEST_ROOT
=
settings
.
COMMON_TEST_DATA_ROOT
...
...
cms/djangoapps/contentstore/features/transcripts.py
View file @
e8a36957
...
...
@@ -2,14 +2,14 @@
# pylint: disable=missing-docstring
import
os
from
lettuce
import
world
,
step
from
django.conf
import
settings
from
lettuce
import
step
,
world
from
splinter.request_handler.request_handler
import
RequestHandler
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.contentstore.django
import
contentstore
from
xmodule.exceptions
import
NotFoundError
from
splinter.request_handler.request_handler
import
RequestHandler
TEST_ROOT
=
settings
.
COMMON_TEST_DATA_ROOT
...
...
cms/djangoapps/contentstore/features/upload.py
View file @
e8a36957
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from
lettuce
import
world
,
step
from
lettuce.django
import
django_url
from
django.conf
import
settings
import
requests
import
string
import
random
import
os
import
random
import
string
import
requests
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
student.models
import
CourseEnrollment
from
lettuce
import
step
,
world
from
lettuce.django
import
django_url
from
nose.tools
import
assert_equal
,
assert_not_equal
from
student.models
import
CourseEnrollment
TEST_ROOT
=
settings
.
COMMON_TEST_DATA_ROOT
ASSET_NAMES_CSS
=
'td.name-col > span.title > a.filename'
...
...
cms/djangoapps/contentstore/features/video.py
View file @
e8a36957
# pylint: disable=missing-docstring
from
lettuce
import
world
,
step
from
lettuce
import
step
,
world
SELECTORS
=
{
'spinner'
:
'.video-wrapper .spinner'
,
...
...
cms/djangoapps/contentstore/management/commands/clean_cert_name.py
View file @
e8a36957
...
...
@@ -7,8 +7,8 @@ from collections import namedtuple
from
django.core.management.base
import
BaseCommand
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
Result
=
namedtuple
(
"Result"
,
[
"course_key"
,
"cert_name_short"
,
"cert_name_long"
,
"should_clean"
])
...
...
cms/djangoapps/contentstore/management/commands/cleanup_assets.py
View file @
e8a36957
...
...
@@ -5,8 +5,8 @@ or with filename which starts with "._") for all courses
import
logging
from
django.core.management.base
import
BaseCommand
from
xmodule.contentstore.django
import
contentstore
from
xmodule.contentstore.django
import
contentstore
log
=
logging
.
getLogger
(
__name__
)
...
...
cms/djangoapps/contentstore/management/commands/clone_course.py
View file @
e8a36957
...
...
@@ -2,12 +2,13 @@
Script for cloning a course
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
xmodule.modulestore.django
import
modulestore
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
#
...
...
cms/djangoapps/contentstore/management/commands/create_course.py
View file @
e8a36957
"""
Django management command to create a course in a specific modulestore
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.contrib.auth.models
import
User
from
xmodule.modulestore
import
ModuleStoreEnum
from
contentstore.views.course
import
create_new_course_in_store
from
django.core.management.base
import
BaseCommand
,
CommandError
from
contentstore.management.commands.utils
import
user_from_str
from
contentstore.views.course
import
create_new_course_in_store
from
xmodule.modulestore
import
ModuleStoreEnum
class
Command
(
BaseCommand
):
...
...
cms/djangoapps/contentstore/management/commands/delete_course.py
View file @
e8a36957
...
...
@@ -8,13 +8,15 @@
none
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
.prompt
import
query_yes_no
from
contentstore.utils
import
delete_course_and_groups
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
contentstore.utils
import
delete_course_and_groups
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
.prompt
import
query_yes_no
class
Command
(
BaseCommand
):
"""
...
...
cms/djangoapps/contentstore/management/commands/delete_orphans.py
View file @
e8a36957
"""Script for deleting orphans"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
contentstore.views.item
import
_delete_orphans
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
contentstore.views.item
import
_delete_orphans
from
xmodule.modulestore
import
ModuleStoreEnum
...
...
cms/djangoapps/contentstore/management/commands/edit_course_tabs.py
View file @
e8a36957
...
...
@@ -8,14 +8,14 @@
#
from
optparse
import
make_option
from
django.core.management.base
import
BaseCommand
,
CommandError
from
.prompt
import
query_yes_no
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
contentstore.views
import
tabs
from
courseware.courses
import
get_course_by_id
from
contentstore.views
import
tabs
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys.edx.keys
import
CourseKey
from
.prompt
import
query_yes_no
def
print_course
(
course
):
...
...
cms/djangoapps/contentstore/management/commands/empty_asset_trashcan.py
View file @
e8a36957
from
django.core.management.base
import
BaseCommand
,
CommandError
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
xmodule.contentstore.utils
import
empty_asset_trashcan
from
xmodule.modulestore.django
import
modulestore
from
opaque_keys.edx.keys
import
CourseKey
from
.prompt
import
query_yes_no
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
class
Command
(
BaseCommand
):
...
...
cms/djangoapps/contentstore/management/commands/export.py
View file @
e8a36957
...
...
@@ -4,13 +4,14 @@ Script for exporting courseware from Mongo to a tar.gz file
import
os
from
django.core.management.base
import
BaseCommand
,
CommandError
from
xmodule.modulestore.xml_exporter
import
export_course_to_xml
from
xmodule.modulestore.django
import
modulestore
from
opaque_keys.edx.keys
import
CourseKey
from
xmodule.contentstore.django
import
contentstore
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
xmodule.contentstore.django
import
contentstore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.xml_exporter
import
export_course_to_xml
class
Command
(
BaseCommand
):
"""
...
...
cms/djangoapps/contentstore/management/commands/export_all_courses.py
View file @
e8a36957
...
...
@@ -2,9 +2,10 @@
Script for exporting all courseware from Mongo to a directory and listing the courses which failed to export
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
xmodule.modulestore.xml_exporter
import
export_course_to_xml
from
xmodule.modulestore.django
import
modulestore
from
xmodule.contentstore.django
import
contentstore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.xml_exporter
import
export_course_to_xml
class
Command
(
BaseCommand
):
...
...
cms/djangoapps/contentstore/management/commands/export_olx.py
View file @
e8a36957
...
...
@@ -19,17 +19,16 @@ import os
import
re
import
shutil
import
tarfile
from
tempfile
import
mk
temp
,
mkd
temp
from
tempfile
import
mk
dtemp
,
mk
temp
from
textwrap
import
dedent
from
path
import
Path
as
path
from
django.core.management.base
import
BaseCommand
,
CommandError
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
path
import
Path
as
path
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.xml_exporter
import
export_course_to_xml
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
class
Command
(
BaseCommand
):
...
...
cms/djangoapps/contentstore/management/commands/fix_not_found.py
View file @
e8a36957
...
...
@@ -3,8 +3,10 @@ Script for fixing the item not found errors in a course
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
opaque_keys.edx.keys
import
CourseKey
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
# To run from command line: ./manage.py cms fix_not_found course-v1:org+course+run
...
...
cms/djangoapps/contentstore/management/commands/force_publish.py
View file @
e8a36957
...
...
@@ -2,13 +2,16 @@
Script for force publishing a course
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
.prompt
import
query_yes_no
from
.utils
import
get_course_versions
# To run from command line: ./manage.py cms force_publish course-v1:org+course+run
...
...
cms/djangoapps/contentstore/management/commands/git_export.py
View file @
e8a36957
...
...
@@ -18,12 +18,12 @@ from optparse import make_option
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.utils.translation
import
ugettext
as
_
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
import
contentstore.git_export_utils
as
git_export_utils
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys
import
InvalidKeyError
from
contentstore.git_export_utils
import
GitExportError
from
opaque_keys.edx.keys
import
CourseKey
log
=
logging
.
getLogger
(
__name__
)
...
...
cms/djangoapps/contentstore/management/commands/import.py
View file @
e8a36957
...
...
@@ -4,12 +4,12 @@ Script for importing courseware from XML format
from
optparse
import
make_option
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django_comment_common.utils
import
(
seed_permissions_roles
,
are_permissions_roles_seeded
)
from
xmodule.
modulestore.xml_importer
import
import_course_from_xml
from
django_comment_common.utils
import
are_permissions_roles_seeded
,
seed_permissions_roles
from
xmodule.
contentstore.django
import
contentstore
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.
contentstore.django
import
contentstore
from
xmodule.
modulestore.xml_importer
import
import_course_from_xml
class
Command
(
BaseCommand
):
...
...
cms/djangoapps/contentstore/management/commands/migrate_to_split.py
View file @
e8a36957
...
...
@@ -2,14 +2,15 @@
Django management command to migrate a course from the old Mongo modulestore
to the new split-Mongo modulestore.
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.contrib.auth.models
import
User
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.split_migrator
import
SplitMigrator
from
opaque_keys.edx.keys
import
CourseKey
from
django.core.management.base
import
BaseCommand
,
CommandError
from
opaque_keys
import
InvalidKeyError
from
xmodule.modulestore
import
ModuleStoreEnum
from
opaque_keys.edx.keys
import
CourseKey
from
contentstore.management.commands.utils
import
user_from_str
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.split_migrator
import
SplitMigrator
class
Command
(
BaseCommand
):
...
...
cms/djangoapps/contentstore/management/commands/populate_creators.py
View file @
e8a36957
...
...
@@ -3,13 +3,14 @@ Script for granting existing course instructors course creator privileges.
This script is only intended to be run once on a given environment.
"""
from
course_creators.views
import
add_user_with_status_granted
,
add_user_with_status_unrequested
from
django.core.management.base
import
BaseCommand
from
django.contrib.auth.models
import
User
from
django.core.management.base
import
BaseCommand
from
django.db.utils
import
IntegrityError
from
course_creators.views
import
add_user_with_status_granted
,
add_user_with_status_unrequested
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
#------------ to run: ./manage.py cms populate_creators --settings=dev
...
...
cms/djangoapps/contentstore/management/commands/reindex_course.py
View file @
e8a36957
""" Management command to update courses' search index """
import
logging
from
django.core.management
import
BaseCommand
,
CommandError
from
optparse
import
make_option
from
textwrap
import
dedent
from
contentstore.courseware_index
import
CoursewareSearchIndexer
from
search.search_engine_base
import
SearchEngine
from
django.core.management
import
BaseCommand
,
CommandError
from
elasticsearch
import
exceptions
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locator
import
CourseLocator
from
search.search_engine_base
import
SearchEngine
from
.prompt
import
query_yes_no
from
contentstore.courseware_index
import
CoursewareSearchIndexer
from
xmodule.modulestore.django
import
modulestore
from
.prompt
import
query_yes_no
class
Command
(
BaseCommand
):
"""
...
...
cms/djangoapps/contentstore/management/commands/reindex_library.py
View file @
e8a36957
""" Management command to update libraries' search index """
from
django.core.management
import
BaseCommand
,
CommandError
from
optparse
import
make_option
from
textwrap
import
dedent
from
contentstore.courseware_index
import
LibrarySearchIndexer
from
opaque_keys.edx.keys
import
CourseKey
from
django.core.management
import
BaseCommand
,
CommandError
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys.edx.locator
import
LibraryLocator
from
.prompt
import
query_yes_no
from
contentstore.courseware_index
import
LibrarySearchIndexer
from
xmodule.modulestore.django
import
modulestore
from
.prompt
import
query_yes_no
class
Command
(
BaseCommand
):
"""
...
...
cms/djangoapps/contentstore/management/commands/restore_asset_from_trashcan.py
View file @
e8a36957
from
django.core.management.base
import
BaseCommand
,
CommandError
from
xmodule.contentstore.utils
import
restore_asset_from_trashcan
...
...
cms/djangoapps/contentstore/management/commands/utils.py
View file @
e8a36957
...
...
@@ -3,6 +3,7 @@ Common methods for cms commands to use
"""
from
django.contrib.auth.models
import
User
from
opaque_keys.edx.keys
import
CourseKey
from
xmodule.modulestore.django
import
modulestore
...
...
cms/djangoapps/contentstore/management/commands/xlint.py
View file @
e8a36957
...
...
@@ -2,6 +2,7 @@
Verify the structure of courseware as to it's suitability for import
"""
from
django.core.management.base
import
BaseCommand
,
CommandError
from
xmodule.modulestore.xml_importer
import
perform_xlint
...
...
cms/djangoapps/contentstore/migrations/0001_initial.py
View file @
e8a36957
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
import
django.db.models.deletion
from
django.conf
import
settings
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
...
...
cms/djangoapps/contentstore/models.py
View file @
e8a36957
...
...
@@ -2,9 +2,8 @@
Models for contentstore
"""
from
django.db.models.fields
import
TextField
from
config_models.models
import
ConfigurationModel
from
django.db.models.fields
import
TextField
class
VideoUploadConfig
(
ConfigurationModel
):
...
...
cms/djangoapps/contentstore/proctoring.py
View file @
e8a36957
...
...
@@ -5,24 +5,20 @@ Code related to the handling of Proctored Exams in Studio
import
logging
from
django.conf
import
settings
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
contentstore.views.helpers
import
is_item_in_course_tree
from
edx_proctoring.api
import
(
get_exam_by_content_id
,
update_exam
,
create_exam
,
get_all_exams_for_course
,
update_review_policy
,
create_exam_review_policy
,
get_all_exams_for_course
,
get_exam_by_content_id
,
remove_review_policy
,
update_exam
,
update_review_policy
)
from
edx_proctoring.exceptions
import
(
ProctoredExamNotFoundException
,
ProctoredExamReviewPolicyNotFoundException
)
from
edx_proctoring.exceptions
import
ProctoredExamNotFoundException
,
ProctoredExamReviewPolicyNotFoundException
from
contentstore.views.helpers
import
is_item_in_course_tree
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
log
=
logging
.
getLogger
(
__name__
)
...
...
cms/djangoapps/contentstore/push_notification.py
View file @
e8a36957
...
...
@@ -2,16 +2,17 @@
Helper methods for push notifications from Studio.
"""
from
logging
import
exception
as
log_exception
from
uuid
import
uuid4
from
django.conf
import
settings
from
logging
import
exception
as
log_exception
from
contentstore.tasks
import
push_course_update_task
from
contentstore.models
import
PushNotificationConfig
from
xmodule.modulestore.django
import
modulestore
from
parse_rest.installation
import
Push
from
contentstore.tasks
import
push_course_update_task
from
parse_rest.connection
import
register
from
parse_rest.core
import
ParseError
from
parse_rest.installation
import
Push
from
xmodule.modulestore.django
import
modulestore
def
push_notification_enabled
():
...
...
cms/djangoapps/contentstore/signals/handlers.py
View file @
e8a36957
...
...
@@ -2,17 +2,16 @@
import
logging
from
datetime
import
datetime
from
pytz
import
UTC
from
django.dispatch
import
receiver
from
pytz
import
UTC
from
xmodule.modulestore.django
import
modulestore
,
SignalHandler
from
contentstore.courseware_index
import
CoursewareSearchIndexer
,
LibrarySearchIndexer
from
contentstore.proctoring
import
register_special_exams
from
openedx.core.djangoapps.credit.signals
import
on_course_publish
from
openedx.core.lib.gating
import
api
as
gating_api
from
util.module_utils
import
yield_dynamic_descriptor_descendants
from
xmodule.modulestore.django
import
SignalHandler
,
modulestore
log
=
logging
.
getLogger
(
__name__
)
...
...
cms/djangoapps/contentstore/storage.py
View file @
e8a36957
...
...
@@ -5,7 +5,6 @@ from __future__ import absolute_import
from
django.conf
import
settings
from
django.core.files.storage
import
get_storage_class
from
storages.backends.s3boto
import
S3BotoStorage
from
storages.utils
import
setting
...
...
cms/djangoapps/contentstore/tasks.py
View file @
e8a36957
...
...
@@ -13,11 +13,6 @@ from tempfile import NamedTemporaryFile, mkdtemp
from
celery.task
import
task
from
celery.utils.log
import
get_task_logger
from
organizations.models
import
OrganizationCourse
from
path
import
Path
as
path
from
pytz
import
UTC
from
six
import
iteritems
,
text_type
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.core.exceptions
import
SuspiciousOperation
...
...
@@ -25,8 +20,13 @@ from django.core.files import File
from
django.test
import
RequestFactory
from
django.utils.text
import
get_valid_filename
from
django.utils.translation
import
ugettext
as
_
from
djcelery.common
import
respect_language
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locator
import
LibraryLocator
from
organizations.models
import
OrganizationCourse
from
path
import
Path
as
path
from
pytz
import
UTC
from
six
import
iteritems
,
text_type
from
user_tasks.models
import
UserTaskArtifact
,
UserTaskStatus
from
user_tasks.tasks
import
UserTask
...
...
@@ -36,9 +36,7 @@ from contentstore.storage import course_import_export_storage
from
contentstore.utils
import
initialize_permissions
,
reverse_usage_url
from
course_action_state.models
import
CourseRerunState
from
models.settings.course_metadata
import
CourseMetadata
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locator
import
LibraryLocator
from
openedx.core.djangoapps.embargo.models
import
RestrictedCourse
,
CountryAccessRule
from
openedx.core.djangoapps.embargo.models
import
CountryAccessRule
,
RestrictedCourse
from
openedx.core.lib.extract_tar
import
safetar_extractall
from
student.auth
import
has_course_author_access
from
xmodule.contentstore.django
import
contentstore
...
...
@@ -50,7 +48,6 @@ from xmodule.modulestore.exceptions import DuplicateCourseError, ItemNotFoundErr
from
xmodule.modulestore.xml_exporter
import
export_course_to_xml
,
export_library_to_xml
from
xmodule.modulestore.xml_importer
import
import_course_from_xml
,
import_library_from_xml
LOGGER
=
get_task_logger
(
__name__
)
FILE_READ_CHUNK
=
1024
# bytes
FULL_COURSE_REINDEX_THRESHOLD
=
1
...
...
cms/djangoapps/contentstore/tests/test_clone_course.py
View file @
e8a36957
...
...
@@ -2,21 +2,21 @@
Unit tests for cloning a course between the same and different module stores.
"""
import
json
from
django.conf
import
settings
from
django.conf
import
settings
from
mock
import
Mock
,
patch
from
opaque_keys.edx.locator
import
CourseLocator
from
xmodule.modulestore
import
ModuleStoreEnum
,
EdxJSONEncoder
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.tasks
import
rerun_course
from
student.auth
import
has_course_author_access
from
course_action_state.models
import
CourseRerunState
from
contentstore.tests.utils
import
CourseTestCase
from
course_action_state.managers
import
CourseRerunUIStateManager
from
mock
import
patch
,
Mock
from
course_action_state.models
import
CourseRerunState
from
student.auth
import
has_course_author_access
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.contentstore.django
import
contentstore
from
xmodule.modulestore
import
EdxJSONEncoder
,
ModuleStoreEnum
from
xmodule.modulestore.tests.factories
import
CourseFactory
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
...
...
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
e8a36957
# -*- coding: utf-8 -*-
import
copy
import
mock
import
shutil
import
lxml.html
from
lxml
import
etree
import
ddt
from
datetime
import
timedelta
from
f
s.osfs
import
OSFS
from
f
unctools
import
wraps
from
json
import
loads
from
path
import
Path
as
path
from
textwrap
import
dedent
from
uuid
import
uuid4
from
functools
import
wraps
from
unittest
import
SkipTest
from
uuid
import
uuid4
import
ddt
import
lxml.html
import
mock
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
edxval.api
import
create_video
,
get_videos_for_course
from
fs.osfs
import
OSFS
from
lxml
import
etree
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
,
UsageKey
from
opaque_keys.edx.locations
import
AssetLocation
,
CourseLocator
from
path
import
Path
as
path
from
openedx.core.lib.tempdir
import
mkdtemp_clean
from
common.test.utils
import
XssTestMixin
from
contentstore.tests.utils
import
parse_json
,
AjaxEnabledTestClient
,
CourseTestCase
from
contentstore.tests.utils
import
AjaxEnabledTestClient
,
CourseTestCase
,
get_url
,
parse_json
from
contentstore.utils
import
delete_course_and_groups
,
reverse_course_url
,
reverse_url
from
contentstore.views.component
import
ADVANCED_COMPONENT_TYPES
from
edxval.api
import
create_video
,
get_videos_for_course
from
course_action_state.managers
import
CourseActionStateItemNotFoundError
from
course_action_state.models
import
CourseRerunState
,
CourseRerunUIStateManager
from
django_comment_common.utils
import
are_permissions_roles_seeded
from
openedx.core.lib.tempdir
import
mkdtemp_clean
from
student
import
auth
from
student.models
import
CourseEnrollment
from
student.roles
import
CourseCreatorRole
,
CourseInstructorRole
from
xmodule.capa_module
import
CapaDescriptor
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.contentstore.django
import
contentstore
from
xmodule.contentstore.utils
import
restore_asset_from_trashcan
,
empty_asset_trashcan
from
xmodule.contentstore.utils
import
empty_asset_trashcan
,
restore_asset_from_trashcan
from
xmodule.course_module
import
CourseDescriptor
,
Textbook
from
xmodule.exceptions
import
InvalidVersionError
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
xmodule.modulestore.inheritance
import
own_metadata
from
opaque_keys.edx.keys
import
UsageKey
,
CourseKey
from
opaque_keys.edx.locations
import
AssetLocation
,
CourseLocator
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
,
LibraryFactory
,
check_mongo_calls
from
xmodule.modulestore.xml_exporter
import
export_course_to_xml
from
xmodule.modulestore.xml_importer
import
import_course_from_xml
,
perform_xlint
from
xmodule.capa_module
import
CapaDescriptor
from
xmodule.course_module
import
CourseDescriptor
,
Textbook
from
xmodule.seq_module
import
SequenceDescriptor
from
contentstore.utils
import
delete_course_and_groups
,
reverse_url
,
reverse_course_url
from
django_comment_common.utils
import
are_permissions_roles_seeded
from
student
import
auth
from
student.models
import
CourseEnrollment
from
student.roles
import
CourseCreatorRole
,
CourseInstructorRole
from
opaque_keys
import
InvalidKeyError
from
contentstore.tests.utils
import
get_url
from
course_action_state.models
import
CourseRerunState
,
CourseRerunUIStateManager
from
course_action_state.managers
import
CourseActionStateItemNotFoundError
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.modulestore.django
import
modulestore
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
...
...
cms/djangoapps/contentstore/tests/test_core_caching.py
View file @
e8a36957
...
...
@@ -3,9 +3,9 @@ Tests core caching facilities.
"""
from
django.test
import
TestCase
from
opaque_keys.edx.locations
import
Location
from
openedx.core.djangoapps.contentserver.caching
import
get_cached_content
,
set_cached_content
,
del_cached_content
from
openedx.core.djangoapps.contentserver.caching
import
del_cached_content
,
get_cached_content
,
set_cached_content
class
Content
(
object
):
...
...
cms/djangoapps/contentstore/tests/test_course_create_rerun.py
View file @
e8a36957
"""
Test view handler for rerun (and eventually create)
"""
import
ddt
from
mock
import
patch
from
datetime
import
datetime
from
django.test.client
import
RequestFactory
import
ddt
from
django.core.urlresolvers
import
reverse
from
django.test.client
import
RequestFactory
from
mock
import
patch
from
opaque_keys.edx.keys
import
CourseKey
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
contentstore.tests.utils
import
AjaxEnabledTestClient
,
parse_json
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
from
student.tests.factories
import
UserFactory
from
contentstore.tests.utils
import
AjaxEnabledTestClient
,
parse_json
from
datetime
import
datetime
from
util.organizations_helpers
import
add_organization
,
get_course_organizations
from
xmodule.course_module
import
CourseFields
from
util.organizations_helpers
import
(
add_organization
,
get_course_organizations
,
)
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
@ddt.ddt
...
...
cms/djangoapps/contentstore/tests/test_course_listing.py
View file @
e8a36957
...
...
@@ -4,43 +4,40 @@ by reversing group name formats.
"""
import
random
from
chrono
import
Timer
from
mock
import
patch
,
Mock
import
ddt
from
django.conf
import
settings
from
ccx_keys.locator
import
CCXLocator
from
chrono
import
Timer
from
django.conf
import
settings
from
django.test
import
RequestFactory
from
django.test.client
import
Client
from
mock
import
Mock
,
patch
from
opaque_keys.edx.locations
import
CourseLocator
from
common.test.utils
import
XssTestMixin
from
xmodule.course_module
import
CourseSummary
from
contentstore.tests.utils
import
AjaxEnabledTestClient
from
contentstore.utils
import
delete_course_and_groups
from
contentstore.views.course
import
(
AccessListFallback
,
_accessible_courses_iter
,
_accessible_courses_list_from_groups
,
AccessListFallback
,
get_courses_accessible_to_user
,
_accessible_courses_summary_iter
,
get_courses_accessible_to_user
)
from
contentstore.utils
import
delete_course_and_groups
from
contentstore.tests.utils
import
AjaxEnabledTestClient
from
student.tests.factories
import
UserFactory
from
course_action_state.models
import
CourseRerunState
from
student.roles
import
(
CourseInstructorRole
,
CourseStaffRole
,
GlobalStaff
,
OrgStaffRole
,
OrgInstructorRole
,
UserBasedRole
,
OrgStaffRole
,
UserBasedRole
)
from
student.tests.factories
import
UserFactory
from
xmodule.course_module
import
CourseSummary
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
check_mongo_calls
from
xmodule.modulestore
import
ModuleStoreEnum
from
opaque_keys.edx.locations
import
CourseLocator
from
xmodule.error_module
import
ErrorDescriptor
from
course_action_state.models
import
CourseRerunState
TOTAL_COURSES_COUNT
=
10
USER_COURSES_COUNT
=
1
...
...
cms/djangoapps/contentstore/tests/test_course_settings.py
View file @
e8a36957
"""
Tests for Studio Course Settings.
"""
import
copy
import
datetime
import
ddt
import
json
import
copy
import
mock
from
mock
import
Mock
,
patch
import
unittest
import
ddt
import
mock
from
django.conf
import
settings
from
django.utils.timezone
import
UTC
from
django.test.utils
import
override_settings
from
django.utils.timezone
import
UTC
from
milestones.tests.utils
import
MilestonesTestCaseMixin
from
mock
import
Mock
,
patch
from
contentstore.utils
import
reverse_course_url
,
reverse_usage_url
from
models.settings.course_grading
import
CourseGradingModel
from
models.settings.course_metadata
import
CourseMetadata
from
models.settings.encoder
import
CourseSettingsEncoder
from
openedx.core.djangoapps.self_paced.models
import
SelfPacedConfiguration
from
openedx.core.djangoapps.models.course_details
import
CourseDetails
from
openedx.core.djangoapps.self_paced.models
import
SelfPacedConfiguration
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
from
student.tests.factories
import
UserFactory
from
xblock_django.models
import
XBlockStudioConfigurationFlag
...
...
@@ -27,9 +28,8 @@ from xmodule.modulestore import ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.tabs
import
InvalidTabsException
from
milestones.tests.utils
import
MilestonesTestCaseMixin
from
.utils
import
CourseTestCase
,
AjaxEnabledTestClient
from
.utils
import
AjaxEnabledTestClient
,
CourseTestCase
def
get_url
(
course_id
,
handler_name
=
'settings_handler'
):
...
...
cms/djangoapps/contentstore/tests/test_courseware_index.py
View file @
e8a36957
"""
Testing indexing of the courseware as it is changed
"""
import
ddt
import
json
from
lazy.lazy
import
lazy
import
time
from
datetime
import
datetime
from
dateutil.tz
import
tzutc
from
mock
import
patch
from
pytz
import
UTC
from
uuid
import
uuid4
from
unittest
import
skip
from
uuid
import
uuid4
import
ddt
from
dateutil.tz
import
tzutc
from
django.conf
import
settings
from
lazy.lazy
import
lazy
from
mock
import
patch
from
pytz
import
UTC
from
search.search_engine_base
import
SearchEngine
from
contentstore.courseware_index
import
(
CourseAboutSearchIndexer
,
CoursewareSearchIndexer
,
LibrarySearchIndexer
,
SearchIndexingError
)
from
contentstore.signals.handlers
import
listen_for_course_publish
,
listen_for_library_update
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
,
reverse_usage_url
from
course_modes.models
import
CourseMode
from
openedx.core.djangoapps.models.course_details
import
CourseDetails
from
xmodule.library_tools
import
normalize_key_for_search
...
...
@@ -25,28 +35,19 @@ from xmodule.modulestore.mixed import MixedModuleStore
from
xmodule.modulestore.tests.django_utils
import
(
TEST_DATA_MONGO_MODULESTORE
,
TEST_DATA_SPLIT_MODULESTORE
,
SharedModuleStoreTestCase
)
SharedModuleStoreTestCase
)
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
,
LibraryFactory
from
xmodule.modulestore.tests.mongo_connection
import
MONGO_
PORT_NUM
,
MONGO_HOST
from
xmodule.modulestore.tests.mongo_connection
import
MONGO_
HOST
,
MONGO_PORT_NUM
from
xmodule.modulestore.tests.utils
import
(
create_modulestore_instance
,
LocationMixin
,
MixedSplitTestCase
,
MongoContentstoreBuilder
LocationMixin
,
MixedSplitTestCase
,
MongoContentstoreBuilder
,
create_modulestore_instance
)
from
xmodule.partitions.partitions
import
UserPartition
from
xmodule.tests
import
DATA_DIR
from
xmodule.x_module
import
XModuleMixin
from
xmodule.partitions.partitions
import
UserPartition
from
search.search_engine_base
import
SearchEngine
from
contentstore.courseware_index
import
(
CoursewareSearchIndexer
,
LibrarySearchIndexer
,
SearchIndexingError
,
CourseAboutSearchIndexer
,
)
from
contentstore.signals.handlers
import
listen_for_course_publish
,
listen_for_library_update
from
contentstore.utils
import
reverse_course_url
,
reverse_usage_url
from
contentstore.tests.utils
import
CourseTestCase
COURSE_CHILD_STRUCTURE
=
{
"course"
:
"chapter"
,
...
...
cms/djangoapps/contentstore/tests/test_crud.py
View file @
e8a36957
from
xmodule
import
templates
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
TEST_DATA_SPLIT_MODULESTORE
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.seq_module
import
SequenceDescriptor
from
xmodule.capa_module
import
CapaDescriptor
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.html_module
import
HtmlDescriptor
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.exceptions
import
DuplicateCourseError
from
xmodule.modulestore.tests.django_utils
import
TEST_DATA_SPLIT_MODULESTORE
,
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.seq_module
import
SequenceDescriptor
class
TemplateTests
(
ModuleStoreTestCase
):
...
...
cms/djangoapps/contentstore/tests/test_export_git.py
View file @
e8a36957
...
...
@@ -11,10 +11,11 @@ from uuid import uuid4
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
.utils
import
CourseTestCase
import
contentstore.git_export_utils
as
git_export_utils
from
xmodule.modulestore.django
import
modulestore
from
contentstore.utils
import
reverse_course_url
from
xmodule.modulestore.django
import
modulestore
from
.utils
import
CourseTestCase
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
...
...
cms/djangoapps/contentstore/tests/test_gating.py
View file @
e8a36957
"""
Unit tests for the gating feature in Studio
"""
from
contentstore.signals.handlers
import
handle_item_deleted
from
milestones.tests.utils
import
MilestonesTestCaseMixin
from
mock
import
patch
from
contentstore.signals.handlers
import
handle_item_deleted
from
openedx.core.lib.gating
import
api
as
gating_api
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
ItemFactory
,
Course
Factory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
Item
Factory
class
TestHandleItemDeleted
(
ModuleStoreTestCase
,
MilestonesTestCaseMixin
):
...
...
cms/djangoapps/contentstore/tests/test_i18n.py
View file @
e8a36957
"""
Tests for validate Internationalization and Module i18n service.
"""
import
mock
import
gettext
from
unittest
import
skip
import
mock
from
django.contrib.auth.models
import
User
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
contentstore.tests.utils
import
AjaxEnabledTestClient
from
xmodule.modulestore.django
import
ModuleI18nService
from
django.utils
import
translation
from
django.utils.translation
import
get_language
from
xmodule.modulestore.tests.factories
import
ItemFactory
,
CourseFactory
from
contentstore.tests.utils
import
AjaxEnabledTestClient
from
contentstore.views.preview
import
_preview_module_system
from
xmodule.modulestore.django
import
ModuleI18nService
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
class
FakeTranslations
(
ModuleI18nService
):
...
...
cms/djangoapps/contentstore/tests/test_import.py
View file @
e8a36957
...
...
@@ -4,22 +4,23 @@
Tests for import_course_from_xml using the mongo modulestore.
"""
import
copy
from
uuid
import
uuid4
import
ddt
from
django.conf
import
settings
from
django.test.client
import
Client
from
django.test.utils
import
override_settings
from
django.conf
import
settings
import
ddt
import
copy
from
mock
import
patch
from
openedx.core.djangoapps.content.course_structures.tests
import
SignalDisconnectTestMixin
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.contentstore.django
import
contentstore
from
xmodule.exceptions
import
NotFoundError
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.
contentstore.django
import
contentstor
e
from
xmodule.
modulestore.tests.django_utils
import
ModuleStoreTestCas
e
from
xmodule.modulestore.tests.factories
import
check_exact_number_of_calls
,
check_number_of_calls
from
xmodule.modulestore.xml_importer
import
import_course_from_xml
from
xmodule.exceptions
import
NotFoundError
from
uuid
import
uuid4
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
...
...
cms/djangoapps/contentstore/tests/test_import_draft_order.py
View file @
e8a36957
"""
Tests Draft import order.
"""
from
xmodule.modulestore.xml_importer
import
import_course_from_xml
from
django.conf
import
settings
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.django
import
modulestore
from
django.conf
import
settings
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.xml_importer
import
import_course_from_xml
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
...
...
cms/djangoapps/contentstore/tests/test_import_pure_xblock.py
View file @
e8a36957
...
...
@@ -2,15 +2,15 @@
Integration tests for importing courses containing pure XBlocks.
"""
from
django.conf
import
settings
from
xblock.core
import
XBlock
from
xblock.fields
import
String
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.xml_importer
import
import_course_from_xml
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.mongo.draft
import
as_draft
from
django.conf
import
settings
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.xml_importer
import
import_course_from_xml
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
...
...
cms/djangoapps/contentstore/tests/test_libraries.py
View file @
e8a36957
"""
Content library unit tests that require the CMS runtime.
"""
import
ddt
from
django.test.utils
import
override_settings
from
mock
import
Mock
,
patch
from
opaque_keys.edx.locator
import
CourseKey
,
LibraryLocator
from
contentstore.tests.utils
import
AjaxEnabledTestClient
,
parse_json
from
contentstore.utils
import
reverse_
url
,
reverse_usage_url
,
reverse_library
_url
from
contentstore.utils
import
reverse_
library_url
,
reverse_url
,
reverse_usage
_url
from
contentstore.views.item
import
_duplicate_item
from
contentstore.views.preview
import
_load_preview_module
from
contentstore.views.tests.test_library
import
LIBRARY_REST_URL
import
ddt
from
mock
import
patch
from
course_creators.views
import
add_user_with_status_granted
from
openedx.core.djangoapps.content.course_structures.tests
import
SignalDisconnectTestMixin
from
student
import
auth
from
student.auth
import
has_studio_read_access
,
has_studio_write_access
from
student.roles
import
(
CourseInstructorRole
,
CourseStaffRole
,
LibraryUserRole
,
OrgStaffRole
,
OrgInstructorRole
,
OrgLibraryUserRole
,
CourseInstructorRole
,
CourseStaffRole
,
LibraryUserRole
,
OrgInstructorRole
,
OrgLibraryUserRole
,
OrgStaffRole
)
from
student.tests.factories
import
UserFactory
from
xblock_django.user_service
import
DjangoXBlockUserService
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
mock
import
Mock
from
opaque_keys.edx.locator
import
CourseKey
,
LibraryLocator
from
openedx.core.djangoapps.content.course_structures.tests
import
SignalDisconnectTestMixin
from
xblock_django.user_service
import
DjangoXBlockUserService
from
xmodule.x_module
import
STUDIO_VIEW
from
student
import
auth
from
student.tests.factories
import
UserFactory
from
course_creators.views
import
add_user_with_status_granted
class
LibraryTestCase
(
ModuleStoreTestCase
):
...
...
cms/djangoapps/contentstore/tests/test_orphan.py
View file @
e8a36957
...
...
@@ -2,11 +2,12 @@
Test finding orphans via the view and django config
"""
import
json
import
ddt
from
opaque_keys.edx.locator
import
BlockUsageLocator
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
from
opaque_keys.edx.locator
import
BlockUsageLocator
from
student.models
import
CourseEnrollment
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.search
import
path_to_location
...
...
cms/djangoapps/contentstore/tests/test_permissions.py
View file @
e8a36957
...
...
@@ -5,11 +5,11 @@ import copy
from
django.contrib.auth.models
import
User
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
contentstore.tests.utils
import
AjaxEnabledTestClient
from
contentstore.utils
import
reverse_url
,
reverse_course_url
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
,
OrgStaffRole
,
OrgInstructorRole
from
contentstore.utils
import
reverse_course_url
,
reverse_url
from
student
import
auth
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
,
OrgInstructorRole
,
OrgStaffRole
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
class
TestCourseAccess
(
ModuleStoreTestCase
):
...
...
cms/djangoapps/contentstore/tests/test_proctoring.py
View file @
e8a36957
...
...
@@ -2,19 +2,16 @@
Tests for the edx_proctoring integration into Studio
"""
from
mock
import
patch
import
ddt
from
datetime
import
datetime
,
timedelta
import
ddt
from
edx_proctoring.api
import
get_all_exams_for_course
,
get_review_policy_by_exam_id
from
mock
import
patch
from
pytz
import
UTC
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
contentstore.signals.handlers
import
listen_for_course_publish
from
edx_proctoring.api
import
(
get_all_exams_for_course
,
get_review_policy_by_exam_id
)
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
@ddt.ddt
...
...
cms/djangoapps/contentstore/tests/test_request_event.py
View file @
e8a36957
"""Tests for CMS's requests to logs"""
import
mock
from
django.test
import
TestCase
from
django.core.urlresolvers
import
reverse
from
django.test
import
TestCase
from
contentstore.views.helpers
import
event
as
cms_user_track
...
...
cms/djangoapps/contentstore/tests/test_tasks.py
View file @
e8a36957
...
...
@@ -15,13 +15,13 @@ from opaque_keys.edx.locator import CourseLocator
from
organizations.models
import
OrganizationCourse
from
organizations.tests.factories
import
OrganizationFactory
from
user_tasks.models
import
UserTaskArtifact
,
UserTaskStatus
from
xmodule.modulestore.django
import
modulestore
from
contentstore.tasks
import
export_olx
,
rerun_course
from
contentstore.tests.test_libraries
import
LibraryTestCase
from
contentstore.tests.utils
import
CourseTestCase
from
course_action_state.models
import
CourseRerunState
from
openedx.core.djangoapps.embargo.models
import
RestrictedCourse
,
CountryAccessRule
,
Country
from
openedx.core.djangoapps.embargo.models
import
Country
,
CountryAccessRule
,
RestrictedCourse
from
xmodule.modulestore.django
import
modulestore
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
...
...
cms/djangoapps/contentstore/tests/test_transcripts_utils.py
View file @
e8a36957
# -*- coding: utf-8 -*-
""" Tests for transcripts_utils. """
import
unittest
from
uuid
import
uuid4
import
copy
import
textwrap
from
mock
import
patch
,
Mock
import
unittest
from
uuid
import
uuid4
from
django.test.utils
import
override_settings
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
django.utils
import
translation
from
mock
import
Mock
,
patch
from
nose.plugins.skip
import
SkipTest
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
contentstore.tests.utils
import
mock_requests_get
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.modulestore.tests.django_utils
import
SharedModuleStoreTestCase
from
xmodule.exceptions
import
NotFoundError
from
xmodule.contentstore.django
import
contentstore
from
xmodule.exceptions
import
NotFoundError
from
xmodule.modulestore.tests.django_utils
import
SharedModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.video_module
import
transcripts_utils
from
contentstore.tests.utils
import
mock_requests_get
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
...
...
cms/djangoapps/contentstore/tests/test_users_default_role.py
View file @
e8a36957
...
...
@@ -5,9 +5,8 @@ after deleting it creates same course again
from
contentstore.tests.utils
import
AjaxEnabledTestClient
from
contentstore.utils
import
delete_course_and_groups
,
reverse_url
from
courseware.tests.factories
import
UserFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
student.models
import
CourseEnrollment
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
class
TestUsersDefaultRole
(
ModuleStoreTestCase
):
...
...
cms/djangoapps/contentstore/tests/test_utils.py
View file @
e8a36957
...
...
@@ -2,19 +2,18 @@
import
collections
from
datetime
import
datetime
,
timedelta
from
pytz
import
UTC
from
django.test
import
TestCase
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
SharedModuleStoreTestCase
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.django
import
modulestore
from
xmodule.partitions.partitions
import
UserPartition
,
Group
from
openedx.core.djangoapps.site_configuration.tests.test_util
import
with_site_configuration_context
from
pytz
import
UTC
from
contentstore
import
utils
from
contentstore.tests.utils
import
CourseTestCase
from
openedx.core.djangoapps.site_configuration.tests.test_util
import
with_site_configuration_context
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
SharedModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.partitions.partitions
import
Group
,
UserPartition
class
LMSLinksTestCase
(
TestCase
):
...
...
cms/djangoapps/contentstore/tests/tests.py
View file @
e8a36957
"""
This test file will test registration, login, activation, and session activity timeouts
"""
import
datetime
import
time
import
mock
import
unittest
from
ddt
import
ddt
,
data
,
unpack
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
django.core.cache
import
cache
import
mock
from
ddt
import
data
,
ddt
,
unpack
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.core.cache
import
cache
from
django.core.urlresolvers
import
reverse
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
freezegun
import
freeze_time
from
pytz
import
UTC
from
contentstore.models
import
PushNotificationConfig
from
contentstore.tests.test_course_settings
import
CourseTestCase
from
contentstore.tests.utils
import
parse_json
,
user
,
registration
,
AjaxEnabledTestClient
from
contentstore.tests.utils
import
AjaxEnabledTestClient
,
parse_json
,
registration
,
user
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
import
datetime
from
pytz
import
UTC
from
freezegun
import
freeze_time
class
ContentStoreTestCase
(
ModuleStoreTestCase
):
...
...
cms/djangoapps/contentstore/tests/utils.py
View file @
e8a36957
...
...
@@ -3,23 +3,23 @@ Utilities for contentstore tests
'''
import
json
import
textwrap
from
mock
import
Mock
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.test.client
import
Client
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
,
AssetLocation
from
mock
import
Mock
from
opaque_keys.edx.locations
import
AssetLocation
,
SlashSeparatedCourseKey
from
contentstore.utils
import
reverse_url
from
student.models
import
Registration
from
xmodule.modulestore.split_mongo.split
import
SplitMongoModuleStore
from
xmodule.contentstore.django
import
contentstore
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.inheritance
import
own_metadata
from
xmodule.modulestore.split_mongo.split
import
SplitMongoModuleStore
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.xml_importer
import
import_course_from_xml
from
xmodule.modulestore.tests.utils
import
ProceduralCourseTestMixin
from
xmodule.modulestore.xml_importer
import
import_course_from_xml
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
...
...
cms/djangoapps/contentstore/utils.py
View file @
e8a36957
...
...
@@ -4,26 +4,24 @@ Common utility functions useful throughout the contentstore
import
logging
from
datetime
import
datetime
from
pytz
import
UTC
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.utils.translation
import
ugettext
as
_
from
opaque_keys.edx.keys
import
CourseKey
,
UsageKey
from
pytz
import
UTC
from
django_comment_common.models
import
assign_default_role
from
django_comment_common.utils
import
seed_permissions_roles
from
openedx.core.djangoapps.self_paced.models
import
SelfPacedConfiguration
from
openedx.core.djangoapps.site_configuration.models
import
SiteConfiguration
from
xmodule.partitions.partitions_service
import
get_all_partitions_for_course
from
student
import
auth
from
student.models
import
CourseEnrollment
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
opaque_keys.edx.keys
import
UsageKey
,
CourseKey
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
from
student.models
import
CourseEnrollment
from
student
import
auth
from
xmodule.partitions.partitions_service
import
get_all_partitions_for_course
log
=
logging
.
getLogger
(
__name__
)
...
...
cms/djangoapps/contentstore/views/access.py
View file @
e8a36957
""" Helper methods for determining user access permissions in Studio """
from
student.roles
import
CourseInstructorRole
from
student
import
auth
from
student.roles
import
CourseInstructorRole
def
get_user_role
(
user
,
course_id
):
...
...
cms/djangoapps/contentstore/views/assets.py
View file @
e8a36957
import
json
import
logging
from
functools
import
partial
import
math
import
json
from
pymongo
import
ASCENDING
,
DESCENDING
from
functools
import
partial
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
...
...
@@ -11,11 +10,12 @@ from django.http import HttpResponseBadRequest, HttpResponseNotFound
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.csrf
import
ensure_csrf_cookie
from
django.views.decorators.http
import
require_http_methods
,
require_POST
from
opaque_keys.edx.keys
import
AssetKey
,
CourseKey
from
pymongo
import
ASCENDING
,
DESCENDING
from
edxmako.shortcuts
import
render_to_response
from
contentstore.utils
import
reverse_course_url
from
contentstore.views.exception
import
AssetNotFoundException
from
opaque_keys.edx.keys
import
CourseKey
,
AssetKey
from
edxmako.shortcuts
import
render_to_response
from
openedx.core.djangoapps.contentserver.caching
import
del_cached_content
from
student.auth
import
has_course_author_access
from
util.date_utils
import
get_default_time_display
...
...
cms/djangoapps/contentstore/views/certificates.py
View file @
e8a36957
...
...
@@ -26,27 +26,26 @@ import logging
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.
views.decorators.csrf
import
ensure_csrf_cookie
from
django.
core.exceptions
import
PermissionDenied
from
django.http
import
HttpResponse
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.csrf
import
ensure_csrf_cookie
from
django.views.decorators.http
import
require_http_methods
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
AssetKey
,
CourseKey
from
contentstore.utils
import
reverse_course_url
from
contentstore.utils
import
get_lms_link_for_certificate_web_view
,
reverse_course_url
from
contentstore.views.assets
import
delete_asset
from
contentstore.views.exception
import
AssetNotFoundException
from
course_modes.models
import
CourseMode
from
edxmako.shortcuts
import
render_to_response
from
opaque_keys.edx.keys
import
CourseKey
,
AssetKey
from
opaque_keys
import
InvalidKeyError
from
eventtracking
import
tracker
from
student.auth
import
has_studio_write_access
from
student.roles
import
GlobalStaff
from
util.db
import
generate_int_id
,
MYSQL_MAX_INT
from
util.db
import
MYSQL_MAX_INT
,
generate_int_id
from
util.json_request
import
JsonResponse
from
xmodule.modulestore
import
EdxJSONEncoder
from
xmodule.modulestore.django
import
modulestore
from
contentstore.views.assets
import
delete_asset
from
contentstore.views.exception
import
AssetNotFoundException
from
django.core.exceptions
import
PermissionDenied
from
course_modes.models
import
CourseMode
from
contentstore.utils
import
get_lms_link_for_certificate_web_view
CERTIFICATE_SCHEMA_VERSION
=
1
CERTIFICATE_MINIMUM_ID
=
100
...
...
cms/djangoapps/contentstore/views/component.py
View file @
e8a36957
...
...
@@ -2,36 +2,30 @@ from __future__ import absolute_import
import
logging
from
django.
http
import
HttpResponseBadRequest
,
Http404
from
django.
conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.views.decorators.http
import
require_GET
from
django.core.exceptions
import
PermissionDenied
from
django.conf
import
settings
from
django.http
import
Http404
,
HttpResponseBadRequest
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.http
import
require_GET
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.asides
import
AsideUsageKeyV1
,
AsideUsageKeyV2
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
edxmako.shortcuts
import
render_to_response
from
xmodule.modulestore.django
import
modulestore
from
opaque_keys.edx.keys
import
UsageKey
from
xblock.core
import
XBlock
from
xblock.django.request
import
webob_to_django_response
,
django_to_webob_request
from
xblock.django.request
import
django_to_webob_request
,
webob_to_django_response
from
xblock.exceptions
import
NoSuchHandlerError
from
xblock.plugin
import
PluginMissingError
from
xblock.runtime
import
Mixologist
from
contentstore.utils
import
get_lms_link_for_item
,
reverse_course_url
,
get_xblock_aside_instance
from
contentstore.utils
import
get_lms_link_for_item
,
get_xblock_aside_instance
,
reverse_course_url
from
contentstore.views.helpers
import
get_parent_xblock
,
is_unit
,
xblock_type_display_name
from
contentstore.views.item
import
create_xblock_info
,
add_container_page_publishing_info
,
StudioEditModuleRuntime
from
opaque_keys.edx.keys
import
UsageKey
from
contentstore.views.item
import
StudioEditModuleRuntime
,
add_container_page_publishing_info
,
create_xblock_info
from
edxmako.shortcuts
import
render_to_response
from
student.auth
import
has_course_author_access
from
django.utils.translation
import
ugettext
as
_
from
xblock_django.api
import
disabled_xblocks
,
authorable_xblocks
from
xblock_django.api
import
authorable_xblocks
,
disabled_xblocks
from
xblock_django.models
import
XBlockStudioConfigurationFlag
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
__all__
=
[
'container_handler'
,
...
...
cms/djangoapps/contentstore/views/course.py
View file @
e8a36957
...
...
@@ -7,75 +7,63 @@ import logging
import
random
import
string
# pylint: disable=deprecated-module
import
django.utils
import
six
from
ccx_keys.locator
import
CCXLocator
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.core.exceptions
import
PermissionDenied
from
django.core.urlresolvers
import
reverse
from
django.http
import
Http
Response
,
HttpResponseBadRequest
,
HttpResponseNotFound
,
Http404
from
django.http
import
Http
404
,
HttpResponse
,
HttpResponseBadRequest
,
HttpResponseNotFound
from
django.shortcuts
import
redirect
import
django.utils
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.http
import
require_http_methods
,
require_GET
from
django.views.decorators.csrf
import
ensure_csrf_cookie
import
six
from
django.views.decorators.http
import
require_GET
,
require_http_methods
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locations
import
Location
from
.component
import
(
ADVANCED_COMPONENT_TYPES
,
)
from
.item
import
create_xblock_info
from
.library
import
LIBRARIES_ENABLED
,
get_library_creator_status
from
ccx_keys.locator
import
CCXLocator
from
contentstore.course_group_config
import
(
COHORT_SCHEME
,
ENROLLMENT_SCHEME
,
GroupConfiguration
,
GroupConfigurationsValidationError
,
RANDOM_SCHEME
,
GroupConfiguration
,
GroupConfigurationsValidationError
)
from
contentstore.course_info_model
import
get_course_updates
,
update_course_updates
,
delete_course_update
from
contentstore.course_info_model
import
delete_course_update
,
get_course_updates
,
update_course_updates
from
contentstore.courseware_index
import
CoursewareSearchIndexer
,
SearchIndexingError
from
contentstore.push_notification
import
push_notification_enabled
from
contentstore.tasks
import
rerun_course
from
contentstore.utils
import
(
add_instructor
,
initialize_permissions
,
get_lms_link_for_item
,
initialize_permissions
,
remove_all_instructors
,
reverse_course_url
,
reverse_library_url
,
reverse_usage_url
,
reverse_url
,
reverse_usage_url
)
from
contentstore.views.entrance_exam
import
(
create_entrance_exam
,
delete_entrance_exam
,
update_entrance_exam
,
)
from
contentstore.views.entrance_exam
import
create_entrance_exam
,
delete_entrance_exam
,
update_entrance_exam
from
course_action_state.managers
import
CourseActionStateItemNotFoundError
from
course_action_state.models
import
CourseRerunState
,
CourseRerunUIStateManager
from
course_creators.views
import
get_course_creator_status
,
add_user_with_status_unrequested
from
course_creators.views
import
add_user_with_status_unrequested
,
get_course_creator_status
from
edxmako.shortcuts
import
render_to_response
from
models.settings.course_grading
import
CourseGradingModel
from
models.settings.course_metadata
import
CourseMetadata
from
models.settings.encoder
import
CourseSettingsEncoder
from
openedx.core.djangoapps.content.course_structures.api.v0
import
api
,
errors
from
openedx.core.djangoapps.credit.api
import
is_credit_course
,
get_credit_requirements
from
openedx.core.djangoapps.credit.api
import
get_credit_requirements
,
is_credit_course
from
openedx.core.djangoapps.credit.tasks
import
update_credit_course_requirements
from
openedx.core.djangoapps.models.course_details
import
CourseDetails
from
openedx.core.djangoapps.self_paced.models
import
SelfPacedConfiguration
from
openedx.core.djangoapps.site_configuration
import
helpers
as
configuration_helpers
from
openedx.core.djangolib.js_utils
import
dump_js_escaped_json
from
openedx.core.lib.course_tabs
import
CourseTabPluginManager
from
openedx.core.lib.courses
import
course_image_url
from
openedx.core.djangolib.js_utils
import
dump_js_escaped_json
from
student
import
auth
from
student.auth
import
has_course_author_access
,
has_studio_write_access
,
has_studio_read_access
from
student.roles
import
(
CourseInstructorRole
,
CourseStaffRole
,
CourseCreatorRole
,
GlobalStaff
,
UserBasedRole
)
from
student.auth
import
has_course_author_access
,
has_studio_read_access
,
has_studio_write_access
from
student.roles
import
CourseCreatorRole
,
CourseInstructorRole
,
CourseStaffRole
,
GlobalStaff
,
UserBasedRole
from
util.course
import
get_link_for_about_page
from
util.date_utils
import
get_default_time_display
from
util.json_request
import
JsonResponse
,
JsonResponseBadRequest
,
expect_json
...
...
@@ -83,24 +71,23 @@ from util.milestones_helpers import (
is_entrance_exams_enabled
,
is_prerequisite_courses_enabled
,
is_valid_course_key
,
set_prerequisite_courses
,
)
from
util.organizations_helpers
import
(
add_organization_course
,
get_organization_by_short_name
,
organizations_enabled
,
set_prerequisite_courses
)
from
util.organizations_helpers
import
add_organization_course
,
get_organization_by_short_name
,
organizations_enabled
from
util.string_utils
import
_has_non_ascii_characters
from
xblock_django.api
import
deprecated_xblocks
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.course_module
import
CourseFields
from
xmodule.course_module
import
DEFAULT_START_DATE
from
xmodule.course_module
import
DEFAULT_START_DATE
,
CourseFields
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.modulestore
import
EdxJSONEncoder
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
,
DuplicateCourse
Error
from
xmodule.modulestore.exceptions
import
DuplicateCourseError
,
ItemNotFound
Error
from
xmodule.tabs
import
CourseTab
,
CourseTabList
,
InvalidTabsException
from
.component
import
ADVANCED_COMPONENT_TYPES
from
.item
import
create_xblock_info
from
.library
import
LIBRARIES_ENABLED
,
get_library_creator_status
log
=
logging
.
getLogger
(
__name__
)
__all__
=
[
'course_info_handler'
,
'course_handler'
,
'course_listing'
,
...
...
cms/djangoapps/contentstore/views/entrance_exam.py
View file @
e8a36957
...
...
@@ -2,25 +2,25 @@
Entrance Exams view module -- handles all requests related to entrance exam management via Studio
Intended to be utilized as an AJAX callback handler, versus a proper view/screen
"""
from
functools
import
wraps
import
logging
from
functools
import
wraps
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.views.decorators.csrf
import
ensure_csrf_cookie
from
django.http
import
HttpResponse
,
HttpResponseBadRequest
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.csrf
import
ensure_csrf_cookie
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
,
UsageKey
from
openedx.core.djangolib.js_utils
import
dump_js_escaped_json
from
contentstore.views.helpers
import
create_xblock
,
remove_entrance_exam_graders
from
contentstore.views.item
import
delete_item
from
models.settings.course_metadata
import
CourseMetadata
from
opaque_keys.edx.keys
import
CourseKey
,
UsageKey
from
opaque_keys
import
InvalidKeyError
from
openedx.core.djangolib.js_utils
import
dump_js_escaped_json
from
student.auth
import
has_course_author_access
from
util
import
milestones_helpers
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
django.conf
import
settings
from
django.utils.translation
import
ugettext
as
_
__all__
=
[
'entrance_exam'
,
]
...
...
cms/djangoapps/contentstore/views/error.py
View file @
e8a36957
# pylint: disable=missing-docstring,unused-argument
from
django.http
import
(
HttpResponse
,
HttpResponseServerError
,
HttpResponseNotFound
)
from
edxmako.shortcuts
import
render_to_string
,
render_to_response
import
functools
from
django.http
import
HttpResponse
,
HttpResponseNotFound
,
HttpResponseServerError
from
edxmako.shortcuts
import
render_to_response
,
render_to_string
from
openedx.core.djangolib.js_utils
import
dump_js_escaped_json
__all__
=
[
'not_found'
,
'server_error'
,
'render_404'
,
'render_500'
]
...
...
cms/djangoapps/contentstore/views/export_git.py
View file @
e8a36957
...
...
@@ -7,14 +7,14 @@ import logging
from
django.contrib.auth.decorators
import
login_required
from
django.core.exceptions
import
PermissionDenied
from
django.views.decorators.csrf
import
ensure_csrf_cookie
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.csrf
import
ensure_csrf_cookie
from
opaque_keys.edx.keys
import
CourseKey
from
student.auth
import
has_course_author_access
import
contentstore.git_export_utils
as
git_export_utils
from
edxmako.shortcuts
import
render_to_response
from
student.auth
import
has_course_author_access
from
xmodule.modulestore.django
import
modulestore
from
opaque_keys.edx.keys
import
CourseKey
log
=
logging
.
getLogger
(
__name__
)
...
...
cms/djangoapps/contentstore/views/helpers.py
View file @
e8a36957
...
...
@@ -4,24 +4,23 @@ Helper methods for Studio views.
from
__future__
import
absolute_import
from
uuid
import
uuid4
import
urllib
from
uuid
import
uuid4
from
django.conf
import
settings
from
django.http
import
HttpResponse
from
django.utils.translation
import
ugettext
as
_
from
edxmako.shortcuts
import
render_to_string
from
opaque_keys.edx.keys
import
UsageKey
from
xblock.core
import
XBlock
import
dogstats_wrapper
as
dog_stats_api
from
xmodule.modulestore.django
import
modulestore
from
xmodule.x_module
import
DEPRECATION_VSCOMPAT_EVENT
from
xmodule.tabs
import
StaticTab
import
dogstats_wrapper
as
dog_stats_api
from
contentstore.utils
import
reverse_course_url
,
reverse_library_url
,
reverse_usage_url
from
edxmako.shortcuts
import
render_to_string
from
models.settings.course_grading
import
CourseGradingModel
from
util.milestones_helpers
import
is_entrance_exams_enabled
from
xmodule.modulestore.django
import
modulestore
from
xmodule.tabs
import
StaticTab
from
xmodule.x_module
import
DEPRECATION_VSCOMPAT_EVENT
__all__
=
[
'event'
]
...
...
cms/djangoapps/contentstore/views/import_export.py
View file @
e8a36957
...
...
@@ -8,9 +8,6 @@ import logging
import
os
import
re
import
shutil
from
path
import
Path
as
path
from
six
import
text_type
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
...
...
@@ -18,28 +15,26 @@ from django.core.exceptions import PermissionDenied
from
django.core.files
import
File
from
django.core.servers.basehttp
import
FileWrapper
from
django.db
import
transaction
from
django.http
import
Http
Response
,
HttpResponseNotFound
,
Http404
from
django.http
import
Http
404
,
HttpResponse
,
HttpResponseNotFound
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.csrf
import
ensure_csrf_cookie
from
django.views.decorators.http
import
require_http_methods
,
require_GET
from
edxmako.shortcuts
import
render_to_response
from
xmodule.exceptions
import
SerializationError
from
xmodule.modulestore.django
import
modulestore
from
django.views.decorators.http
import
require_GET
,
require_http_methods
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locator
import
LibraryLocator
from
path
import
Path
as
path
from
six
import
text_type
from
user_tasks.conf
import
settings
as
user_tasks_settings
from
user_tasks.models
import
UserTaskArtifact
,
UserTaskStatus
from
student.auth
import
has_course_author_access
from
util.json_request
import
JsonResponse
from
util.views
import
ensure_valid_course_key
from
contentstore.storage
import
course_import_export_storage
from
contentstore.tasks
import
CourseExportTask
,
CourseImportTask
,
create_export_tarball
,
export_olx
,
import_olx
from
contentstore.utils
import
reverse_course_url
,
reverse_library_url
from
edxmako.shortcuts
import
render_to_response
from
student.auth
import
has_course_author_access
from
util.json_request
import
JsonResponse
from
util.views
import
ensure_valid_course_key
from
xmodule.exceptions
import
SerializationError
from
xmodule.modulestore.django
import
modulestore
__all__
=
[
'import_handler'
,
'import_status_handler'
,
...
...
cms/djangoapps/contentstore/views/item.py
View file @
e8a36957
...
...
@@ -8,55 +8,62 @@ from datetime import datetime
from
functools
import
partial
from
uuid
import
uuid4
import
dogstats_wrapper
as
dog_stats_api
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.contrib.auth.models
import
User
from
django.core.exceptions
import
PermissionDenied
from
django.http
import
Http
ResponseBadRequest
,
HttpResponse
,
Http404
from
django.http
import
Http
404
,
HttpResponse
,
HttpResponseBadRequest
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.http
import
require_http_methods
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locator
import
LibraryUsageLocator
from
pytz
import
UTC
from
xblock.core
import
XBlock
from
xblock.fields
import
Scope
from
xblock.fragment
import
Fragment
from
xblock_config.models
import
CourseEditLTIFieldsEnabledFlag
from
xblock_django.user_service
import
DjangoXBlockUserService
import
dogstats_wrapper
as
dog_stats_api
from
cms.lib.xblock.authoring_mixin
import
VISIBILITY_VIEW
from
contentstore.utils
import
(
find_release_date_source
,
find_staff_lock_source
,
is_currently_visible_to_students
,
ancestor_has_staff_lock
,
has_children_visible_to_specific_partition_groups
,
get_user_partition_info
,
get_split_group_display_name
,
ancestor_has_staff_lock
,
find_release_date_source
,
find_staff_lock_source
,
get_split_group_display_name
,
get_user_partition_info
,
has_children_visible_to_specific_partition_groups
,
is_currently_visible_to_students
,
is_self_paced
)
from
contentstore.views.helpers
import
(
create_xblock
,
get_parent_xblock
,
is_unit
,
usage_key_with_run
,
xblock_primary_child_category
,
xblock_studio_url
,
xblock_type_display_name
)
from
contentstore.views.helpers
import
is_unit
,
xblock_studio_url
,
xblock_primary_child_category
,
\
xblock_type_display_name
,
get_parent_xblock
,
create_xblock
,
usage_key_with_run
from
contentstore.views.preview
import
get_preview_fragment
from
contentstore.utils
import
is_self_paced
from
openedx.core.lib.gating
import
api
as
gating_api
from
edxmako.shortcuts
import
render_to_string
from
models.settings.course_grading
import
CourseGradingModel
from
openedx.core.lib.xblock_utils
import
wrap_xblock
,
request_token
from
openedx.core.lib.gating
import
api
as
gating_api
from
openedx.core.lib.xblock_utils
import
request_token
,
wrap_xblock
from
static_replace
import
replace_static_urls
from
student.auth
import
has_studio_
write_access
,
has_studio_read
_access
from
student.auth
import
has_studio_
read_access
,
has_studio_write
_access
from
util.date_utils
import
get_default_time_display
from
util.json_request
import
expect_json
,
JsonResponse
from
util.json_request
import
JsonResponse
,
expect_json
from
util.milestones_helpers
import
is_entrance_exams_enabled
from
xblock_config.models
import
CourseEditLTIFieldsEnabledFlag
from
xblock_django.user_service
import
DjangoXBlockUserService
from
xmodule.course_module
import
DEFAULT_START_DATE
from
xmodule.modulestore
import
ModuleStoreEnum
,
EdxJSONEncoder
from
xmodule.modulestore
import
EdxJSONEncoder
,
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.draft_and_published
import
DIRECT_ONLY_CATEGORIES
from
xmodule.modulestore.exceptions
import
I
temNotFoundError
,
InvalidLocation
Error
from
xmodule.modulestore.exceptions
import
I
nvalidLocationError
,
ItemNotFound
Error
from
xmodule.modulestore.inheritance
import
own_metadata
from
xmodule.services
import
ConfigurationService
,
SettingsService
from
xmodule.tabs
import
CourseTabList
from
xmodule.x_module
import
PREVIEW_VIEWS
,
STUDIO_VIEW
,
STUDENT_VIEW
,
DEPRECATION_VSCOMPAT_EVENT
from
xmodule.x_module
import
DEPRECATION_VSCOMPAT_EVENT
,
PREVIEW_VIEWS
,
STUDENT_VIEW
,
STUDIO_VIEW
__all__
=
[
'orphan_handler'
,
'xblock_handler'
,
'xblock_view_handler'
,
'xblock_outline_handler'
,
'xblock_container_handler'
...
...
cms/djangoapps/contentstore/views/library.py
View file @
e8a36957
...
...
@@ -7,31 +7,36 @@ from __future__ import absolute_import
import
logging
from
contentstore.views.item
import
create_xblock_info
from
contentstore.utils
import
reverse_library_url
,
add_instructor
from
django.http
import
HttpResponseNotAllowed
,
Http404
,
HttpResponseForbidden
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.core.exceptions
import
PermissionDenied
from
django.
conf
import
settings
from
django.
http
import
Http404
,
HttpResponseForbidden
,
HttpResponseNotAllowed
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.http
import
require_http_methods
from
django.views.decorators.csrf
import
ensure_csrf_cookie
from
edxmako.shortcuts
import
render_to_response
from
django.views.decorators.http
import
require_http_methods
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locator
import
LibraryLocator
,
LibraryUsageLocator
from
xmodule.modulestore.exceptions
import
DuplicateCourseError
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
.user
import
user_with_role
from
contentstore.utils
import
add_instructor
,
reverse_library_url
from
contentstore.views.item
import
create_xblock_info
from
course_creators.views
import
get_course_creator_status
from
.component
import
get_component_templates
,
CONTAINER_TEMPLATES
from
edxmako.shortcuts
import
render_to_response
from
student.auth
import
(
STUDIO_VIEW_USERS
,
STUDIO_EDIT_ROLES
,
get_user_permissions
,
has_studio_read_access
,
has_studio_write_access
STUDIO_EDIT_ROLES
,
STUDIO_VIEW_USERS
,
get_user_permissions
,
has_studio_read_access
,
has_studio_write_access
)
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
,
LibraryUserRole
from
util.json_request
import
expect_json
,
JsonResponse
,
JsonResponseBadRequest
from
util.json_request
import
JsonResponse
,
JsonResponseBadRequest
,
expect_json
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
DuplicateCourseError
from
.component
import
CONTAINER_TEMPLATES
,
get_component_templates
from
.user
import
user_with_role
__all__
=
[
'library_handler'
,
'manage_library_users'
]
...
...
cms/djangoapps/contentstore/views/organization.py
View file @
e8a36957
"""Organizations views for use with Studio."""
from
django.contrib.auth.decorators
import
login_required
from
django.http
import
HttpResponse
from
django.utils.decorators
import
method_decorator
from
django.views.generic
import
View
from
django.http
import
HttpResponse
from
openedx.core.djangolib.js_utils
import
dump_js_escaped_json
from
util.organizations_helpers
import
get_organizations
...
...
cms/djangoapps/contentstore/views/preview.py
View file @
e8a36957
...
...
@@ -4,44 +4,45 @@ import logging
from
functools
import
partial
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.core.urlresolvers
import
reverse
from
django.http
import
Http404
,
HttpResponseBadRequest
from
django.contrib.auth.decorators
import
login_required
from
django.utils.translation
import
ugettext
as
_
from
edxmako.shortcuts
import
render_to_string
from
opaque_keys.edx.keys
import
UsageKey
from
xblock.django.request
import
django_to_webob_request
,
webob_to_django_response
from
xblock.exceptions
import
NoSuchHandlerError
from
xblock.fragment
import
Fragment
from
xblock.runtime
import
KvsFieldData
import
static_replace
from
cms.lib.xblock.field_data
import
CmsFieldData
from
contentstore.utils
import
get_visibility_partition_info
from
contentstore.views.access
import
get_user_role
from
edxmako.shortcuts
import
render_to_string
from
lms.djangoapps.lms_xblock.field_data
import
LmsFieldData
from
openedx.core.lib.license
import
wrap_with_license
from
openedx.core.lib.xblock_utils
import
(
replace_static_urls
,
wrap_xblock
,
wrap_fragment
,
wrap_xblock_aside
,
request_token
,
xblock_local_resource_url
,
replace_static_urls
,
request_token
,
wrap_fragment
,
wrap_xblock
,
wrap_xblock_aside
,
xblock_local_resource_url
)
from
xmodule.x_module
import
PREVIEW_VIEWS
,
STUDENT_VIEW
,
AUTHOR_VIEW
from
util.sandboxing
import
can_execute_unsafe_code
,
get_python_lib_zip
from
xblock_config.models
import
StudioConfig
from
xblock_django.user_service
import
DjangoXBlockUserService
from
xmodule.contentstore.django
import
contentstore
from
xmodule.error_module
import
ErrorDescriptor
from
xmodule.exceptions
import
NotFoundError
,
ProcessingError
from
xmodule.modulestore.django
import
ModuleI18nService
,
modulestore
from
xmodule.partitions.partitions_service
import
PartitionService
from
xmodule.studio_editable
import
has_author_view
from
xmodule.services
import
SettingsService
from
xmodule.modulestore.django
import
modulestore
,
ModuleI18nService
from
openedx.core.lib.license
import
wrap_with_license
from
opaque_keys.edx.keys
import
UsageKey
from
xmodule.x_module
import
ModuleSystem
from
xblock.runtime
import
KvsFieldData
from
xblock.django.request
import
webob_to_django_response
,
django_to_webob_request
from
xblock.exceptions
import
NoSuchHandlerError
from
xblock.fragment
import
Fragment
from
xblock_django.user_service
import
DjangoXBlockUserService
from
lms.djangoapps.lms_xblock.field_data
import
LmsFieldData
from
cms.lib.xblock.field_data
import
CmsFieldData
from
util.sandboxing
import
can_execute_unsafe_code
,
get_python_lib_zip
from
xmodule.studio_editable
import
has_author_view
from
xmodule.x_module
import
AUTHOR_VIEW
,
PREVIEW_VIEWS
,
STUDENT_VIEW
,
ModuleSystem
import
static_replace
from
.session_kv_store
import
SessionKeyValueStore
from
.helpers
import
render_from_lms
from
contentstore.utils
import
get_visibility_partition_info
from
contentstore.views.access
import
get_user_role
from
xblock_config.models
import
StudioConfig
from
.session_kv_store
import
SessionKeyValueStore
__all__
=
[
'preview_handler'
]
...
...
cms/djangoapps/contentstore/views/public.py
View file @
e8a36957
"""
Public views
"""
from
django.views.decorators.csrf
import
ensure_csrf_cookie
from
django.views.decorators.clickjacking
import
xframe_options_deny
from
django.conf
import
settings
from
django.core.context_processors
import
csrf
from
django.core.urlresolvers
import
reverse
from
django.shortcuts
import
redirect
from
django.conf
import
settings
from
django.views.decorators.clickjacking
import
xframe_options_deny
from
django.views.decorators.csrf
import
ensure_csrf_cookie
from
edxmako.shortcuts
import
render_to_response
from
openedx.core.djangoapps.external_auth.views
import
(
ssl_login_shortcut
,
ssl_get_cert_from_request
,
redirect_with_get
,
)
from
openedx.core.djangoapps.external_auth.views
import
redirect_with_get
,
ssl_get_cert_from_request
,
ssl_login_shortcut
from
openedx.core.djangoapps.site_configuration
import
helpers
as
configuration_helpers
__all__
=
[
'signup'
,
'login_page'
,
'howitworks'
]
...
...
cms/djangoapps/contentstore/views/tabs.py
View file @
e8a36957
"""
Views related to course tabs
"""
from
student.auth
import
has_course_author_access
from
util.json_request
import
expect_json
,
JsonResponse
from
django.http
import
HttpResponseNotFound
from
django.contrib.auth.decorators
import
login_required
from
django.core.exceptions
import
PermissionDenied
from
django.http
import
HttpResponseNotFound
from
django.views.decorators.csrf
import
ensure_csrf_cookie
from
django.views.decorators.http
import
require_http_methods
from
opaque_keys.edx.keys
import
CourseKey
,
UsageKey
from
edxmako.shortcuts
import
render_to_response
from
xmodule.modulestore.django
import
modulestore
from
student.auth
import
has_course_author_access
from
util.json_request
import
JsonResponse
,
expect_json
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.
tabs
import
CourseTabList
,
CourseTab
,
InvalidTabsException
,
StaticTab
from
opaque_keys.edx.keys
import
CourseKey
,
UsageKey
from
xmodule.
modulestore.django
import
modulestore
from
xmodule.tabs
import
CourseTab
,
CourseTabList
,
InvalidTabsException
,
StaticTab
from
..utils
import
get_lms_link_for_item
...
...
cms/djangoapps/contentstore/views/tests/test_access.py
View file @
e8a36957
"""
Tests access.py
"""
from
django.test
import
TestCase
from
django.contrib.auth.models
import
User
from
django.test
import
TestCase
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
contentstore.views.access
import
get_user_role
from
student.auth
import
add_users
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
from
student.tests.factories
import
AdminFactory
from
student.auth
import
add_users
from
contentstore.views.access
import
get_user_role
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
class
RolesTest
(
TestCase
):
...
...
cms/djangoapps/contentstore/views/tests/test_assets.py
View file @
e8a36957
"""
Unit tests for the asset upload endpoint.
"""
import
json
from
datetime
import
datetime
from
io
import
BytesIO
from
pytz
import
UTC
from
PIL
import
Image
import
json
from
mock
import
patch
import
mock
from
ddt
import
data
,
ddt
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
mock
import
patch
from
opaque_keys.edx.locations
import
AssetLocation
,
SlashSeparatedCourseKey
from
PIL
import
Image
from
pytz
import
UTC
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.views
import
assets
from
contentstore.utils
import
reverse_course_url
from
contentstore.views
import
assets
from
static_replace
import
replace_static_urls
from
xmodule.assetstore
import
AssetMetadata
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.contentstore.django
import
contentstore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.xml_importer
import
import_course_from_xml
from
django.test.utils
import
override_settings
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
,
AssetLocation
from
static_replace
import
replace_static_urls
import
mock
from
ddt
import
ddt
from
ddt
import
data
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
...
...
cms/djangoapps/contentstore/views/tests/test_certificates.py
View file @
e8a36957
...
...
@@ -5,28 +5,24 @@ Certificates Tests.
"""
import
itertools
import
json
import
mock
import
ddt
import
ddt
import
mock
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
opaque_keys.edx.keys
import
AssetKey
from
contentstore.utils
import
reverse_course_url
from
contentstore.views.certificates
import
CERTIFICATE_SCHEMA_VERSION
from
contentstore.tests.utils
import
CourseTestCase
from
xmodule.contentstore.django
import
contentstore
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.exceptions
import
NotFoundError
from
contentstore.utils
import
get_lms_link_for_certificate_web_view
,
reverse_course_url
from
contentstore.views.certificates
import
CERTIFICATE_SCHEMA_VERSION
,
CertificateManager
from
course_modes.tests.factories
import
CourseModeFactory
from
student.models
import
CourseEnrollment
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
from
student.tests.factories
import
UserFactory
from
course_modes.tests.factories
import
CourseModeFactory
from
contentstore.views.certificates
import
CertificateManager
from
django.test.utils
import
override_settings
from
contentstore.utils
import
get_lms_link_for_certificate_web_view
from
util.testing
import
EventTestMixin
,
UrlResetMixin
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.contentstore.django
import
contentstore
from
xmodule.exceptions
import
NotFoundError
FEATURES_WITH_CERTS_ENABLED
=
settings
.
FEATURES
.
copy
()
FEATURES_WITH_CERTS_ENABLED
[
'CERTIFICATES_HTML_VIEW'
]
=
True
...
...
cms/djangoapps/contentstore/views/tests/test_container_page.py
View file @
e8a36957
"""
Unit tests for the container page.
"""
import
re
import
datetime
from
pytz
import
UTC
from
mock
import
patch
,
Mock
import
re
from
django.http
import
Http404
from
django.test.client
import
RequestFactory
from
django.utils
import
http
from
mock
import
Mock
,
patch
from
pytz
import
UTC
import
contentstore.views.component
as
views
from
contentstore.views.tests.utils
import
StudioPageTestCase
from
contentstore.tests.test_libraries
import
LibraryTestCase
from
contentstore.views.tests.utils
import
StudioPageTestCase
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
...
...
cms/djangoapps/contentstore/views/tests/test_course_index.py
View file @
e8a36957
"""
Unit tests for getting the list of courses and the course outline.
"""
import
d
dt
import
d
atetime
import
json
import
ddt
import
lxml
import
datetime
import
mock
import
pytz
from
django.conf
import
settings
from
django.core.exceptions
import
PermissionDenied
from
django.utils.translation
import
ugettext
as
_
from
opaque_keys.edx.locator
import
CourseLocator
from
search.api
import
perform_search
from
contentstore.courseware_index
import
CoursewareSearchIndexer
,
SearchIndexingError
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
,
reverse_library_url
,
add_instructor
,
reverse_usage_url
from
contentstore.utils
import
add_instructor
,
reverse_course_url
,
reverse_library_url
,
reverse_usage_url
from
contentstore.views.course
import
(
course_outline_initial_state
,
reindex_course_and_check_access
,
_deprecated_blocks_info
_deprecated_blocks_info
,
course_outline_initial_state
,
reindex_course_and_check_access
)
from
contentstore.views.item
import
create_xblock_info
,
VisibilityState
from
contentstore.views.item
import
VisibilityState
,
create_xblock_info
from
course_action_state.managers
import
CourseRerunUIStateManager
from
course_action_state.models
import
CourseRerunState
from
opaque_keys.edx.locator
import
CourseLocator
from
search.api
import
perform_search
from
student.auth
import
has_course_author_access
from
student.roles
import
LibraryUserRole
from
student.tests.factories
import
UserFactory
from
util.date_utils
import
get_default_time_display
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
,
LibraryFactory
...
...
cms/djangoapps/contentstore/views/tests/test_course_updates.py
View file @
e8a36957
...
...
@@ -2,13 +2,14 @@
unit tests for course_info views and models.
"""
import
json
from
mock
import
patch
from
django.test.utils
import
override_settings
from
mock
import
patch
from
opaque_keys.edx.keys
import
UsageKey
from
contentstore.models
import
PushNotificationConfig
from
contentstore.tests.test_course_settings
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
,
reverse_usage_url
from
opaque_keys.edx.keys
import
UsageKey
from
xmodule.modulestore.django
import
modulestore
...
...
cms/djangoapps/contentstore/views/tests/test_credit_eligibility.py
View file @
e8a36957
...
...
@@ -6,11 +6,10 @@ import mock
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
openedx.core.djangoapps.credit.api
import
get_credit_requirements
from
openedx.core.djangoapps.credit.models
import
CreditCourse
from
openedx.core.djangoapps.credit.signals
import
on_course_publish
from
xmodule.modulestore.tests.factories
import
CourseFactory
class
CreditEligibilityTest
(
CourseTestCase
):
...
...
cms/djangoapps/contentstore/views/tests/test_entrance_exam.py
View file @
e8a36957
...
...
@@ -2,25 +2,29 @@
Test module for Entrance Exams AJAX callback handler workflows
"""
import
json
from
mock
import
patch
from
django.conf
import
settings
from
django.contrib.auth.models
import
User
from
django.test.client
import
RequestFactory
from
milestones.tests.utils
import
MilestonesTestCaseMixin
from
mock
import
patch
from
opaque_keys.edx.keys
import
UsageKey
from
contentstore.tests.utils
import
AjaxEnabledTestClient
,
CourseTestCase
from
contentstore.utils
import
reverse_url
from
contentstore.views.entrance_exam
import
create_entrance_exam
,
update_entrance_exam
,
delete_entrance_exam
,
\
add_entrance_exam_milestone
,
remove_entrance_exam_milestone_reference
from
contentstore.views.helpers
import
GRADER_TYPES
from
contentstore.views.entrance_exam
import
(
add_entrance_exam_milestone
,
create_entrance_exam
,
delete_entrance_exam
,
remove_entrance_exam_milestone_reference
,
update_entrance_exam
)
from
contentstore.views.helpers
import
GRADER_TYPES
,
create_xblock
from
models.settings.course_grading
import
CourseGradingModel
from
models.settings.course_metadata
import
CourseMetadata
from
opaque_keys.edx.keys
import
UsageKey
from
student.tests.factories
import
UserFactory
from
util
import
milestones_helpers
from
xmodule.modulestore.django
import
modulestore
from
contentstore.views.helpers
import
create_xblock
from
milestones.tests.utils
import
MilestonesTestCaseMixin
@patch.dict
(
settings
.
FEATURES
,
{
'ENTRANCE_EXAMS'
:
True
})
...
...
cms/djangoapps/contentstore/views/tests/test_gating.py
View file @
e8a36957
...
...
@@ -4,12 +4,13 @@ Unit tests for the gating feature in Studio
import
json
from
mock
import
patch
from
xmodule.modulestore.tests.django_utils
import
TEST_DATA_SPLIT_MODULESTORE
from
xmodule.modulestore.tests.factories
import
ItemFactory
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_usage_url
from
contentstore.views.item
import
VisibilityState
from
openedx.core.lib.gating.api
import
GATING_NAMESPACE_QUALIFIER
from
xmodule.modulestore.tests.django_utils
import
TEST_DATA_SPLIT_MODULESTORE
from
xmodule.modulestore.tests.factories
import
ItemFactory
class
TestSubsectionGating
(
CourseTestCase
):
...
...
cms/djangoapps/contentstore/views/tests/test_helpers.py
View file @
e8a36957
...
...
@@ -2,10 +2,11 @@
Unit tests for helpers.py.
"""
from
django.utils
import
http
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.views.helpers
import
xblock_studio_url
,
xblock_type_display_name
from
xmodule.modulestore.tests.factories
import
ItemFactory
,
LibraryFactory
from
django.utils
import
http
class
HelpersTestCase
(
CourseTestCase
):
...
...
cms/djangoapps/contentstore/views/tests/test_import_export.py
View file @
e8a36957
...
...
@@ -2,41 +2,37 @@
Unit tests for course import and export
"""
import
copy
import
ddt
import
json
import
logging
import
lxml
import
os
import
shutil
import
tarfile
import
tempfile
from
path
import
Path
as
path
from
uuid
import
uuid4
from
django.test.utils
import
override_settings
import
ddt
import
lxml
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
milestones.tests.utils
import
MilestonesTestCaseMixin
from
opaque_keys.edx.locator
import
LibraryLocator
from
path
import
Path
as
path
from
contentstore.tests.test_libraries
import
LibraryTestCase
from
xmodule.contentstore.django
import
contentstore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.xml_exporter
import
export_library_to_xml
,
export_course_to_xml
from
xmodule.modulestore.xml_importer
import
import_library_from_xml
,
import_course_from_xml
from
xmodule.modulestore
import
LIBRARY_ROOT
,
ModuleStoreEnum
from
contentstore.utils
import
reverse_course_url
from
contentstore.tests.utils
import
CourseTestCase
from
xmodule.modulestore.tests.factories
import
ItemFactory
,
LibraryFactory
,
CourseFactory
from
xmodule.modulestore.tests.utils
import
(
MongoContentstoreBuilder
,
SPLIT_MODULESTORE_SETUP
,
TEST_DATA_DIR
)
from
opaque_keys.edx.locator
import
LibraryLocator
from
contentstore.utils
import
reverse_course_url
from
models.settings.course_metadata
import
CourseMetadata
from
openedx.core.lib.extract_tar
import
safetar_extractall
from
student
import
auth
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
from
models.settings.course_metadata
import
CourseMetadata
from
util
import
milestones_helpers
from
milestones.tests.utils
import
MilestonesTestCaseMixin
from
xmodule.contentstore.django
import
contentstore
from
xmodule.modulestore
import
LIBRARY_ROOT
,
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
,
LibraryFactory
from
xmodule.modulestore.tests.utils
import
SPLIT_MODULESTORE_SETUP
,
TEST_DATA_DIR
,
MongoContentstoreBuilder
from
xmodule.modulestore.xml_exporter
import
export_course_to_xml
,
export_library_to_xml
from
xmodule.modulestore.xml_importer
import
import_course_from_xml
,
import_library_from_xml
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
...
...
cms/djangoapps/contentstore/views/tests/test_library.py
View file @
e8a36957
...
...
@@ -3,19 +3,19 @@ Unit tests for contentstore.views.library
More important high-level tests are in contentstore/tests/test_libraries.py
"""
import
ddt
import
mock
from
django.conf
import
settings
from
contentstore.tests.utils
import
AjaxEnabledTestClient
,
parse_json
from
mock
import
patch
from
opaque_keys.edx.locator
import
CourseKey
,
LibraryLocator
from
contentstore.tests.utils
import
AjaxEnabledTestClient
,
CourseTestCase
,
parse_json
from
contentstore.utils
import
reverse_course_url
,
reverse_library_url
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.views.component
import
get_component_templates
from
contentstore.views.library
import
get_library_creator_status
from
course_creators.views
import
add_user_with_status_granted
as
grant_course_creator_status
from
xmodule.modulestore.tests.factories
import
LibraryFactory
from
mock
import
patch
from
opaque_keys.edx.locator
import
CourseKey
,
LibraryLocator
import
ddt
import
mock
from
student.roles
import
LibraryUserRole
from
xmodule.modulestore.tests.factories
import
LibraryFactory
LIBRARY_REST_URL
=
'/library/'
# URL for GET/POST requests involving libraries
...
...
cms/djangoapps/contentstore/views/tests/test_organizations.py
View file @
e8a36957
"""Tests covering the Organizations listing on the Studio home."""
import
json
from
mock
import
patch
from
django.core.urlresolvers
import
reverse
from
django.test
import
TestCase
from
util.organizations_helpers
import
add_organization
from
mock
import
patch
from
student.tests.factories
import
UserFactory
from
util.organizations_helpers
import
add_organization
@patch.dict
(
'django.conf.settings.FEATURES'
,
{
'ORGANIZATIONS_APP'
:
True
})
...
...
cms/djangoapps/contentstore/views/tests/test_preview.py
View file @
e8a36957
...
...
@@ -2,24 +2,21 @@
Tests for contentstore.views.preview.py
"""
import
re
import
ddt
import
mock
from
xblock.core
import
XBlock
from
django.test.client
import
Client
,
RequestFactory
from
xblock.core
import
XBlock
,
XBlockAside
from
xblock.core
import
XBlockAside
from
student.tests.factories
import
UserFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
contentstore.views.preview
import
get_preview_fragment
,
_preview_module_system
from
contentstore.utils
import
reverse_usage_url
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.tests.test_asides
import
AsideTestType
from
contentstore.views.preview
import
_preview_module_system
,
get_preview_fragment
from
student.tests.factories
import
UserFactory
from
xblock_config.models
import
StudioConfig
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.test_asides
import
AsideTestType
@ddt.ddt
...
...
cms/djangoapps/contentstore/views/tests/test_tabs.py
View file @
e8a36957
...
...
@@ -2,14 +2,14 @@
import
json
from
contentstore.views
import
tabs
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
from
xmodule.x_module
import
STUDENT_VIEW
from
xmodule.modulestore.
tests.factories
import
CourseFactory
,
ItemFactory
from
contentstore.views
import
tabs
from
xmodule.modulestore.
django
import
modulestore
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.tabs
import
CourseTabList
from
xmodule.
modulestore.django
import
modulestore
from
xmodule.
x_module
import
STUDENT_VIEW
class
TabsPageTests
(
CourseTestCase
):
...
...
cms/djangoapps/contentstore/views/tests/test_textbooks.py
View file @
e8a36957
import
json
from
unittest
import
TestCase
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
from
contentstore.views.course
import
(
validate_textbooks_json
,
validate_textbook_json
,
TextbookValidationError
)
from
contentstore.views.course
import
TextbookValidationError
,
validate_textbook_json
,
validate_textbooks_json
class
TextbookIndexTestCase
(
CourseTestCase
):
...
...
cms/djangoapps/contentstore/views/tests/test_transcripts.py
View file @
e8a36957
...
...
@@ -6,19 +6,19 @@ import os
import
tempfile
import
textwrap
from
uuid
import
uuid4
from
mock
import
patch
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
django.test.utils
import
override_settings
from
django.conf
import
settings
from
mock
import
patch
from
opaque_keys.edx.keys
import
UsageKey
from
contentstore.tests.utils
import
CourseTestCase
,
mock_requests_get
from
opaque_keys.edx.keys
import
UsageKey
from
openedx.core.djangoapps.contentserver.caching
import
del_cached_content
from
xmodule.modulestore.django
import
modulestore
from
xmodule.contentstore.django
import
contentstore
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.contentstore.django
import
contentstore
from
xmodule.exceptions
import
NotFoundError
from
xmodule.modulestore.django
import
modulestore
from
xmodule.video_module
import
transcripts_utils
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
...
...
cms/djangoapps/contentstore/views/tests/test_user.py
View file @
e8a36957
...
...
@@ -3,12 +3,13 @@ Tests for contentstore/views/user.py.
"""
import
json
from
django.contrib.auth.models
import
User
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
from
django.contrib.auth.models
import
User
from
student.models
import
CourseEnrollment
from
student.roles
import
CourseStaffRole
,
CourseInstructorRole
from
student
import
auth
from
student.models
import
CourseEnrollment
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
class
UsersTestCase
(
CourseTestCase
):
...
...
cms/djangoapps/contentstore/views/tests/test_videos.py
View file @
e8a36957
...
...
@@ -2,25 +2,24 @@
"""
Unit tests for video-related REST APIs.
"""
from
datetime
import
datetime
import
csv
import
ddt
import
json
import
dateutil.parser
import
re
from
datetime
import
datetime
from
StringIO
import
StringIO
import
pytz
import
dateutil.parser
import
ddt
import
pytz
from
django.conf
import
settings
from
django.test.utils
import
override_settings
from
mock
import
Mock
,
patch
from
edxval.api
import
create_profile
,
create_video
,
get_video_info
from
mock
import
Mock
,
patch
from
contentstore.models
import
VideoUploadConfig
from
contentstore.views.videos
import
KEY_EXPIRATION_IN_SECONDS
,
StatusDisplayStrings
,
convert_video_status
from
contentstore.tests.utils
import
CourseTestCase
from
contentstore.utils
import
reverse_course_url
from
contentstore.views.videos
import
KEY_EXPIRATION_IN_SECONDS
,
StatusDisplayStrings
,
convert_video_status
from
xmodule.modulestore.tests.factories
import
CourseFactory
...
...
cms/djangoapps/contentstore/views/transcripts_ajax.py
View file @
e8a36957
...
...
@@ -6,41 +6,39 @@ Module do not support rollback (pressing "Cancel" button in Studio)
All user changes are saved immediately.
"""
import
copy
import
os
import
logging
import
json
import
requests
import
logging
import
os
from
django.http
import
HttpResponse
,
Http404
from
django.core.exceptions
import
PermissionDenied
from
django.contrib.auth.decorators
import
login_required
import
requests
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.core.exceptions
import
PermissionDenied
from
django.http
import
Http404
,
HttpResponse
from
django.utils.translation
import
ugettext
as
_
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
UsageKey
from
student.auth
import
has_course_author_access
from
util.json_request
import
JsonResponse
from
xmodule.contentstore.content
import
StaticContent
from
xmodule.contentstore.django
import
contentstore
from
xmodule.exceptions
import
NotFoundError
from
xmodule.modulestore.django
import
modulestore
from
opaque_keys.edx.keys
import
UsageKey
from
xmodule.contentstore.django
import
contentstore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
util.json_request
import
JsonResponse
from
xmodule.video_module.transcripts_utils
import
(
generate_subs_from_source
,
generate_srt_from_sjson
,
remove_subs_from_store
,
download_youtube_subs
,
get_transcripts_from_youtube
,
copy_or_rename_transcript
,
manage_video_subtitles_save
,
GetTranscriptsFromYouTubeException
,
TranscriptsRequestValidationException
,
youtube_video_transcript_name
,
copy_or_rename_transcript
,
download_youtube_subs
,
generate_srt_from_sjson
,
generate_subs_from_source
,
get_transcripts_from_youtube
,
manage_video_subtitles_save
,
remove_subs_from_store
,
youtube_video_transcript_name
)
from
student.auth
import
has_course_author_access
__all__
=
[
'upload_transcripts'
,
'download_transcripts'
,
...
...
cms/djangoapps/contentstore/views/user.py
View file @
e8a36957
from
django.core.exceptions
import
PermissionDenied
from
django.contrib.auth.models
import
User
from
django.contrib.auth.decorators
import
login_required
from
django.views.decorators.http
import
require_http_methods
from
django.contrib.auth.models
import
User
from
django.core.exceptions
import
PermissionDenied
from
django.http
import
HttpResponseNotFound
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.http
import
require_POST
from
django.views.decorators.csrf
import
ensure_csrf_cookie
from
edxmako.shortcuts
import
render_to_response
from
xmodule.modulestore.django
import
modulestore
from
django.views.decorators.http
import
require_http_methods
,
require_POST
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.locator
import
LibraryLocator
from
util.json_request
import
JsonResponse
,
expect_json
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
,
LibraryUserRole
from
course_creators.views
import
user_requested_access
from
course_creators.views
import
user_requested_access
from
edxmako.shortcuts
import
render_to_response
from
student
import
auth
from
student.auth
import
STUDIO_EDIT_ROLES
,
STUDIO_VIEW_USERS
,
get_user_permissions
from
student.models
import
CourseEnrollment
from
django.http
import
HttpResponseNotFound
from
student
import
auth
from
student.roles
import
CourseInstructorRole
,
CourseStaffRole
,
LibraryUserRole
from
util.json_request
import
JsonResponse
,
expect_json
from
xmodule.modulestore.django
import
modulestore
__all__
=
[
'request_course_creator'
,
'course_team_handler'
]
...
...
cms/djangoapps/contentstore/views/videos.py
View file @
e8a36957
"""
Views related to the video upload feature
"""
from
datetime
import
datetime
,
timedelta
import
logging
from
boto
import
s3
import
csv
import
logging
from
datetime
import
datetime
,
timedelta
from
uuid
import
uuid4
import
rfc6266
from
boto
import
s3
from
django.conf
import
settings
from
django.contrib.auth.decorators
import
login_required
from
django.http
import
HttpResponse
,
HttpResponseNotFound
from
django.utils.translation
import
ugettext
as
_
,
ugettext_noop
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext_noop
from
django.views.decorators.http
import
require_GET
,
require_http_methods
import
rfc6266
from
edxval.api
import
(
create_video
,
get_videos_for_course
,
SortDirection
,
VideoSortField
,
create_video
,
get_videos_for_course
,
remove_video_for_course
,
update_video_status
)
...
...
@@ -28,11 +27,10 @@ from opaque_keys.edx.keys import CourseKey
from
contentstore.models
import
VideoUploadConfig
from
contentstore.utils
import
reverse_course_url
from
edxmako.shortcuts
import
render_to_response
from
util.json_request
import
expect_json
,
JsonResponse
from
util.json_request
import
JsonResponse
,
expect_json
from
.course
import
get_course_and_check_access
__all__
=
[
"videos_handler"
,
"video_encodings_download"
]
LOGGER
=
logging
.
getLogger
(
__name__
)
...
...
cms/djangoapps/course_creators/admin.py
View file @
e8a36957
...
...
@@ -2,17 +2,17 @@
django admin page for the course creators table
"""
from
course_creators.models
import
CourseCreator
,
update_creator_state
,
send_user_notification
,
send_admin_notification
from
course_creators.views
import
update_course_creator_group
import
logging
from
smtplib
import
SMTPException
from
ratelimitbackend
import
admin
from
django.conf
import
settings
from
django.dispatch
import
receiver
from
edxmako.shortcuts
import
render_to_string
from
django.core.mail
import
send_mail
from
smtplib
import
SMTPException
from
django.dispatch
import
receiver
from
ratelimitbackend
import
admin
import
logging
from
course_creators.models
import
CourseCreator
,
send_admin_notification
,
send_user_notification
,
update_creator_state
from
course_creators.views
import
update_course_creator_group
from
edxmako.shortcuts
import
render_to_string
log
=
logging
.
getLogger
(
"studio.coursecreatoradmin"
)
...
...
cms/djangoapps/course_creators/migrations/0001_initial.py
View file @
e8a36957
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
from
django.conf
import
settings
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
...
...
cms/djangoapps/course_creators/models.py
View file @
e8a36957
"""
Table for storing information about whether or not Studio users have course creation privileges.
"""
from
django.contrib.auth.models
import
User
from
django.db
import
models
from
django.db.models.signals
import
post_init
,
post_save
from
django.dispatch
import
receiver
,
Signal
from
django.contrib.auth.models
import
User
from
django.dispatch
import
Signal
,
receiver
from
django.utils
import
timezone
from
django.utils.translation
import
ugettext
as
_
...
...
cms/djangoapps/course_creators/tests/test_admin.py
View file @
e8a36957
...
...
@@ -2,17 +2,17 @@
Tests course_creators.admin.py.
"""
from
django.test
import
TestCase
from
django.contrib.auth.models
import
User
import
mock
from
django.contrib.admin.sites
import
AdminSite
from
django.contrib.auth.models
import
User
from
django.core
import
mail
from
django.http
import
HttpRequest
import
mock
from
django.test
import
TestCase
from
course_creators.admin
import
CourseCreatorAdmin
from
course_creators.models
import
CourseCreator
from
django.core
import
mail
from
student.roles
import
CourseCreatorRole
from
student
import
auth
from
student.roles
import
CourseCreatorRole
def
mock_render_to_string
(
template_name
,
context
):
...
...
cms/djangoapps/course_creators/tests/test_views.py
View file @
e8a36957
...
...
@@ -2,16 +2,21 @@
Tests course_creators.views.py.
"""
import
mock
from
django.contrib.auth.models
import
User
from
django.core.exceptions
import
PermissionDenied
from
django.test
import
TestCase
from
django.core.urlresolvers
import
reverse
from
django.test
import
TestCase
from
course_creators.views
import
add_user_with_status_unrequested
,
add_user_with_status_granted
from
course_creators.views
import
get_course_creator_status
,
update_course_creator_group
,
user_requested_access
import
mock
from
student.roles
import
CourseCreatorRole
from
course_creators.views
import
(
add_user_with_status_granted
,
add_user_with_status_unrequested
,
get_course_creator_status
,
update_course_creator_group
,
user_requested_access
)
from
student
import
auth
from
student.roles
import
CourseCreatorRole
class
CourseCreatorView
(
TestCase
):
...
...
cms/djangoapps/course_creators/views.py
View file @
e8a36957
...
...
@@ -2,8 +2,8 @@
Methods for interacting programmatically with the user creator table.
"""
from
course_creators.models
import
CourseCreator
from
student.roles
import
CourseCreatorRole
from
student
import
auth
from
student.roles
import
CourseCreatorRole
def
add_user_with_status_unrequested
(
user
):
...
...
cms/djangoapps/maintenance/tests.py
View file @
e8a36957
"""
Tests for the maintenance app views.
"""
import
ddt
import
json
import
ddt
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
contentstore.management.commands.utils
import
get_course_versions
from
student.tests.factories
import
AdminFactory
,
UserFactory
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
contentstore.management.commands.utils
import
get_course_versions
from
student.tests.factories
import
AdminFactory
,
UserFactory
from
.views
import
COURSE_KEY_ERROR_MESSAGES
,
MAINTENANCE_VIEWS
# This list contains URLs of all maintenance app views.
MAINTENANCE_URLS
=
[
reverse
(
view
[
'url'
])
for
view
in
MAINTENANCE_VIEWS
.
values
()]
...
...
cms/djangoapps/maintenance/urls.py
View file @
e8a36957
...
...
@@ -3,8 +3,7 @@ URLs for the maintenance app.
"""
from
django.conf.urls
import
patterns
,
url
from
.views
import
MaintenanceIndexView
,
ForcePublishCourseView
from
.views
import
ForcePublishCourseView
,
MaintenanceIndexView
urlpatterns
=
patterns
(
''
,
...
...
cms/djangoapps/maintenance/views.py
View file @
e8a36957
...
...
@@ -2,23 +2,22 @@
Views for the maintenance app.
"""
import
logging
from
django.db
import
transaction
from
django.core.validators
import
ValidationError
from
django.db
import
transaction
from
django.utils.decorators
import
method_decorator
from
django.utils.translation
import
ugettext
as
_
from
django.views.generic
import
View
from
edxmako.shortcuts
import
render_to_response
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.keys
import
CourseKey
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
from
contentstore.management.commands.utils
import
get_course_versions
from
edxmako.shortcuts
import
render_to_response
from
util.json_request
import
JsonResponse
from
util.views
import
require_global_staff
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.exceptions
import
ItemNotFoundError
log
=
logging
.
getLogger
(
__name__
)
...
...
cms/djangoapps/models/settings/course_metadata.py
View file @
e8a36957
"""
Django module for Course Metadata class -- manages advanced settings and related parameters
"""
from
django.conf
import
settings
from
django.utils.translation
import
ugettext
as
_
from
xblock.fields
import
Scope
from
xblock_django.models
import
XBlockStudioConfigurationFlag
from
xmodule.modulestore.django
import
modulestore
from
django.utils.translation
import
ugettext
as
_
from
django.conf
import
settings
class
CourseMetadata
(
object
):
'''
...
...
cms/djangoapps/models/settings/encoder.py
View file @
e8a36957
...
...
@@ -6,6 +6,7 @@ import json
from
json.encoder
import
JSONEncoder
from
opaque_keys.edx.locations
import
Location
from
openedx.core.djangoapps.models.course_details
import
CourseDetails
from
xmodule.fields
import
Date
...
...
cms/djangoapps/pipeline_js/urls.py
View file @
e8a36957
"""
URL patterns for Javascript files used to load all of the XModule JS in one wad.
"""
from
django.conf.urls
import
url
,
patterns
from
django.conf.urls
import
patterns
,
url
urlpatterns
=
patterns
(
'pipeline_js.views'
,
...
...
cms/djangoapps/pipeline_js/views.py
View file @
e8a36957
...
...
@@ -5,8 +5,8 @@ Views for returning XModule JS (used by requirejs)
import
json
from
django.conf
import
settings
from
django.http
import
HttpResponse
from
django.contrib.staticfiles.storage
import
staticfiles_storage
from
django.http
import
HttpResponse
from
edxmako.shortcuts
import
render_to_response
...
...
cms/djangoapps/xblock_config/admin.py
View file @
e8a36957
...
...
@@ -2,14 +2,11 @@
Django admin dashboard configuration for LMS XBlock infrastructure.
"""
from
django.contrib
import
admin
from
config_models.admin
import
ConfigurationModelAdmin
,
KeyedConfigurationModelAdmin
from
django.contrib
import
admin
from
xblock_config.forms
import
CourseEditLTIFieldsEnabledAdminForm
from
xblock_config.models
import
(
CourseEditLTIFieldsEnabledFlag
,
StudioConfig
,
)
from
xblock_config.models
import
CourseEditLTIFieldsEnabledFlag
,
StudioConfig
class
CourseEditLTIFieldsEnabledFlagAdmin
(
KeyedConfigurationModelAdmin
):
...
...
cms/djangoapps/xblock_config/forms.py
View file @
e8a36957
...
...
@@ -6,9 +6,9 @@ import logging
from
django
import
forms
from
opaque_keys
import
InvalidKeyError
from
opaque_keys.edx.locator
import
CourseLocator
from
xmodule.modulestore.django
import
modulestore
from
xblock_config.models
import
CourseEditLTIFieldsEnabledFlag
from
xmodule.modulestore.django
import
modulestore
log
=
logging
.
getLogger
(
__name__
)
...
...
cms/djangoapps/xblock_config/migrations/0001_initial.py
View file @
e8a36957
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
import
django.db.models.deletion
from
django.conf
import
settings
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
...
...
cms/djangoapps/xblock_config/migrations/0002_courseeditltifieldsenabledflag.py
View file @
e8a36957
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
migrations
,
models
import
django.db.models.deletion
import
openedx.core.djangoapps.xmodule_django.models
from
django.conf
import
settings
from
django.db
import
migrations
,
models
import
openedx.core.djangoapps.xmodule_django.models
class
Migration
(
migrations
.
Migration
):
...
...
cms/djangoapps/xblock_config/models.py
View file @
e8a36957
...
...
@@ -5,10 +5,10 @@ Includes:
StudioConfig: A ConfigurationModel for managing Studio.
"""
from
config_models.models
import
ConfigurationModel
from
django.db.models
import
BooleanField
,
TextField
from
openedx.core.djangoapps.xmodule_django.models
import
CourseKeyField
from
config_models.models
import
ConfigurationModel
from
openedx.core.djangoapps.xmodule_django.models
import
CourseKeyField
from
request_cache.middleware
import
request_cached
...
...
cms/djangoapps/xblock_config/tests/test_models.py
View file @
e8a36957
"""
Tests for the models that configures Edit LTI fields feature.
"""
import
ddt
from
contextlib
import
contextmanager
from
django.test
import
TestCase
import
ddt
from
django.test
import
TestCase
from
opaque_keys.edx.locator
import
CourseLocator
from
request_cache.middleware
import
RequestCache
from
xblock_config.models
import
CourseEditLTIFieldsEnabledFlag
...
...
cms/lib/xblock/authoring_mixin.py
View file @
e8a36957
...
...
@@ -5,7 +5,6 @@ Mixin class that provides authoring capabilities for XBlocks.
import
logging
from
django.conf
import
settings
from
xblock.core
import
XBlock
from
xblock.fields
import
XBlockMixin
from
xblock.fragment
import
Fragment
...
...
cms/lib/xblock/tagging/admin.py
View file @
e8a36957
...
...
@@ -2,7 +2,8 @@
Admin registration for tags models
"""
from
django.contrib
import
admin
from
.models
import
TagCategories
,
TagAvailableValues
from
.models
import
TagAvailableValues
,
TagCategories
class
TagCategoriesAdmin
(
admin
.
ModelAdmin
):
...
...
cms/lib/xblock/tagging/tagging.py
View file @
e8a36957
...
...
@@ -3,16 +3,17 @@
Structured Tagging based on XBlockAsides
"""
from
xblock.core
import
XBlockAside
,
XBlock
from
xblock.fragment
import
Fragment
from
xblock.fields
import
Scope
,
Dict
from
xmodule.x_module
import
AUTHOR_VIEW
from
xmodule.capa_module
import
CapaModule
from
edxmako.shortcuts
import
render_to_string
from
django.conf
import
settings
from
webob
import
Response
from
.models
import
TagCategories
from
xblock.core
import
XBlock
,
XBlockAside
from
xblock.fields
import
Dict
,
Scope
from
xblock.fragment
import
Fragment
from
edxmako.shortcuts
import
render_to_string
from
xmodule.capa_module
import
CapaModule
from
xmodule.x_module
import
AUTHOR_VIEW
from
.models
import
TagCategories
_
=
lambda
text
:
text
...
...
cms/lib/xblock/tagging/test.py
View file @
e8a36957
...
...
@@ -2,28 +2,30 @@
Tests for the Studio Tagging XBlockAside
"""
import
ddt
import
json
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xblock_config.models
import
StudioConfig
from
datetime
import
datetime
from
StringIO
import
StringIO
import
ddt
from
django.test.client
import
RequestFactory
from
lxml
import
etree
from
opaque_keys.edx.asides
import
AsideUsageKeyV1
,
AsideUsageKeyV2
from
pytz
import
UTC
from
xblock.fields
import
ScopeIds
from
xblock.runtime
import
DictKeyValueStore
,
KvsFieldData
from
xblock.test.tools
import
TestRuntime
from
cms.lib.xblock.tagging
import
StructuredTagsAside
from
cms.lib.xblock.tagging.models
import
TagCategories
,
TagAvailableValues
from
contentstore.views.preview
import
get_preview_fragment
from
contentstore.utils
import
reverse_usage_url
from
cms.lib.xblock.tagging.models
import
TagAvailableValues
,
TagCategories
from
contentstore.tests.utils
import
AjaxEnabledTestClient
from
django.test.client
import
RequestFactory
from
contentstore.utils
import
reverse_usage_url
from
contentstore.views.preview
import
get_preview_fragment
from
student.tests.factories
import
UserFactory
from
opaque_keys.edx.asides
import
AsideUsageKeyV1
,
AsideUsageKeyV2
from
datetime
import
datetime
from
pytz
import
UTC
from
lxml
import
etre
e
from
StringIO
import
StringIO
from
xblock_config.models
import
StudioConfig
from
xmodule.modulestore
import
ModuleStoreEnum
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCas
e
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
@ddt.ddt
...
...
cms/lib/xblock/test/test_runtime.py
View file @
e8a36957
"""
Tests of edX Studio runtime functionality
"""
from
unittest
import
TestCase
from
urlparse
import
urlparse
from
mock
import
Mock
from
unittest
import
TestCase
from
cms.lib.xblock.runtime
import
handler_url
...
...
cms/startup.py
View file @
e8a36957
...
...
@@ -2,24 +2,22 @@
Module with code executed during Studio startup
"""
import
django
from
django.conf
import
settings
# Force settings to run so that the python path is modified
settings
.
INSTALLED_APPS
# pylint: disable=pointless-statement
from
openedx.core.lib.django_startup
import
autostartup
import
django
import
cms.lib.xblock.runtime
import
xmodule.x_module
from
openedx.core.djangoapps.monkey_patch
import
django_db_models_options
from
openedx.core.djangoapps.theming.core
import
enable_theming
from
openedx.core.djangoapps.theming.helpers
import
is_comprehensive_theming_enabled
from
openedx.core.lib.django_startup
import
autostartup
from
openedx.core.lib.xblock_utils
import
xblock_local_resource_url
from
openedx.core.release
import
doc_version
from
startup_configurations.validate_config
import
validate_cms_config
import
xmodule.x_module
import
cms.lib.xblock.runtime
# Force settings to run so that the python path is modified
from
startup_configurations.validate_config
import
validate_cms_config
from
openedx.core.djangoapps.theming.core
import
enable_theming
from
openedx.core.djangoapps.theming.helpers
import
is_comprehensive_theming_enabled
settings
.
INSTALLED_APPS
# pylint: disable=pointless-statement
def
run
():
...
...
cms/urls.py
View file @
e8a36957
from
django.conf
import
settings
from
django.conf.urls
import
patterns
,
include
,
url
from
django.conf.urls
import
include
,
patterns
,
url
# There is a course creators admin table.
from
ratelimitbackend
import
admin
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment