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
fcaa783e
Commit
fcaa783e
authored
Oct 31, 2014
by
muhammad-ammar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unit Test Improvements
TE-489
parent
375a38c4
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
194 additions
and
159 deletions
+194
-159
cms/djangoapps/contentstore/management/commands/tests/test_cleanup_assets.py
+4
-1
cms/djangoapps/contentstore/tests/test_contentstore.py
+22
-20
cms/djangoapps/contentstore/tests/test_import.py
+10
-8
cms/djangoapps/contentstore/tests/test_import_draft_order.py
+4
-1
cms/djangoapps/contentstore/tests/test_import_pure_xblock.py
+4
-1
cms/djangoapps/contentstore/tests/utils.py
+4
-1
cms/djangoapps/contentstore/views/tests/test_assets.py
+5
-2
common/djangoapps/contentserver/tests/test.py
+3
-1
common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
+2
-1
common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py
+3
-1
common/test/data/empty/.gitkeep
+0
-0
lms/djangoapps/course_wiki/tests/test_access.py
+2
-6
lms/djangoapps/course_wiki/tests/test_middleware.py
+2
-2
lms/djangoapps/course_wiki/tests/tests.py
+10
-7
lms/djangoapps/courseware/management/commands/tests/test_dump_course.py
+2
-1
lms/djangoapps/courseware/tests/__init__.py
+2
-2
lms/djangoapps/courseware/tests/test_about.py
+10
-6
lms/djangoapps/courseware/tests/test_access.py
+2
-4
lms/djangoapps/dashboard/tests/test_sysadmin.py
+4
-1
lms/djangoapps/django_comment_client/base/tests.py
+11
-9
lms/djangoapps/django_comment_client/forum/tests.py
+21
-15
lms/djangoapps/instructor/tests/test_access.py
+5
-5
lms/djangoapps/instructor/tests/test_api.py
+14
-14
lms/djangoapps/instructor/tests/test_email.py
+2
-2
lms/djangoapps/instructor/tests/test_enrollment.py
+3
-3
lms/djangoapps/instructor/tests/test_hint_manager.py
+4
-2
lms/djangoapps/instructor/tests/test_legacy_anon_csv.py
+5
-6
lms/djangoapps/instructor/tests/test_legacy_download_csv.py
+5
-6
lms/djangoapps/instructor/tests/test_legacy_enrollment.py
+2
-2
lms/djangoapps/instructor/tests/test_legacy_forum_admin.py
+4
-9
lms/djangoapps/instructor/tests/test_legacy_reset.py
+2
-2
lms/djangoapps/instructor/tests/test_legacy_xss.py
+4
-2
lms/djangoapps/instructor/tests/test_spoc_gradebook.py
+2
-2
lms/djangoapps/instructor/tests/test_tools.py
+5
-5
lms/djangoapps/instructor_task/tests/test_base.py
+3
-3
lms/djangoapps/licenses/tests.py
+2
-2
lms/djangoapps/oauth2_handler/tests.py
+3
-2
lms/djangoapps/staticbook/tests.py
+2
-2
No files found.
cms/djangoapps/contentstore/management/commands/tests/test_cleanup_assets.py
View file @
fcaa783e
...
@@ -11,6 +11,9 @@ from xmodule.modulestore.django import modulestore
...
@@ -11,6 +11,9 @@ from xmodule.modulestore.django import modulestore
from
xmodule.modulestore.mongo.base
import
location_to_query
from
xmodule.modulestore.mongo.base
import
location_to_query
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
django.conf
import
settings
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
class
ExportAllCourses
(
ModuleStoreTestCase
):
class
ExportAllCourses
(
ModuleStoreTestCase
):
...
@@ -30,7 +33,7 @@ class ExportAllCourses(ModuleStoreTestCase):
...
@@ -30,7 +33,7 @@ class ExportAllCourses(ModuleStoreTestCase):
import_from_xml
(
import_from_xml
(
self
.
module_store
,
self
.
module_store
,
'**replace_user**'
,
'**replace_user**'
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'dot-underscore'
],
[
'dot-underscore'
],
static_content_store
=
self
.
content_store
,
static_content_store
=
self
.
content_store
,
do_import_static
=
True
,
do_import_static
=
True
,
...
...
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
fcaa783e
...
@@ -56,6 +56,8 @@ from xmodule.contentstore.content import StaticContent
...
@@ -56,6 +56,8 @@ from xmodule.contentstore.content import StaticContent
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
)
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
)
class
ContentStoreTestCase
(
CourseTestCase
):
class
ContentStoreTestCase
(
CourseTestCase
):
...
@@ -69,7 +71,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
...
@@ -69,7 +71,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
Tests which legitimately need to import a course
Tests which legitimately need to import a course
"""
"""
def
test_no_static_link_rewrites_on_import
(
self
):
def
test_no_static_link_rewrites_on_import
(
self
):
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
])
course
=
course_items
[
0
]
course
=
course_items
[
0
]
handouts_usage_key
=
course
.
id
.
make_usage_key
(
'course_info'
,
'handouts'
)
handouts_usage_key
=
course
.
id
.
make_usage_key
(
'course_info'
,
'handouts'
)
...
@@ -81,7 +83,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
...
@@ -81,7 +83,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
self
.
assertIn
(
'/static/'
,
handouts
.
data
)
self
.
assertIn
(
'/static/'
,
handouts
.
data
)
def
test_xlint_fails
(
self
):
def
test_xlint_fails
(
self
):
err_cnt
=
perform_xlint
(
'common/test/data'
,
[
'toy'
])
err_cnt
=
perform_xlint
(
TEST_DATA_DIR
,
[
'toy'
])
self
.
assertGreater
(
err_cnt
,
0
)
self
.
assertGreater
(
err_cnt
,
0
)
def
test_about_overrides
(
self
):
def
test_about_overrides
(
self
):
...
@@ -90,7 +92,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
...
@@ -90,7 +92,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
e.g. /about/Fall_2012/effort.html
e.g. /about/Fall_2012/effort.html
while there is a base definition in /about/effort.html
while there is a base definition in /about/effort.html
'''
'''
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
])
course_key
=
course_items
[
0
]
.
id
course_key
=
course_items
[
0
]
.
id
effort
=
self
.
store
.
get_item
(
course_key
.
make_usage_key
(
'about'
,
'effort'
))
effort
=
self
.
store
.
get_item
(
course_key
.
make_usage_key
(
'about'
,
'effort'
))
self
.
assertEqual
(
effort
.
data
,
'6 hours'
)
self
.
assertEqual
(
effort
.
data
,
'6 hours'
)
...
@@ -105,7 +107,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
...
@@ -105,7 +107,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
'''
'''
content_store
=
contentstore
()
content_store
=
contentstore
()
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
static_content_store
=
content_store
,
verbose
=
True
)
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
],
static_content_store
=
content_store
,
verbose
=
True
)
course
=
self
.
store
.
get_course
(
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
))
course
=
self
.
store
.
get_course
(
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
))
...
@@ -153,7 +155,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
...
@@ -153,7 +155,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
Test that course info updates are imported and exported with all content fields ('data', 'items')
Test that course info updates are imported and exported with all content fields ('data', 'items')
"""
"""
content_store
=
contentstore
()
content_store
=
contentstore
()
data_dir
=
"common/test/data/"
data_dir
=
TEST_DATA_DIR
courses
=
import_from_xml
(
courses
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
data_dir
,
[
'course_info_updates'
],
self
.
store
,
self
.
user
.
id
,
data_dir
,
[
'course_info_updates'
],
static_content_store
=
content_store
,
verbose
=
True
,
static_content_store
=
content_store
,
verbose
=
True
,
...
@@ -166,7 +168,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
...
@@ -166,7 +168,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
self
.
assertIsNotNone
(
course_updates
)
self
.
assertIsNotNone
(
course_updates
)
# check that course which is imported has files 'updates.html' and 'updates.items.json'
# check that course which is imported has files 'updates.html' and 'updates.items.json'
filesystem
=
OSFS
(
data_dir
+
'course_info_updates/info'
)
filesystem
=
OSFS
(
data_dir
+
'
/
course_info_updates/info'
)
self
.
assertTrue
(
filesystem
.
exists
(
'updates.html'
))
self
.
assertTrue
(
filesystem
.
exists
(
'updates.html'
))
self
.
assertTrue
(
filesystem
.
exists
(
'updates.items.json'
))
self
.
assertTrue
(
filesystem
.
exists
(
'updates.items.json'
))
...
@@ -204,7 +206,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
...
@@ -204,7 +206,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
def
test_rewrite_nonportable_links_on_import
(
self
):
def
test_rewrite_nonportable_links_on_import
(
self
):
content_store
=
contentstore
()
content_store
=
contentstore
()
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
static_content_store
=
content_store
)
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
],
static_content_store
=
content_store
)
# first check a static asset link
# first check a static asset link
course_key
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'run'
)
course_key
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'run'
)
...
@@ -314,7 +316,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
...
@@ -314,7 +316,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
def
test_export_course_with_metadata_only_video
(
self
):
def
test_export_course_with_metadata_only_video
(
self
):
content_store
=
contentstore
()
content_store
=
contentstore
()
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
])
course_id
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
course_id
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
# create a new video module and add it as a child to a vertical
# create a new video module and add it as a child to a vertical
...
@@ -343,7 +345,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
...
@@ -343,7 +345,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
"""
"""
content_store
=
contentstore
()
content_store
=
contentstore
()
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'word_cloud'
])
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'word_cloud'
])
course_id
=
SlashSeparatedCourseKey
(
'HarvardX'
,
'ER22x'
,
'2013_Spring'
)
course_id
=
SlashSeparatedCourseKey
(
'HarvardX'
,
'ER22x'
,
'2013_Spring'
)
verticals
=
self
.
store
.
get_items
(
course_id
,
qualifiers
=
{
'category'
:
'vertical'
})
verticals
=
self
.
store
.
get_items
(
course_id
,
qualifiers
=
{
'category'
:
'vertical'
})
...
@@ -370,7 +372,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
...
@@ -370,7 +372,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
"""
"""
content_store
=
contentstore
()
content_store
=
contentstore
()
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
])
course_id
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
course_id
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
verticals
=
self
.
store
.
get_items
(
course_id
,
qualifiers
=
{
'category'
:
'vertical'
})
verticals
=
self
.
store
.
get_items
(
course_id
,
qualifiers
=
{
'category'
:
'vertical'
})
...
@@ -401,7 +403,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
...
@@ -401,7 +403,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
"""
"""
content_store
=
contentstore
()
content_store
=
contentstore
()
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
])
course_id
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
course_id
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
...
@@ -423,7 +425,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
...
@@ -423,7 +425,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
def
test_export_course_without_content_store
(
self
):
def
test_export_course_without_content_store
(
self
):
# Create toy course
# Create toy course
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
])
course_id
=
course_items
[
0
]
.
id
course_id
=
course_items
[
0
]
.
id
root_dir
=
path
(
mkdtemp_clean
())
root_dir
=
path
(
mkdtemp_clean
())
...
@@ -1212,7 +1214,7 @@ class ContentStoreTest(ContentStoreTestCase):
...
@@ -1212,7 +1214,7 @@ class ContentStoreTest(ContentStoreTestCase):
)
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'simple'
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'simple'
])
course_key
=
course_items
[
0
]
.
id
course_key
=
course_items
[
0
]
.
id
resp
=
self
.
_show_course_overview
(
course_key
)
resp
=
self
.
_show_course_overview
(
course_key
)
...
@@ -1259,7 +1261,7 @@ class ContentStoreTest(ContentStoreTestCase):
...
@@ -1259,7 +1261,7 @@ class ContentStoreTest(ContentStoreTestCase):
target_course_id
=
_get_course_id
(
self
.
course_data
)
target_course_id
=
_get_course_id
(
self
.
course_data
)
_create_course
(
self
,
target_course_id
,
self
.
course_data
)
_create_course
(
self
,
target_course_id
,
self
.
course_data
)
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
target_course_id
=
target_course_id
)
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
],
target_course_id
=
target_course_id
)
modules
=
self
.
store
.
get_items
(
target_course_id
)
modules
=
self
.
store
.
get_items
(
target_course_id
)
...
@@ -1294,7 +1296,7 @@ class ContentStoreTest(ContentStoreTestCase):
...
@@ -1294,7 +1296,7 @@ class ContentStoreTest(ContentStoreTestCase):
course_module
.
save
()
course_module
.
save
()
# Import a course with wiki_slug == location.course
# Import a course with wiki_slug == location.course
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
target_course_id
=
target_course_id
)
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
],
target_course_id
=
target_course_id
)
course_module
=
self
.
store
.
get_course
(
target_course_id
)
course_module
=
self
.
store
.
get_course
(
target_course_id
)
self
.
assertEquals
(
course_module
.
wiki_slug
,
'toy'
)
self
.
assertEquals
(
course_module
.
wiki_slug
,
'toy'
)
...
@@ -1309,17 +1311,17 @@ class ContentStoreTest(ContentStoreTestCase):
...
@@ -1309,17 +1311,17 @@ class ContentStoreTest(ContentStoreTestCase):
_create_course
(
self
,
target_course_id
,
course_data
)
_create_course
(
self
,
target_course_id
,
course_data
)
# Import a course with wiki_slug == location.course
# Import a course with wiki_slug == location.course
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
target_course_id
=
target_course_id
)
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
],
target_course_id
=
target_course_id
)
course_module
=
self
.
store
.
get_course
(
target_course_id
)
course_module
=
self
.
store
.
get_course
(
target_course_id
)
self
.
assertEquals
(
course_module
.
wiki_slug
,
'MITx.111.2013_Spring'
)
self
.
assertEquals
(
course_module
.
wiki_slug
,
'MITx.111.2013_Spring'
)
# Now try importing a course with wiki_slug == '{0}.{1}.{2}'.format(location.org, location.course, location.run)
# Now try importing a course with wiki_slug == '{0}.{1}.{2}'.format(location.org, location.course, location.run)
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'two_toys'
],
target_course_id
=
target_course_id
)
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'two_toys'
],
target_course_id
=
target_course_id
)
course_module
=
self
.
store
.
get_course
(
target_course_id
)
course_module
=
self
.
store
.
get_course
(
target_course_id
)
self
.
assertEquals
(
course_module
.
wiki_slug
,
'MITx.111.2013_Spring'
)
self
.
assertEquals
(
course_module
.
wiki_slug
,
'MITx.111.2013_Spring'
)
def
test_import_metadata_with_attempts_empty_string
(
self
):
def
test_import_metadata_with_attempts_empty_string
(
self
):
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'simple'
])
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'simple'
])
did_load_item
=
False
did_load_item
=
False
try
:
try
:
course_key
=
SlashSeparatedCourseKey
(
'edX'
,
'simple'
,
'problem'
)
course_key
=
SlashSeparatedCourseKey
(
'edX'
,
'simple'
,
'problem'
)
...
@@ -1341,7 +1343,7 @@ class ContentStoreTest(ContentStoreTestCase):
...
@@ -1341,7 +1343,7 @@ class ContentStoreTest(ContentStoreTestCase):
self
.
assertNotEquals
(
new_discussion_item
.
discussion_id
,
'$$GUID$$'
)
self
.
assertNotEquals
(
new_discussion_item
.
discussion_id
,
'$$GUID$$'
)
def
test_metadata_inheritance
(
self
):
def
test_metadata_inheritance
(
self
):
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
])
course_items
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
])
course
=
course_items
[
0
]
course
=
course_items
[
0
]
verticals
=
self
.
store
.
get_items
(
course
.
id
,
qualifiers
=
{
'category'
:
'vertical'
})
verticals
=
self
.
store
.
get_items
(
course
.
id
,
qualifiers
=
{
'category'
:
'vertical'
})
...
@@ -1410,7 +1412,7 @@ class ContentStoreTest(ContentStoreTestCase):
...
@@ -1410,7 +1412,7 @@ class ContentStoreTest(ContentStoreTestCase):
courses
=
import_from_xml
(
courses
=
import_from_xml
(
self
.
store
,
self
.
store
,
self
.
user
.
id
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'conditional_and_poll'
],
[
'conditional_and_poll'
],
static_content_store
=
content_store
static_content_store
=
content_store
)
)
...
...
cms/djangoapps/contentstore/tests/test_import.py
View file @
fcaa783e
...
@@ -24,6 +24,8 @@ from uuid import uuid4
...
@@ -24,6 +24,8 @@ from uuid import uuid4
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
@ddt.ddt
@ddt.ddt
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
)
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
)
...
@@ -48,7 +50,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
...
@@ -48,7 +50,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
import_from_xml
(
import_from_xml
(
module_store
,
module_store
,
self
.
user
.
id
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'test_import_course'
],
[
'test_import_course'
],
static_content_store
=
content_store
,
static_content_store
=
content_store
,
do_import_static
=
False
,
do_import_static
=
False
,
...
@@ -70,7 +72,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
...
@@ -70,7 +72,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
course_items
=
import_from_xml
(
course_items
=
import_from_xml
(
module_store
,
module_store
,
self
.
user
.
id
,
self
.
user
.
id
,
'common/test/data'
,
TEST_DATA_DIR
,
[
'test_import_course_2'
],
[
'test_import_course_2'
],
target_course_id
=
course
.
id
,
target_course_id
=
course
.
id
,
verbose
=
True
,
verbose
=
True
,
...
@@ -86,7 +88,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
...
@@ -86,7 +88,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
import_from_xml
(
import_from_xml
(
module_store
,
module_store
,
self
.
user
.
id
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'2014_Uni'
],
[
'2014_Uni'
],
target_course_id
=
course_id
target_course_id
=
course_id
)
)
...
@@ -131,7 +133,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
...
@@ -131,7 +133,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
content_store
=
contentstore
()
content_store
=
contentstore
()
module_store
=
modulestore
()
module_store
=
modulestore
()
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
static_content_store
=
content_store
,
do_import_static
=
False
,
verbose
=
True
)
import_from_xml
(
module_store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
],
static_content_store
=
content_store
,
do_import_static
=
False
,
verbose
=
True
)
course
=
module_store
.
get_course
(
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
))
course
=
module_store
.
get_course
(
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
))
...
@@ -142,7 +144,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
...
@@ -142,7 +144,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
def
test_no_static_link_rewrites_on_import
(
self
):
def
test_no_static_link_rewrites_on_import
(
self
):
module_store
=
modulestore
()
module_store
=
modulestore
()
courses
=
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
do_import_static
=
False
,
verbose
=
True
)
courses
=
import_from_xml
(
module_store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
],
do_import_static
=
False
,
verbose
=
True
)
course_key
=
courses
[
0
]
.
id
course_key
=
courses
[
0
]
.
id
handouts
=
module_store
.
get_item
(
course_key
.
make_usage_key
(
'course_info'
,
'handouts'
))
handouts
=
module_store
.
get_item
(
course_key
.
make_usage_key
(
'course_info'
,
'handouts'
))
...
@@ -183,7 +185,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
...
@@ -183,7 +185,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
import_from_xml
(
import_from_xml
(
module_store
,
module_store
,
self
.
user
.
id
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'conditional'
],
[
'conditional'
],
target_course_id
=
target_course_id
target_course_id
=
target_course_id
)
)
...
@@ -213,7 +215,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
...
@@ -213,7 +215,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
import_from_xml
(
import_from_xml
(
module_store
,
module_store
,
self
.
user
.
id
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'open_ended'
],
[
'open_ended'
],
target_course_id
=
target_course_id
target_course_id
=
target_course_id
)
)
...
@@ -254,7 +256,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
...
@@ -254,7 +256,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
import_from_xml
(
import_from_xml
(
module_store
,
module_store
,
self
.
user
.
id
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
source_course_name
],
[
source_course_name
],
target_course_id
=
target_course_id
target_course_id
=
target_course_id
)
)
...
...
cms/djangoapps/contentstore/tests/test_import_draft_order.py
View file @
fcaa783e
...
@@ -2,6 +2,9 @@ from xmodule.modulestore.xml_importer import import_from_xml
...
@@ -2,6 +2,9 @@ from xmodule.modulestore.xml_importer import import_from_xml
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
django.conf
import
settings
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
# This test is in the CMS module because the test configuration to use a draft
# This test is in the CMS module because the test configuration to use a draft
...
@@ -10,7 +13,7 @@ class DraftReorderTestCase(ModuleStoreTestCase):
...
@@ -10,7 +13,7 @@ class DraftReorderTestCase(ModuleStoreTestCase):
def
test_order
(
self
):
def
test_order
(
self
):
store
=
modulestore
()
store
=
modulestore
()
course_items
=
import_from_xml
(
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'import_draft_order'
])
course_items
=
import_from_xml
(
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'import_draft_order'
])
course_key
=
course_items
[
0
]
.
id
course_key
=
course_items
[
0
]
.
id
sequential
=
store
.
get_item
(
course_key
.
make_usage_key
(
'sequential'
,
'0f4f7649b10141b0bdc9922dcf94515a'
))
sequential
=
store
.
get_item
(
course_key
.
make_usage_key
(
'sequential'
,
'0f4f7649b10141b0bdc9922dcf94515a'
))
verticals
=
sequential
.
children
verticals
=
sequential
.
children
...
...
cms/djangoapps/contentstore/tests/test_import_pure_xblock.py
View file @
fcaa783e
...
@@ -9,6 +9,9 @@ from xmodule.modulestore.xml_importer import import_from_xml
...
@@ -9,6 +9,9 @@ from xmodule.modulestore.xml_importer import import_from_xml
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.mongo.draft
import
as_draft
from
xmodule.modulestore.mongo.draft
import
as_draft
from
django.conf
import
settings
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
class
StubXBlock
(
XBlock
):
class
StubXBlock
(
XBlock
):
...
@@ -59,7 +62,7 @@ class XBlockImportTest(ModuleStoreTestCase):
...
@@ -59,7 +62,7 @@ class XBlockImportTest(ModuleStoreTestCase):
"""
"""
courses
=
import_from_xml
(
courses
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data'
,
[
course_dir
]
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
course_dir
]
)
)
xblock_location
=
courses
[
0
]
.
id
.
make_usage_key
(
'stubxblock'
,
'xblock_test'
)
xblock_location
=
courses
[
0
]
.
id
.
make_usage_key
(
'stubxblock'
,
'xblock_test'
)
...
...
cms/djangoapps/contentstore/tests/utils.py
View file @
fcaa783e
...
@@ -18,6 +18,9 @@ from student.models import Registration
...
@@ -18,6 +18,9 @@ from student.models import Registration
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
,
AssetLocation
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
,
AssetLocation
from
contentstore.utils
import
reverse_url
from
contentstore.utils
import
reverse_url
from
xmodule.modulestore.split_mongo.split
import
SplitMongoModuleStore
from
xmodule.modulestore.split_mongo.split
import
SplitMongoModuleStore
from
django.conf
import
settings
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
def
parse_json
(
response
):
def
parse_json
(
response
):
...
@@ -135,7 +138,7 @@ class CourseTestCase(ModuleStoreTestCase):
...
@@ -135,7 +138,7 @@ class CourseTestCase(ModuleStoreTestCase):
Imports the test toy course and populates it with additional test data
Imports the test toy course and populates it with additional test data
"""
"""
content_store
=
contentstore
()
content_store
=
contentstore
()
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
static_content_store
=
content_store
)
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
],
static_content_store
=
content_store
)
course_id
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
course_id
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
# create an Orphan
# create an Orphan
...
...
cms/djangoapps/contentstore/views/tests/test_assets.py
View file @
fcaa783e
...
@@ -21,6 +21,9 @@ from xmodule.modulestore.django import modulestore
...
@@ -21,6 +21,9 @@ from xmodule.modulestore.django import modulestore
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
,
AssetLocation
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
,
AssetLocation
from
django.conf
import
settings
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
class
AssetsTestCase
(
CourseTestCase
):
class
AssetsTestCase
(
CourseTestCase
):
...
@@ -54,7 +57,7 @@ class BasicAssetsTestCase(AssetsTestCase):
...
@@ -54,7 +57,7 @@ class BasicAssetsTestCase(AssetsTestCase):
course_items
=
import_from_xml
(
course_items
=
import_from_xml
(
module_store
,
module_store
,
self
.
user
.
id
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'toy'
],
[
'toy'
],
static_content_store
=
contentstore
(),
static_content_store
=
contentstore
(),
verbose
=
True
verbose
=
True
...
@@ -247,7 +250,7 @@ class LockAssetTestCase(AssetsTestCase):
...
@@ -247,7 +250,7 @@ class LockAssetTestCase(AssetsTestCase):
course_items
=
import_from_xml
(
course_items
=
import_from_xml
(
module_store
,
module_store
,
self
.
user
.
id
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'toy'
],
[
'toy'
],
static_content_store
=
contentstore
(),
static_content_store
=
contentstore
(),
verbose
=
True
verbose
=
True
...
...
common/djangoapps/contentserver/tests/test.py
View file @
fcaa783e
...
@@ -25,6 +25,8 @@ log = logging.getLogger(__name__)
...
@@ -25,6 +25,8 @@ log = logging.getLogger(__name__)
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
@ddt.ddt
@ddt.ddt
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
)
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
)
...
@@ -47,7 +49,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
...
@@ -47,7 +49,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
self
.
course_key
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
self
.
course_key
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
import_from_xml
(
import_from_xml
(
modulestore
(),
self
.
user
.
id
,
'common/test/data/'
,
[
'toy'
],
modulestore
(),
self
.
user
.
id
,
TEST_DATA_DIR
,
[
'toy'
],
static_content_store
=
self
.
contentstore
,
verbose
=
True
static_content_store
=
self
.
contentstore
,
verbose
=
True
)
)
...
...
common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
View file @
fcaa783e
...
@@ -116,7 +116,7 @@ def split_mongo_store_config(data_dir):
...
@@ -116,7 +116,7 @@ def split_mongo_store_config(data_dir):
return
store
return
store
def
xml_store_config
(
data_dir
):
def
xml_store_config
(
data_dir
,
course_dirs
=
None
):
"""
"""
Defines default module store using XMLModuleStore.
Defines default module store using XMLModuleStore.
"""
"""
...
@@ -127,6 +127,7 @@ def xml_store_config(data_dir):
...
@@ -127,6 +127,7 @@ def xml_store_config(data_dir):
'OPTIONS'
:
{
'OPTIONS'
:
{
'data_dir'
:
data_dir
,
'data_dir'
:
data_dir
,
'default_class'
:
'xmodule.hidden_module.HiddenDescriptor'
,
'default_class'
:
'xmodule.hidden_module.HiddenDescriptor'
,
'course_dirs'
:
course_dirs
,
}
}
}
}
}
}
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py
View file @
fcaa783e
...
@@ -31,6 +31,8 @@ from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOS
...
@@ -31,6 +31,8 @@ from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOS
from
xmodule.modulestore.inheritance
import
InheritanceMixin
from
xmodule.modulestore.inheritance
import
InheritanceMixin
from
xmodule.x_module
import
XModuleMixin
from
xmodule.x_module
import
XModuleMixin
TEST_DATA_DIR
=
'common/test/data/'
COMMON_DOCSTORE_CONFIG
=
{
COMMON_DOCSTORE_CONFIG
=
{
'host'
:
MONGO_HOST
,
'host'
:
MONGO_HOST
,
...
@@ -289,7 +291,7 @@ class CrossStoreXMLRoundtrip(CourseComparisonTest):
...
@@ -289,7 +291,7 @@ class CrossStoreXMLRoundtrip(CourseComparisonTest):
import_from_xml
(
import_from_xml
(
source_store
,
source_store
,
'test_user'
,
'test_user'
,
'common/test/data'
,
TEST_DATA_DIR
,
course_dirs
=
[
course_data_name
],
course_dirs
=
[
course_data_name
],
static_content_store
=
source_content
,
static_content_store
=
source_content
,
target_course_id
=
source_course_key
,
target_course_id
=
source_course_key
,
...
...
common/test/data/empty/.gitkeep
0 → 100644
View file @
fcaa783e
lms/djangoapps/course_wiki/tests/test_access.py
View file @
fcaa783e
...
@@ -9,7 +9,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
...
@@ -9,7 +9,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
courseware.tests.factories
import
InstructorFactory
,
StaffFactory
from
courseware.tests.factories
import
InstructorFactory
,
StaffFactory
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
wiki.models
import
URLPath
from
wiki.models
import
URLPath
from
course_wiki.views
import
get_or_create_root
from
course_wiki.views
import
get_or_create_root
...
@@ -17,7 +17,7 @@ from course_wiki.utils import user_is_article_course_staff, course_wiki_slug
...
@@ -17,7 +17,7 @@ from course_wiki.utils import user_is_article_course_staff, course_wiki_slug
from
course_wiki
import
settings
from
course_wiki
import
settings
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestWikiAccessBase
(
ModuleStoreTestCase
):
class
TestWikiAccessBase
(
ModuleStoreTestCase
):
"""Base class for testing wiki access."""
"""Base class for testing wiki access."""
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -53,7 +53,6 @@ class TestWikiAccessBase(ModuleStoreTestCase):
...
@@ -53,7 +53,6 @@ class TestWikiAccessBase(ModuleStoreTestCase):
]
]
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
TestWikiAccess
(
TestWikiAccessBase
):
class
TestWikiAccess
(
TestWikiAccessBase
):
"""Test wiki access for course staff."""
"""Test wiki access for course staff."""
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -114,7 +113,6 @@ class TestWikiAccess(TestWikiAccessBase):
...
@@ -114,7 +113,6 @@ class TestWikiAccess(TestWikiAccessBase):
self
.
assertFalse
(
user_is_article_course_staff
(
course_staff
,
self
.
wiki_310b
.
article
))
self
.
assertFalse
(
user_is_article_course_staff
(
course_staff
,
self
.
wiki_310b
.
article
))
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
TestWikiAccessForStudent
(
TestWikiAccessBase
):
class
TestWikiAccessForStudent
(
TestWikiAccessBase
):
"""Test access for students."""
"""Test access for students."""
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -130,7 +128,6 @@ class TestWikiAccessForStudent(TestWikiAccessBase):
...
@@ -130,7 +128,6 @@ class TestWikiAccessForStudent(TestWikiAccessBase):
self
.
assertFalse
(
user_is_article_course_staff
(
self
.
student
,
page
.
article
))
self
.
assertFalse
(
user_is_article_course_staff
(
self
.
student
,
page
.
article
))
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
TestWikiAccessForNumericalCourseNumber
(
TestWikiAccessBase
):
class
TestWikiAccessForNumericalCourseNumber
(
TestWikiAccessBase
):
"""Test staff has access if course number is numerical and wiki slug has an underscore appended."""
"""Test staff has access if course number is numerical and wiki slug has an underscore appended."""
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -150,7 +147,6 @@ class TestWikiAccessForNumericalCourseNumber(TestWikiAccessBase):
...
@@ -150,7 +147,6 @@ class TestWikiAccessForNumericalCourseNumber(TestWikiAccessBase):
self
.
assertTrue
(
user_is_article_course_staff
(
course_staff
,
page
.
article
))
self
.
assertTrue
(
user_is_article_course_staff
(
course_staff
,
page
.
article
))
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
TestWikiAccessForOldFormatCourseStaffGroups
(
TestWikiAccessBase
):
class
TestWikiAccessForOldFormatCourseStaffGroups
(
TestWikiAccessBase
):
"""Test staff has access if course group has old format."""
"""Test staff has access if course group has old format."""
def
setUp
(
self
):
def
setUp
(
self
):
...
...
lms/djangoapps/course_wiki/tests/test_middleware.py
View file @
fcaa783e
...
@@ -10,11 +10,11 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
...
@@ -10,11 +10,11 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
courseware.tests.factories
import
InstructorFactory
from
courseware.tests.factories
import
InstructorFactory
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
course_wiki.views
import
get_or_create_root
from
course_wiki.views
import
get_or_create_root
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestWikiAccessMiddleware
(
ModuleStoreTestCase
):
class
TestWikiAccessMiddleware
(
ModuleStoreTestCase
):
"""Tests for WikiAccessMiddleware."""
"""Tests for WikiAccessMiddleware."""
...
...
lms/djangoapps/course_wiki/tests/tests.py
View file @
fcaa783e
...
@@ -2,20 +2,23 @@ from django.core.urlresolvers import reverse
...
@@ -2,20 +2,23 @@ from django.core.urlresolvers import reverse
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
courseware.tests.tests
import
LoginEnrollmentTestCase
from
courseware.tests.tests
import
LoginEnrollmentTestCase
from
courseware.tests.modulestore_config
import
TEST_DATA_MIXED_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_MONGO_MODULESTORE
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
mock
import
patch
from
mock
import
patch
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
WikiRedirectTestCase
(
LoginEnrollmentTestCase
):
class
WikiRedirectTestCase
(
LoginEnrollmentTestCase
):
"""
Tests for wiki course redirection.
"""
def
setUp
(
self
):
@classmethod
def
setUpClass
(
cls
):
cls
.
toy
=
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'toy'
,
display_name
=
'2012_Fall'
)
# Load the toy course
def
setUp
(
self
):
self
.
toy
=
modulestore
()
.
get_course
(
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
))
# Create two accounts
# Create two accounts
self
.
student
=
'view@test.com'
self
.
student
=
'view@test.com'
...
...
lms/djangoapps/courseware/management/commands/tests/test_dump_course.py
View file @
fcaa783e
...
@@ -24,8 +24,9 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
...
@@ -24,8 +24,9 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
django.conf
import
settings
DATA_DIR
=
'common/test/data/'
DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
TEST_COURSE_ID
=
'edX/simple/2012_Fall'
TEST_COURSE_ID
=
'edX/simple/2012_Fall'
...
...
lms/djangoapps/courseware/tests/__init__.py
View file @
fcaa783e
...
@@ -13,7 +13,7 @@ from django.test.client import Client
...
@@ -13,7 +13,7 @@ from django.test.client import Client
from
edxmako.shortcuts
import
render_to_string
from
edxmako.shortcuts
import
render_to_string
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
xblock.field_data
import
DictFieldData
from
xblock.field_data
import
DictFieldData
from
xmodule.tests
import
get_test_system
,
get_test_descriptor_system
from
xmodule.tests
import
get_test_system
,
get_test_descriptor_system
from
opaque_keys.edx.locations
import
Location
from
opaque_keys.edx.locations
import
Location
...
@@ -24,7 +24,7 @@ from lms.lib.xblock.field_data import LmsFieldData
...
@@ -24,7 +24,7 @@ from lms.lib.xblock.field_data import LmsFieldData
from
lms.lib.xblock.runtime
import
quote_slashes
from
lms.lib.xblock.runtime
import
quote_slashes
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
BaseTestXmodule
(
ModuleStoreTestCase
):
class
BaseTestXmodule
(
ModuleStoreTestCase
):
"""Base class for testing Xmodules with mongo store.
"""Base class for testing Xmodules with mongo store.
...
...
lms/djangoapps/courseware/tests/test_about.py
View file @
fcaa783e
...
@@ -11,7 +11,7 @@ from django.conf import settings
...
@@ -11,7 +11,7 @@ from django.conf import settings
from
.helpers
import
LoginEnrollmentTestCase
from
.helpers
import
LoginEnrollmentTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
courseware.tests.modulestore_config
import
TEST_DATA_MIXED_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO_MODULESTORE
,
TEST_DATA_M
IXED_MODULESTORE
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentAllowedFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentAllowedFactory
...
@@ -21,8 +21,12 @@ REG_STR = "<form id=\"class_enroll_form\" method=\"post\" data-remote=\"true\" a
...
@@ -21,8 +21,12 @@ REG_STR = "<form id=\"class_enroll_form\" method=\"post\" data-remote=\"true\" a
SHIB_ERROR_STR
=
"The currently logged-in user account does not have permission to enroll in this course."
SHIB_ERROR_STR
=
"The currently logged-in user account does not have permission to enroll in this course."
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
AboutTestCase
(
LoginEnrollmentTestCase
,
ModuleStoreTestCase
):
class
AboutTestCase
(
LoginEnrollmentTestCase
,
ModuleStoreTestCase
):
"""
Tests about xblock.
"""
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
self
.
about
=
ItemFactory
.
create
(
self
.
about
=
ItemFactory
.
create
(
...
@@ -87,7 +91,7 @@ class AboutTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
...
@@ -87,7 +91,7 @@ class AboutTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
self
.
assertIn
(
self
.
xml_data
,
resp
.
content
)
self
.
assertIn
(
self
.
xml_data
,
resp
.
content
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
AboutWithCappedEnrollmentsTestCase
(
LoginEnrollmentTestCase
,
ModuleStoreTestCase
):
class
AboutWithCappedEnrollmentsTestCase
(
LoginEnrollmentTestCase
,
ModuleStoreTestCase
):
"""
"""
This test case will check the About page when a course has a capped enrollment
This test case will check the About page when a course has a capped enrollment
...
@@ -137,7 +141,7 @@ class AboutWithCappedEnrollmentsTestCase(LoginEnrollmentTestCase, ModuleStoreTes
...
@@ -137,7 +141,7 @@ class AboutWithCappedEnrollmentsTestCase(LoginEnrollmentTestCase, ModuleStoreTes
self
.
assertNotIn
(
REG_STR
,
resp
.
content
)
self
.
assertNotIn
(
REG_STR
,
resp
.
content
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
AboutWithInvitationOnly
(
ModuleStoreTestCase
):
class
AboutWithInvitationOnly
(
ModuleStoreTestCase
):
"""
"""
This test case will check the About page when a course is invitation only.
This test case will check the About page when a course is invitation only.
...
@@ -184,7 +188,7 @@ class AboutWithInvitationOnly(ModuleStoreTestCase):
...
@@ -184,7 +188,7 @@ class AboutWithInvitationOnly(ModuleStoreTestCase):
@patch.dict
(
settings
.
FEATURES
,
{
'RESTRICT_ENROLL_BY_REG_METHOD'
:
True
})
@patch.dict
(
settings
.
FEATURES
,
{
'RESTRICT_ENROLL_BY_REG_METHOD'
:
True
})
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
AboutTestCaseShibCourse
(
LoginEnrollmentTestCase
,
ModuleStoreTestCase
):
class
AboutTestCaseShibCourse
(
LoginEnrollmentTestCase
,
ModuleStoreTestCase
):
"""
"""
Test cases covering about page behavior for courses that use shib enrollment domain ("shib courses")
Test cases covering about page behavior for courses that use shib enrollment domain ("shib courses")
...
@@ -223,7 +227,7 @@ class AboutTestCaseShibCourse(LoginEnrollmentTestCase, ModuleStoreTestCase):
...
@@ -223,7 +227,7 @@ class AboutTestCaseShibCourse(LoginEnrollmentTestCase, ModuleStoreTestCase):
self
.
assertIn
(
REG_STR
,
resp
.
content
)
self
.
assertIn
(
REG_STR
,
resp
.
content
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
AboutWithClosedEnrollment
(
ModuleStoreTestCase
):
class
AboutWithClosedEnrollment
(
ModuleStoreTestCase
):
"""
"""
This test case will check the About page for a course that has enrollment start/end
This test case will check the About page for a course that has enrollment start/end
...
...
lms/djangoapps/courseware/tests/test_access.py
View file @
fcaa783e
...
@@ -5,17 +5,15 @@ import mock
...
@@ -5,17 +5,15 @@ import mock
from
mock
import
Mock
from
mock
import
Mock
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
courseware.tests.factories
import
UserFactory
,
StaffFactory
,
InstructorFactory
from
courseware.tests.factories
import
UserFactory
,
StaffFactory
,
InstructorFactory
from
student.tests.factories
import
AnonymousUserFactory
,
CourseEnrollmentAllowedFactory
from
student.tests.factories
import
AnonymousUserFactory
,
CourseEnrollmentAllowedFactory
from
courseware.tests.tests
import
TEST_DATA_MIXED_MODULESTORE
import
pytz
import
pytz
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
# pylint: disable=C0111
# pylint: disable=protected-access
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
AccessTestCase
(
TestCase
):
class
AccessTestCase
(
TestCase
):
"""
"""
Tests for the various access controls on the student dashboard
Tests for the various access controls on the student dashboard
...
...
lms/djangoapps/dashboard/tests/test_sysadmin.py
View file @
fcaa783e
...
@@ -19,7 +19,7 @@ from django.utils.timezone import utc as UTC
...
@@ -19,7 +19,7 @@ from django.utils.timezone import utc as UTC
from
util.date_utils
import
get_time_display
,
DEFAULT_DATE_TIME_FORMAT
from
util.date_utils
import
get_time_display
,
DEFAULT_DATE_TIME_FORMAT
from
student.roles
import
CourseStaffRole
,
GlobalStaff
from
student.roles
import
CourseStaffRole
,
GlobalStaff
from
courseware.tests.modulestore_config
import
TEST_DATA_
XML_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_
DIR
from
dashboard.models
import
CourseImportLog
from
dashboard.models
import
CourseImportLog
from
dashboard.sysadmin
import
Users
from
dashboard.sysadmin
import
Users
from
dashboard.git_import
import
GitImportError
from
dashboard.git_import
import
GitImportError
...
@@ -31,6 +31,9 @@ from xmodule.modulestore.xml import XMLModuleStore
...
@@ -31,6 +31,9 @@ from xmodule.modulestore.xml import XMLModuleStore
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.tests.mongo_connection
import
MONGO_PORT_NUM
,
MONGO_HOST
from
xmodule.modulestore.tests.mongo_connection
import
MONGO_PORT_NUM
,
MONGO_HOST
from
xmodule.modulestore.tests.django_utils
import
xml_store_config
TEST_DATA_XML_MODULESTORE
=
xml_store_config
(
TEST_DATA_DIR
,
[
'empty'
])
TEST_MONGODB_LOG
=
{
TEST_MONGODB_LOG
=
{
'host'
:
MONGO_HOST
,
'host'
:
MONGO_HOST
,
...
...
lms/djangoapps/django_comment_client/base/tests.py
View file @
fcaa783e
...
@@ -10,7 +10,7 @@ from mock import patch, ANY, Mock
...
@@ -10,7 +10,7 @@ from mock import patch, ANY, Mock
from
nose.tools
import
assert_true
,
assert_equal
# pylint: disable=E0611
from
nose.tools
import
assert_true
,
assert_equal
# pylint: disable=E0611
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
django_comment_client.base
import
views
from
django_comment_client.base
import
views
from
django_comment_client.tests.group_id
import
CohortedTopicGroupIdTestMixin
,
NonCohortedTopicGroupIdTestMixin
,
GroupIdAssertionMixin
from
django_comment_client.tests.group_id
import
CohortedTopicGroupIdTestMixin
,
NonCohortedTopicGroupIdTestMixin
,
GroupIdAssertionMixin
from
django_comment_client.tests.utils
import
CohortedContentTestCase
from
django_comment_client.tests.utils
import
CohortedContentTestCase
...
@@ -27,6 +27,8 @@ log = logging.getLogger(__name__)
...
@@ -27,6 +27,8 @@ log = logging.getLogger(__name__)
CS_PREFIX
=
"http://localhost:4567/api/v1"
CS_PREFIX
=
"http://localhost:4567/api/v1"
# pylint: disable=C0111
class
MockRequestSetupMixin
(
object
):
class
MockRequestSetupMixin
(
object
):
def
_create_response_mock
(
self
,
data
):
def
_create_response_mock
(
self
,
data
):
...
@@ -160,7 +162,7 @@ class ThreadActionGroupIdTestCase(
...
@@ -160,7 +162,7 @@ class ThreadActionGroupIdTestCase(
)
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
@patch
(
'lms.lib.comment_client.utils.requests.request'
)
@patch
(
'lms.lib.comment_client.utils.requests.request'
)
class
ViewsTestCase
(
UrlResetMixin
,
ModuleStoreTestCase
,
MockRequestSetupMixin
):
class
ViewsTestCase
(
UrlResetMixin
,
ModuleStoreTestCase
,
MockRequestSetupMixin
):
...
@@ -748,7 +750,7 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
...
@@ -748,7 +750,7 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
@patch
(
"lms.lib.comment_client.utils.requests.request"
)
@patch
(
"lms.lib.comment_client.utils.requests.request"
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
ViewPermissionsTestCase
(
UrlResetMixin
,
ModuleStoreTestCase
,
MockRequestSetupMixin
):
class
ViewPermissionsTestCase
(
UrlResetMixin
,
ModuleStoreTestCase
,
MockRequestSetupMixin
):
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -842,7 +844,7 @@ class ViewPermissionsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSet
...
@@ -842,7 +844,7 @@ class ViewPermissionsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSet
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
CreateThreadUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
class
CreateThreadUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
...
@@ -864,7 +866,7 @@ class CreateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq
...
@@ -864,7 +866,7 @@ class CreateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"title"
],
text
)
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"title"
],
text
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
UpdateThreadUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
class
UpdateThreadUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
...
@@ -892,7 +894,7 @@ class UpdateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq
...
@@ -892,7 +894,7 @@ class UpdateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"commentable_id"
],
"test_commentable"
)
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"commentable_id"
],
"test_commentable"
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
CreateCommentUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
class
CreateCommentUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
...
@@ -915,7 +917,7 @@ class CreateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRe
...
@@ -915,7 +917,7 @@ class CreateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRe
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"body"
],
text
)
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"body"
],
text
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
UpdateCommentUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
class
UpdateCommentUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
...
@@ -939,7 +941,7 @@ class UpdateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRe
...
@@ -939,7 +941,7 @@ class UpdateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRe
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"body"
],
text
)
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"body"
],
text
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
CreateSubCommentUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
class
CreateSubCommentUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
,
MockRequestSetupMixin
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
...
@@ -963,7 +965,7 @@ class CreateSubCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, Moc
...
@@ -963,7 +965,7 @@ class CreateSubCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, Moc
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"body"
],
text
)
self
.
assertEqual
(
mock_request
.
call_args
[
1
][
"data"
][
"body"
],
text
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
UsersEndpointTestCase
(
ModuleStoreTestCase
,
MockRequestSetupMixin
):
class
UsersEndpointTestCase
(
ModuleStoreTestCase
,
MockRequestSetupMixin
):
def
set_post_counts
(
self
,
mock_request
,
threads_count
=
1
,
comments_count
=
1
):
def
set_post_counts
(
self
,
mock_request
,
threads_count
=
1
,
comments_count
=
1
):
...
...
lms/djangoapps/django_comment_client/forum/tests.py
View file @
fcaa783e
...
@@ -7,7 +7,7 @@ from django.test.client import Client, RequestFactory
...
@@ -7,7 +7,7 @@ from django.test.client import Client, RequestFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
from
edxmako.tests
import
mako_middleware_process_request
from
edxmako.tests
import
mako_middleware_process_request
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
,
mixed_store_config
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
util.testing
import
UrlResetMixin
from
util.testing
import
UrlResetMixin
from
django_comment_client.tests.group_id
import
(
from
django_comment_client.tests.group_id
import
(
...
@@ -19,17 +19,21 @@ from django_comment_client.tests.utils import CohortedContentTestCase
...
@@ -19,17 +19,21 @@ from django_comment_client.tests.utils import CohortedContentTestCase
from
django_comment_client.forum
import
views
from
django_comment_client.forum
import
views
from
django_comment_client.utils
import
strip_none
from
django_comment_client.utils
import
strip_none
from
courseware.tests.modulestore_config
import
TEST_DATA_
MIXED_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_
DIR
from
courseware.courses
import
UserNotEnrolled
from
courseware.courses
import
UserNotEnrolled
from
nose.tools
import
assert_true
# pylint: disable=E0611
from
nose.tools
import
assert_true
# pylint: disable=E0611
from
mock
import
patch
,
Mock
,
ANY
,
call
from
mock
import
patch
,
Mock
,
ANY
,
call
from
course_groups.models
import
CourseUserGroup
from
course_groups.models
import
CourseUserGroup
TEST_DATA_MONGO_MODULESTORE
=
mixed_store_config
(
TEST_DATA_DIR
,
{},
include_xml
=
False
)
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
# pylint: disable=C0111
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
ViewsExceptionTestCase
(
UrlResetMixin
,
ModuleStoreTestCase
):
class
ViewsExceptionTestCase
(
UrlResetMixin
,
ModuleStoreTestCase
):
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
...
@@ -167,7 +171,7 @@ class PartialDictMatcher(object):
...
@@ -167,7 +171,7 @@ class PartialDictMatcher(object):
])
])
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
@patch
(
'requests.request'
)
@patch
(
'requests.request'
)
class
SingleThreadTestCase
(
ModuleStoreTestCase
):
class
SingleThreadTestCase
(
ModuleStoreTestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -276,7 +280,7 @@ class SingleThreadTestCase(ModuleStoreTestCase):
...
@@ -276,7 +280,7 @@ class SingleThreadTestCase(ModuleStoreTestCase):
)
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
@patch
(
'requests.request'
)
@patch
(
'requests.request'
)
class
SingleCohortedThreadTestCase
(
CohortedContentTestCase
):
class
SingleCohortedThreadTestCase
(
CohortedContentTestCase
):
def
_create_mock_cohorted_thread
(
self
,
mock_request
):
def
_create_mock_cohorted_thread
(
self
,
mock_request
):
...
@@ -768,7 +772,7 @@ class FollowedThreadsDiscussionGroupIdTestCase(CohortedContentTestCase, Cohorted
...
@@ -768,7 +772,7 @@ class FollowedThreadsDiscussionGroupIdTestCase(CohortedContentTestCase, Cohorted
)
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
InlineDiscussionTestCase
(
ModuleStoreTestCase
):
class
InlineDiscussionTestCase
(
ModuleStoreTestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
(
org
=
"TestX"
,
number
=
"101"
,
display_name
=
"Test Course"
)
self
.
course
=
CourseFactory
.
create
(
org
=
"TestX"
,
number
=
"101"
,
display_name
=
"Test Course"
)
...
@@ -798,7 +802,7 @@ class InlineDiscussionTestCase(ModuleStoreTestCase):
...
@@ -798,7 +802,7 @@ class InlineDiscussionTestCase(ModuleStoreTestCase):
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"courseware_title"
],
expected_courseware_title
)
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"courseware_title"
],
expected_courseware_title
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
@patch
(
'requests.request'
)
@patch
(
'requests.request'
)
class
UserProfileTestCase
(
ModuleStoreTestCase
):
class
UserProfileTestCase
(
ModuleStoreTestCase
):
...
@@ -910,7 +914,7 @@ class UserProfileTestCase(ModuleStoreTestCase):
...
@@ -910,7 +914,7 @@ class UserProfileTestCase(ModuleStoreTestCase):
self
.
assertEqual
(
response
.
status_code
,
405
)
self
.
assertEqual
(
response
.
status_code
,
405
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
@patch
(
'requests.request'
)
@patch
(
'requests.request'
)
class
CommentsServiceRequestHeadersTestCase
(
UrlResetMixin
,
ModuleStoreTestCase
):
class
CommentsServiceRequestHeadersTestCase
(
UrlResetMixin
,
ModuleStoreTestCase
):
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
...
@@ -971,7 +975,7 @@ class CommentsServiceRequestHeadersTestCase(UrlResetMixin, ModuleStoreTestCase):
...
@@ -971,7 +975,7 @@ class CommentsServiceRequestHeadersTestCase(UrlResetMixin, ModuleStoreTestCase):
self
.
assert_all_calls_have_header
(
mock_request
,
"X-Edx-Api-Key"
,
"test_api_key"
)
self
.
assert_all_calls_have_header
(
mock_request
,
"X-Edx-Api-Key"
,
"test_api_key"
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
InlineDiscussionUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
):
class
InlineDiscussionUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
...
@@ -991,7 +995,7 @@ class InlineDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
...
@@ -991,7 +995,7 @@ class InlineDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"body"
],
text
)
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"body"
],
text
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
ForumFormDiscussionUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
):
class
ForumFormDiscussionUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
...
@@ -1011,7 +1015,8 @@ class ForumFormDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
...
@@ -1011,7 +1015,8 @@ class ForumFormDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"title"
],
text
)
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"title"
],
text
)
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"body"
],
text
)
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"body"
],
text
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MONGO_MODULESTORE
)
class
ForumDiscussionSearchUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
):
class
ForumDiscussionSearchUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
...
@@ -1035,7 +1040,8 @@ class ForumDiscussionSearchUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin
...
@@ -1035,7 +1040,8 @@ class ForumDiscussionSearchUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"title"
],
text
)
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"title"
],
text
)
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"body"
],
text
)
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"body"
],
text
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MONGO_MODULESTORE
)
class
SingleThreadUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
):
class
SingleThreadUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
...
@@ -1057,7 +1063,7 @@ class SingleThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
...
@@ -1057,7 +1063,7 @@ class SingleThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
self
.
assertEqual
(
response_data
[
"content"
][
"body"
],
text
)
self
.
assertEqual
(
response_data
[
"content"
][
"body"
],
text
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
UserProfileUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
):
class
UserProfileUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
...
@@ -1078,7 +1084,7 @@ class UserProfileUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
...
@@ -1078,7 +1084,7 @@ class UserProfileUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"body"
],
text
)
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"body"
],
text
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
FollowedThreadsUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
):
class
FollowedThreadsUnicodeTestCase
(
ModuleStoreTestCase
,
UnicodeTestMixin
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
course
=
CourseFactory
.
create
()
...
@@ -1099,7 +1105,7 @@ class FollowedThreadsUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
...
@@ -1099,7 +1105,7 @@ class FollowedThreadsUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"body"
],
text
)
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"body"
],
text
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
EnrollmentTestCase
(
ModuleStoreTestCase
):
class
EnrollmentTestCase
(
ModuleStoreTestCase
):
"""
"""
Tests for the behavior of views depending on if the student is enrolled
Tests for the behavior of views depending on if the student is enrolled
...
...
lms/djangoapps/instructor/tests/test_access.py
View file @
fcaa783e
...
@@ -8,7 +8,7 @@ from xmodule.modulestore.tests.factories import CourseFactory
...
@@ -8,7 +8,7 @@ from xmodule.modulestore.tests.factories import CourseFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
student.roles
import
CourseBetaTesterRole
,
CourseStaffRole
from
student.roles
import
CourseBetaTesterRole
,
CourseStaffRole
from
django_comment_common.models
import
(
Role
,
from
django_comment_common.models
import
(
Role
,
...
@@ -19,7 +19,7 @@ from instructor.access import (allow_access,
...
@@ -19,7 +19,7 @@ from instructor.access import (allow_access,
update_forum_role
)
update_forum_role
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAccessList
(
ModuleStoreTestCase
):
class
TestInstructorAccessList
(
ModuleStoreTestCase
):
""" Test access listings. """
""" Test access listings. """
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -41,7 +41,7 @@ class TestInstructorAccessList(ModuleStoreTestCase):
...
@@ -41,7 +41,7 @@ class TestInstructorAccessList(ModuleStoreTestCase):
self
.
assertEqual
(
set
(
beta_testers
),
set
(
self
.
beta_testers
))
self
.
assertEqual
(
set
(
beta_testers
),
set
(
self
.
beta_testers
))
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAccessAllow
(
ModuleStoreTestCase
):
class
TestInstructorAccessAllow
(
ModuleStoreTestCase
):
""" Test access allow. """
""" Test access allow. """
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -75,7 +75,7 @@ class TestInstructorAccessAllow(ModuleStoreTestCase):
...
@@ -75,7 +75,7 @@ class TestInstructorAccessAllow(ModuleStoreTestCase):
allow_access
(
self
.
course
,
user
,
'staff'
)
allow_access
(
self
.
course
,
user
,
'staff'
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAccessRevoke
(
ModuleStoreTestCase
):
class
TestInstructorAccessRevoke
(
ModuleStoreTestCase
):
""" Test access revoke. """
""" Test access revoke. """
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -109,7 +109,7 @@ class TestInstructorAccessRevoke(ModuleStoreTestCase):
...
@@ -109,7 +109,7 @@ class TestInstructorAccessRevoke(ModuleStoreTestCase):
revoke_access
(
self
.
course
,
user
,
'robot-not-a-level'
)
revoke_access
(
self
.
course
,
user
,
'robot-not-a-level'
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAccessForum
(
ModuleStoreTestCase
):
class
TestInstructorAccessForum
(
ModuleStoreTestCase
):
"""
"""
Test forum access control.
Test forum access control.
...
...
lms/djangoapps/instructor/tests/test_api.py
View file @
fcaa783e
...
@@ -25,7 +25,7 @@ from django.utils.timezone import utc
...
@@ -25,7 +25,7 @@ from django.utils.timezone import utc
from
django.test
import
RequestFactory
from
django.test
import
RequestFactory
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
...
@@ -136,7 +136,7 @@ class TestCommonExceptions400(unittest.TestCase):
...
@@ -136,7 +136,7 @@ class TestCommonExceptions400(unittest.TestCase):
self
.
assertIn
(
"Task is already running"
,
result
[
"error"
])
self
.
assertIn
(
"Task is already running"
,
result
[
"error"
])
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
@patch.dict
(
settings
.
FEATURES
,
{
'ENABLE_INSTRUCTOR_EMAIL'
:
True
,
'REQUIRE_COURSE_EMAIL_AUTH'
:
False
})
@patch.dict
(
settings
.
FEATURES
,
{
'ENABLE_INSTRUCTOR_EMAIL'
:
True
,
'REQUIRE_COURSE_EMAIL_AUTH'
:
False
})
class
TestInstructorAPIDenyLevels
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorAPIDenyLevels
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
...
@@ -291,7 +291,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -291,7 +291,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
)
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
@patch.dict
(
settings
.
FEATURES
,
{
'ALLOW_AUTOMATED_SIGNUPS'
:
True
})
@patch.dict
(
settings
.
FEATURES
,
{
'ALLOW_AUTOMATED_SIGNUPS'
:
True
})
class
TestInstructorAPIBulkAccountCreationAndEnrollment
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorAPIBulkAccountCreationAndEnrollment
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
...
@@ -528,7 +528,7 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(ModuleStoreTestCase, Log
...
@@ -528,7 +528,7 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(ModuleStoreTestCase, Log
@ddt.ddt
@ddt.ddt
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAPIEnrollment
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorAPIEnrollment
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
Test enrollment modification endpoint.
Test enrollment modification endpoint.
...
@@ -1052,7 +1052,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -1052,7 +1052,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
@ddt.ddt
@ddt.ddt
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAPIBulkBetaEnrollment
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorAPIBulkBetaEnrollment
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
Test bulk beta modify access endpoint.
Test bulk beta modify access endpoint.
...
@@ -1365,7 +1365,7 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
...
@@ -1365,7 +1365,7 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
)
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAPILevelsAccess
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorAPILevelsAccess
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
Test endpoints whereby instructors can change permissions
Test endpoints whereby instructors can change permissions
...
@@ -1603,7 +1603,7 @@ class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase
...
@@ -1603,7 +1603,7 @@ class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase
@ddt.ddt
@ddt.ddt
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAPILevelsDataDump
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorAPILevelsDataDump
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
Test endpoints that show data without side effects.
Test endpoints that show data without side effects.
...
@@ -2046,7 +2046,7 @@ class TestInstructorAPILevelsDataDump(ModuleStoreTestCase, LoginEnrollmentTestCa
...
@@ -2046,7 +2046,7 @@ class TestInstructorAPILevelsDataDump(ModuleStoreTestCase, LoginEnrollmentTestCa
self
.
assertEqual
(
response
.
status_code
,
400
)
self
.
assertEqual
(
response
.
status_code
,
400
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAPIRegradeTask
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorAPIRegradeTask
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
Test endpoints whereby instructors can change student grades.
Test endpoints whereby instructors can change student grades.
...
@@ -2186,7 +2186,7 @@ class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase)
...
@@ -2186,7 +2186,7 @@ class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase)
self
.
assertTrue
(
act
.
called
)
self
.
assertTrue
(
act
.
called
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
@patch.dict
(
settings
.
FEATURES
,
{
'ENABLE_INSTRUCTOR_EMAIL'
:
True
,
'REQUIRE_COURSE_EMAIL_AUTH'
:
False
})
@patch.dict
(
settings
.
FEATURES
,
{
'ENABLE_INSTRUCTOR_EMAIL'
:
True
,
'REQUIRE_COURSE_EMAIL_AUTH'
:
False
})
class
TestInstructorSendEmail
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorSendEmail
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
...
@@ -2268,7 +2268,7 @@ class MockCompletionInfo(object):
...
@@ -2268,7 +2268,7 @@ class MockCompletionInfo(object):
return
False
,
'Task Errored In Some Way'
return
False
,
'Task Errored In Some Way'
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAPITaskLists
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorAPITaskLists
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
Test instructor task list endpoint.
Test instructor task list endpoint.
...
@@ -2430,7 +2430,7 @@ class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -2430,7 +2430,7 @@ class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
assertEqual
(
actual_tasks
,
expected_tasks
)
self
.
assertEqual
(
actual_tasks
,
expected_tasks
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
@patch.object
(
instructor_task
.
api
,
'get_instructor_task_history'
)
@patch.object
(
instructor_task
.
api
,
'get_instructor_task_history'
)
class
TestInstructorEmailContentList
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorEmailContentList
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
...
@@ -2566,7 +2566,7 @@ class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCas
...
@@ -2566,7 +2566,7 @@ class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCas
@ddt.ddt
@ddt.ddt
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
@override_settings
(
ANALYTICS_SERVER_URL
=
"http://robotanalyticsserver.netbot:900/"
)
@override_settings
(
ANALYTICS_SERVER_URL
=
"http://robotanalyticsserver.netbot:900/"
)
@override_settings
(
ANALYTICS_API_KEY
=
"robot_api_key"
)
@override_settings
(
ANALYTICS_API_KEY
=
"robot_api_key"
)
class
TestInstructorAPIAnalyticsProxy
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorAPIAnalyticsProxy
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
...
@@ -2748,7 +2748,7 @@ class TestInstructorAPIHelpers(TestCase):
...
@@ -2748,7 +2748,7 @@ class TestInstructorAPIHelpers(TestCase):
msk_from_problem_urlname
(
*
args
)
msk_from_problem_urlname
(
*
args
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestDueDateExtensions
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestDueDateExtensions
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
Test data dumps for reporting.
Test data dumps for reporting.
...
@@ -2937,7 +2937,7 @@ class TestDueDateExtensions(ModuleStoreTestCase, LoginEnrollmentTestCase):
...
@@ -2937,7 +2937,7 @@ class TestDueDateExtensions(ModuleStoreTestCase, LoginEnrollmentTestCase):
self
.
user1
.
profile
.
name
,
self
.
user1
.
username
)})
self
.
user1
.
profile
.
name
,
self
.
user1
.
username
)})
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
@override_settings
(
REGISTRATION_CODE_LENGTH
=
8
)
@override_settings
(
REGISTRATION_CODE_LENGTH
=
8
)
class
TestCourseRegistrationCodes
(
ModuleStoreTestCase
):
class
TestCourseRegistrationCodes
(
ModuleStoreTestCase
):
"""
"""
...
...
lms/djangoapps/instructor/tests/test_email.py
View file @
fcaa783e
...
@@ -13,7 +13,7 @@ from courseware.tests.tests import TEST_DATA_MONGO_MODULESTORE
...
@@ -13,7 +13,7 @@ from courseware.tests.tests import TEST_DATA_MONGO_MODULESTORE
from
student.tests.factories
import
AdminFactory
from
student.tests.factories
import
AdminFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
mock
import
patch
from
mock
import
patch
...
@@ -110,7 +110,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase):
...
@@ -110,7 +110,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase):
self
.
assertFalse
(
self
.
email_link
in
response
.
content
)
self
.
assertFalse
(
self
.
email_link
in
response
.
content
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestNewInstructorDashboardEmailViewXMLBacked
(
ModuleStoreTestCase
):
class
TestNewInstructorDashboardEmailViewXMLBacked
(
ModuleStoreTestCase
):
"""
"""
Check for email view on the new instructor dashboard
Check for email view on the new instructor dashboard
...
...
lms/djangoapps/instructor/tests/test_enrollment.py
View file @
fcaa783e
...
@@ -11,7 +11,7 @@ from django.test import TestCase
...
@@ -11,7 +11,7 @@ from django.test import TestCase
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
student.models
import
CourseEnrollment
,
CourseEnrollmentAllowed
from
student.models
import
CourseEnrollment
,
CourseEnrollmentAllowed
from
instructor.enrollment
import
(
from
instructor.enrollment
import
(
...
@@ -286,7 +286,7 @@ class TestInstructorUnenrollDB(TestEnrollmentChangeBase):
...
@@ -286,7 +286,7 @@ class TestInstructorUnenrollDB(TestEnrollmentChangeBase):
return
self
.
_run_state_change_test
(
before_ideal
,
after_ideal
,
action
)
return
self
.
_run_state_change_test
(
before_ideal
,
after_ideal
,
action
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorEnrollmentStudentModule
(
TestCase
):
class
TestInstructorEnrollmentStudentModule
(
TestCase
):
""" Test student module manipulations. """
""" Test student module manipulations. """
def
setUp
(
self
):
def
setUp
(
self
):
...
@@ -431,7 +431,7 @@ class TestSendBetaRoleEmail(TestCase):
...
@@ -431,7 +431,7 @@ class TestSendBetaRoleEmail(TestCase):
send_beta_role_email
(
bad_action
,
self
.
user
,
self
.
email_params
)
send_beta_role_email
(
bad_action
,
self
.
user
,
self
.
email_params
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestGetEmailParams
(
ModuleStoreTestCase
):
class
TestGetEmailParams
(
ModuleStoreTestCase
):
"""
"""
Test what URLs the function get_email_params returns under different
Test what URLs the function get_email_params returns under different
...
...
lms/djangoapps/instructor/tests/test_hint_manager.py
View file @
fcaa783e
...
@@ -6,14 +6,16 @@ from mock import patch, MagicMock
...
@@ -6,14 +6,16 @@ from mock import patch, MagicMock
from
courseware.models
import
XModuleUserStateSummaryField
from
courseware.models
import
XModuleUserStateSummaryField
from
courseware.tests.factories
import
UserStateSummaryFactory
from
courseware.tests.factories
import
UserStateSummaryFactory
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
import
instructor.hint_manager
as
view
import
instructor.hint_manager
as
view
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
# pylint: disable=C0111
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MONGO_MODULESTORE
)
class
HintManagerTest
(
ModuleStoreTestCase
):
class
HintManagerTest
(
ModuleStoreTestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
...
...
lms/djangoapps/instructor/tests/test_legacy_anon_csv.py
View file @
fcaa783e
...
@@ -16,17 +16,16 @@ from django.contrib.auth.models import User
...
@@ -16,17 +16,16 @@ from django.contrib.auth.models import User
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
import
instructor.views.legacy
import
instructor.views.legacy
from
student.roles
import
CourseStaffRole
from
student.roles
import
CourseStaffRole
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.django
import
modulestore
,
clear_existing_modulestores
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
mock
import
Mock
,
patch
from
mock
import
Mock
,
patch
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorDashboardAnonCSV
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorDashboardAnonCSV
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
'''
'''
Check for download of csv
Check for download of csv
...
@@ -34,8 +33,8 @@ class TestInstructorDashboardAnonCSV(ModuleStoreTestCase, LoginEnrollmentTestCas
...
@@ -34,8 +33,8 @@ class TestInstructorDashboardAnonCSV(ModuleStoreTestCase, LoginEnrollmentTestCas
# Note -- I copied this setUp from a similar test
# Note -- I copied this setUp from a similar test
def
setUp
(
self
):
def
setUp
(
self
):
clear_existing_modulestores
()
#
clear_existing_modulestores()
self
.
toy
=
modulestore
()
.
get_course
(
SlashSeparatedCourseKey
(
"edX"
,
"toy"
,
"2012_Fall"
)
)
self
.
toy
=
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'toy'
,
display_name
=
'2012_Fall'
)
# Create two accounts
# Create two accounts
self
.
student
=
'view@test.com'
self
.
student
=
'view@test.com'
...
...
lms/djangoapps/instructor/tests/test_legacy_download_csv.py
View file @
fcaa783e
...
@@ -16,22 +16,21 @@ from django.contrib.auth.models import User
...
@@ -16,22 +16,21 @@ from django.contrib.auth.models import User
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
student.roles
import
CourseStaffRole
from
student.roles
import
CourseStaffRole
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.django
import
modulestore
,
clear_existing_modulestores
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorDashboardGradeDownloadCSV
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorDashboardGradeDownloadCSV
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
'''
'''
Check for download of csv
Check for download of csv
'''
'''
def
setUp
(
self
):
def
setUp
(
self
):
clear_existing_modulestores
()
#
clear_existing_modulestores()
self
.
toy
=
modulestore
()
.
get_course
(
SlashSeparatedCourseKey
(
"edX"
,
"toy"
,
"2012_Fall"
)
)
self
.
toy
=
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'toy'
,
display_name
=
'2012_Fall'
)
# Create two accounts
# Create two accounts
self
.
student
=
'view@test.com'
self
.
student
=
'view@test.com'
...
...
lms/djangoapps/instructor/tests/test_legacy_enrollment.py
View file @
fcaa783e
...
@@ -10,7 +10,7 @@ from django.test.utils import override_settings
...
@@ -10,7 +10,7 @@ from django.test.utils import override_settings
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
,
AdminFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
,
AdminFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
...
@@ -22,7 +22,7 @@ USER_COUNT = 4
...
@@ -22,7 +22,7 @@ USER_COUNT = 4
@ddt.ddt
@ddt.ddt
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorEnrollsStudent
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorEnrollsStudent
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
Check Enrollment/Unenrollment with/without auto-enrollment on activation and with/without email notification
Check Enrollment/Unenrollment with/without auto-enrollment on activation and with/without email notification
...
...
lms/djangoapps/instructor/tests/test_legacy_forum_admin.py
View file @
fcaa783e
...
@@ -14,11 +14,10 @@ from django_comment_common.models import Role, FORUM_ROLE_ADMINISTRATOR, \
...
@@ -14,11 +14,10 @@ from django_comment_common.models import Role, FORUM_ROLE_ADMINISTRATOR, \
from
django_comment_client.utils
import
has_forum_access
from
django_comment_client.utils
import
has_forum_access
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
student.roles
import
CourseStaffRole
from
student.roles
import
CourseStaffRole
from
xmodule.modulestore.django
import
modulestore
,
clear_existing_modulestores
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
FORUM_ROLES
=
[
FORUM_ROLE_ADMINISTRATOR
,
FORUM_ROLE_MODERATOR
,
FORUM_ROLE_COMMUNITY_TA
]
FORUM_ROLES
=
[
FORUM_ROLE_ADMINISTRATOR
,
FORUM_ROLE_MODERATOR
,
FORUM_ROLE_COMMUNITY_TA
]
...
@@ -33,18 +32,14 @@ def action_name(operation, rolename):
...
@@ -33,18 +32,14 @@ def action_name(operation, rolename):
return
'{0} forum {1}'
.
format
(
operation
,
FORUM_ADMIN_ACTION_SUFFIX
[
rolename
])
return
'{0} forum {1}'
.
format
(
operation
,
FORUM_ADMIN_ACTION_SUFFIX
[
rolename
])
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorDashboardForumAdmin
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
TestInstructorDashboardForumAdmin
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
'''
'''
Check for change in forum admin role memberships
Check for change in forum admin role memberships
'''
'''
def
setUp
(
self
):
def
setUp
(
self
):
clear_existing_modulestores
()
self
.
toy
=
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'toy'
,
display_name
=
'2012_Fall'
)
courses
=
modulestore
()
.
get_courses
()
self
.
course_id
=
SlashSeparatedCourseKey
(
"edX"
,
"toy"
,
"2012_Fall"
)
self
.
toy
=
modulestore
()
.
get_course
(
self
.
course_id
)
# Create two accounts
# Create two accounts
self
.
student
=
'view@test.com'
self
.
student
=
'view@test.com'
...
...
lms/djangoapps/instructor/tests/test_legacy_reset.py
View file @
fcaa783e
...
@@ -8,7 +8,7 @@ from django.test.utils import override_settings
...
@@ -8,7 +8,7 @@ from django.test.utils import override_settings
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
student.tests.factories
import
UserFactory
,
AdminFactory
,
CourseEnrollmentFactory
from
student.tests.factories
import
UserFactory
,
AdminFactory
,
CourseEnrollmentFactory
...
@@ -18,7 +18,7 @@ from submissions import api as sub_api
...
@@ -18,7 +18,7 @@ from submissions import api as sub_api
from
student.models
import
anonymous_id_for_user
from
student.models
import
anonymous_id_for_user
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
InstructorResetStudentStateTest
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
class
InstructorResetStudentStateTest
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
"""
Reset student state from the legacy instructor dash.
Reset student state from the legacy instructor dash.
...
...
lms/djangoapps/instructor/tests/test_legacy_xss.py
View file @
fcaa783e
...
@@ -7,7 +7,7 @@ from django.test.client import RequestFactory
...
@@ -7,7 +7,7 @@ from django.test.client import RequestFactory
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
markupsafe
import
escape
from
markupsafe
import
escape
from
courseware.tests.tests
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.tests
import
TEST_DATA_M
ONGO
_MODULESTORE
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
from
edxmako.tests
import
mako_middleware_process_request
from
edxmako.tests
import
mako_middleware_process_request
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
...
@@ -15,8 +15,10 @@ from xmodule.modulestore.tests.factories import CourseFactory
...
@@ -15,8 +15,10 @@ from xmodule.modulestore.tests.factories import CourseFactory
from
instructor.views
import
legacy
from
instructor.views
import
legacy
# pylint: disable=C0111
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MONGO_MODULESTORE
)
class
TestXss
(
ModuleStoreTestCase
):
class
TestXss
(
ModuleStoreTestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
_request_factory
=
RequestFactory
()
self
.
_request_factory
=
RequestFactory
()
...
...
lms/djangoapps/instructor/tests/test_spoc_gradebook.py
View file @
fcaa783e
...
@@ -7,7 +7,7 @@ from django.core.urlresolvers import reverse
...
@@ -7,7 +7,7 @@ from django.core.urlresolvers import reverse
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
,
AdminFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
,
AdminFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
courseware.tests.tests
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.tests
import
TEST_DATA_M
ONGO
_MODULESTORE
from
capa.tests.response_xml_factory
import
StringResponseXMLFactory
from
capa.tests.response_xml_factory
import
StringResponseXMLFactory
from
courseware.tests.factories
import
StudentModuleFactory
from
courseware.tests.factories
import
StudentModuleFactory
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
...
@@ -16,7 +16,7 @@ from xmodule.modulestore.django import modulestore
...
@@ -16,7 +16,7 @@ from xmodule.modulestore.django import modulestore
USER_COUNT
=
11
USER_COUNT
=
11
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestGradebook
(
ModuleStoreTestCase
):
class
TestGradebook
(
ModuleStoreTestCase
):
"""
"""
Test functionality of the spoc gradebook. Sets up a course with assignments and
Test functionality of the spoc gradebook. Sets up a course with assignments and
...
...
lms/djangoapps/instructor/tests/test_tools.py
View file @
fcaa783e
...
@@ -12,7 +12,7 @@ from django.test.utils import override_settings
...
@@ -12,7 +12,7 @@ from django.test.utils import override_settings
from
django.utils.timezone
import
utc
from
django.utils.timezone
import
utc
from
courseware.models
import
StudentModule
from
courseware.models
import
StudentModule
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
from
xmodule.fields
import
Date
from
xmodule.fields
import
Date
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
...
@@ -97,7 +97,7 @@ class TestParseDatetime(unittest.TestCase):
...
@@ -97,7 +97,7 @@ class TestParseDatetime(unittest.TestCase):
tools
.
parse_datetime
(
'foo'
)
tools
.
parse_datetime
(
'foo'
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestFindUnit
(
ModuleStoreTestCase
):
class
TestFindUnit
(
ModuleStoreTestCase
):
"""
"""
Test the find_unit function.
Test the find_unit function.
...
@@ -130,7 +130,7 @@ class TestFindUnit(ModuleStoreTestCase):
...
@@ -130,7 +130,7 @@ class TestFindUnit(ModuleStoreTestCase):
tools
.
find_unit
(
self
.
course
,
url
)
tools
.
find_unit
(
self
.
course
,
url
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestGetUnitsWithDueDate
(
ModuleStoreTestCase
):
class
TestGetUnitsWithDueDate
(
ModuleStoreTestCase
):
"""
"""
Test the get_units_with_due_date function.
Test the get_units_with_due_date function.
...
@@ -178,7 +178,7 @@ class TestTitleOrUrl(unittest.TestCase):
...
@@ -178,7 +178,7 @@ class TestTitleOrUrl(unittest.TestCase):
self
.
assertEquals
(
tools
.
title_or_url
(
unit
),
'test:hello'
)
self
.
assertEquals
(
tools
.
title_or_url
(
unit
),
'test:hello'
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestSetDueDateExtension
(
ModuleStoreTestCase
):
class
TestSetDueDateExtension
(
ModuleStoreTestCase
):
"""
"""
Test the set_due_date_extensions function.
Test the set_due_date_extensions function.
...
@@ -252,7 +252,7 @@ class TestSetDueDateExtension(ModuleStoreTestCase):
...
@@ -252,7 +252,7 @@ class TestSetDueDateExtension(ModuleStoreTestCase):
self
.
assertEqual
(
self
.
extended_due
(
self
.
homework
),
None
)
self
.
assertEqual
(
self
.
extended_due
(
self
.
homework
),
None
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestDataDumps
(
ModuleStoreTestCase
):
class
TestDataDumps
(
ModuleStoreTestCase
):
"""
"""
Test data dumps for reporting.
Test data dumps for reporting.
...
...
lms/djangoapps/instructor_task/tests/test_base.py
View file @
fcaa783e
...
@@ -21,7 +21,7 @@ from opaque_keys.edx.locations import Location, SlashSeparatedCourseKey
...
@@ -21,7 +21,7 @@ from opaque_keys.edx.locations import Location, SlashSeparatedCourseKey
from
student.tests.factories
import
CourseEnrollmentFactory
,
UserFactory
from
student.tests.factories
import
CourseEnrollmentFactory
,
UserFactory
from
courseware.model_data
import
StudentModule
from
courseware.model_data
import
StudentModule
from
courseware.tests.tests
import
LoginEnrollmentTestCase
,
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.tests
import
LoginEnrollmentTestCase
,
TEST_DATA_M
ONGO
_MODULESTORE
from
instructor_task.api_helper
import
encode_problem_and_student_input
from
instructor_task.api_helper
import
encode_problem_and_student_input
from
instructor_task.models
import
PROGRESS
,
QUEUING
from
instructor_task.models
import
PROGRESS
,
QUEUING
...
@@ -95,7 +95,7 @@ class InstructorTaskTestCase(TestCase):
...
@@ -95,7 +95,7 @@ class InstructorTaskTestCase(TestCase):
return
self
.
_create_entry
(
task_state
=
task_state
,
task_output
=
progress
,
student
=
student
)
return
self
.
_create_entry
(
task_state
=
task_state
,
task_output
=
progress
,
student
=
student
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
InstructorTaskCourseTestCase
(
LoginEnrollmentTestCase
,
ModuleStoreTestCase
):
class
InstructorTaskCourseTestCase
(
LoginEnrollmentTestCase
,
ModuleStoreTestCase
):
"""
"""
Base test class for InstructorTask-related tests that require
Base test class for InstructorTask-related tests that require
...
@@ -168,7 +168,7 @@ class InstructorTaskCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase)
...
@@ -168,7 +168,7 @@ class InstructorTaskCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase)
return
request
return
request
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
InstructorTaskModuleTestCase
(
InstructorTaskCourseTestCase
):
class
InstructorTaskModuleTestCase
(
InstructorTaskCourseTestCase
):
"""
"""
Base test class for InstructorTask-related tests that require
Base test class for InstructorTask-related tests that require
...
...
lms/djangoapps/licenses/tests.py
View file @
fcaa783e
...
@@ -15,7 +15,7 @@ from django.core.management import call_command
...
@@ -15,7 +15,7 @@ from django.core.management import call_command
from
django.core.urlresolvers
import
reverse
from
django.core.urlresolvers
import
reverse
from
nose.tools
import
assert_true
# pylint: disable=E0611
from
nose.tools
import
assert_true
# pylint: disable=E0611
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
licenses.models
import
CourseSoftware
,
UserLicense
from
licenses.models
import
CourseSoftware
,
UserLicense
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
...
@@ -144,7 +144,7 @@ class LicenseTestCase(TestCase):
...
@@ -144,7 +144,7 @@ class LicenseTestCase(TestCase):
self
.
assertEqual
(
302
,
response
.
status_code
)
self
.
assertEqual
(
302
,
response
.
status_code
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
CommandTest
(
ModuleStoreTestCase
):
class
CommandTest
(
ModuleStoreTestCase
):
'''Test management command for importing serial numbers'''
'''Test management command for importing serial numbers'''
def
setUp
(
self
):
def
setUp
(
self
):
...
...
lms/djangoapps/oauth2_handler/tests.py
View file @
fcaa783e
# pylint: disable=missing-docstring
# pylint: disable=missing-docstring
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
django.test
import
TestCase
from
courseware.tests.tests
import
TEST_DATA_MIXED_MODULESTORE
from
courseware.tests.tests
import
TEST_DATA_MIXED_MODULESTORE
from
lang_pref
import
LANGUAGE_KEY
from
lang_pref
import
LANGUAGE_KEY
...
@@ -14,9 +13,11 @@ from user_api.models import UserPreference
...
@@ -14,9 +13,11 @@ from user_api.models import UserPreference
# Will also run default tests for IDTokens and UserInfo
# Will also run default tests for IDTokens and UserInfo
from
oauth2_provider.tests
import
IDTokenTestCase
,
UserInfoTestCase
from
oauth2_provider.tests
import
IDTokenTestCase
,
UserInfoTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
BaseTestMixin
(
TestCase
):
class
BaseTestMixin
(
ModuleStore
TestCase
):
profile
=
None
profile
=
None
def
setUp
(
self
):
def
setUp
(
self
):
...
...
lms/djangoapps/staticbook/tests.py
View file @
fcaa783e
...
@@ -10,7 +10,7 @@ import requests
...
@@ -10,7 +10,7 @@ import requests
from
django.test.utils
import
override_settings
from
django.test.utils
import
override_settings
from
django.core.urlresolvers
import
reverse
,
NoReverseMatch
from
django.core.urlresolvers
import
reverse
,
NoReverseMatch
from
courseware.tests.modulestore_config
import
TEST_DATA_M
IXED
_MODULESTORE
from
courseware.tests.modulestore_config
import
TEST_DATA_M
ONGO
_MODULESTORE
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
...
@@ -46,7 +46,7 @@ HTML_BOOK = {
...
@@ -46,7 +46,7 @@ HTML_BOOK = {
}
}
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
StaticBookTest
(
ModuleStoreTestCase
):
class
StaticBookTest
(
ModuleStoreTestCase
):
"""
"""
Helpers for the static book tests.
Helpers for the static book tests.
...
...
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