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
e8e7e78e
Commit
e8e7e78e
authored
Nov 05, 2014
by
Muhammad Ammar
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5655 from edx/ammar/unit-improvements
Unit Test Improvements
parents
b7f91eed
fcaa783e
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 @
e8e7e78e
...
...
@@ -11,6 +11,9 @@ from xmodule.modulestore.django import modulestore
from
xmodule.modulestore.mongo.base
import
location_to_query
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
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
):
...
...
@@ -30,7 +33,7 @@ class ExportAllCourses(ModuleStoreTestCase):
import_from_xml
(
self
.
module_store
,
'**replace_user**'
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'dot-underscore'
],
static_content_store
=
self
.
content_store
,
do_import_static
=
True
,
...
...
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
e8e7e78e
...
...
@@ -56,6 +56,8 @@ from xmodule.contentstore.content import StaticContent
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
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
)
class
ContentStoreTestCase
(
CourseTestCase
):
...
...
@@ -69,7 +71,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
Tests which legitimately need to import a course
"""
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
]
handouts_usage_key
=
course
.
id
.
make_usage_key
(
'course_info'
,
'handouts'
)
...
...
@@ -81,7 +83,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
self
.
assertIn
(
'/static/'
,
handouts
.
data
)
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
)
def
test_about_overrides
(
self
):
...
...
@@ -90,7 +92,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
e.g. /about/Fall_2012/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
effort
=
self
.
store
.
get_item
(
course_key
.
make_usage_key
(
'about'
,
'effort'
))
self
.
assertEqual
(
effort
.
data
,
'6 hours'
)
...
...
@@ -105,7 +107,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
'''
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'
))
...
...
@@ -153,7 +155,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
Test that course info updates are imported and exported with all content fields ('data', 'items')
"""
content_store
=
contentstore
()
data_dir
=
"common/test/data/"
data_dir
=
TEST_DATA_DIR
courses
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
data_dir
,
[
'course_info_updates'
],
static_content_store
=
content_store
,
verbose
=
True
,
...
...
@@ -166,7 +168,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
self
.
assertIsNotNone
(
course_updates
)
# 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.items.json'
))
...
...
@@ -204,7 +206,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
def
test_rewrite_nonportable_links_on_import
(
self
):
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
course_key
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'run'
)
...
...
@@ -323,7 +325,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
def
test_export_course_with_metadata_only_video
(
self
):
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'
)
# create a new video module and add it as a child to a vertical
...
...
@@ -352,7 +354,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
"""
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'
)
verticals
=
self
.
store
.
get_items
(
course_id
,
qualifiers
=
{
'category'
:
'vertical'
})
...
...
@@ -379,7 +381,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
"""
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'
)
verticals
=
self
.
store
.
get_items
(
course_id
,
qualifiers
=
{
'category'
:
'vertical'
})
...
...
@@ -410,7 +412,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
"""
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'
)
...
...
@@ -432,7 +434,7 @@ class ImportRequiredTestCases(ContentStoreTestCase):
def
test_export_course_without_content_store
(
self
):
# 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
root_dir
=
path
(
mkdtemp_clean
())
...
...
@@ -1221,7 +1223,7 @@ class ContentStoreTest(ContentStoreTestCase):
)
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
resp
=
self
.
_show_course_overview
(
course_key
)
...
...
@@ -1268,7 +1270,7 @@ class ContentStoreTest(ContentStoreTestCase):
target_course_id
=
_get_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
)
...
...
@@ -1303,7 +1305,7 @@ class ContentStoreTest(ContentStoreTestCase):
course_module
.
save
()
# 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
)
self
.
assertEquals
(
course_module
.
wiki_slug
,
'toy'
)
...
...
@@ -1318,17 +1320,17 @@ class ContentStoreTest(ContentStoreTestCase):
_create_course
(
self
,
target_course_id
,
course_data
)
# 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
)
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)
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
)
self
.
assertEquals
(
course_module
.
wiki_slug
,
'MITx.111.2013_Spring'
)
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
try
:
course_key
=
SlashSeparatedCourseKey
(
'edX'
,
'simple'
,
'problem'
)
...
...
@@ -1350,7 +1352,7 @@ class ContentStoreTest(ContentStoreTestCase):
self
.
assertNotEquals
(
new_discussion_item
.
discussion_id
,
'$$GUID$$'
)
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
]
verticals
=
self
.
store
.
get_items
(
course
.
id
,
qualifiers
=
{
'category'
:
'vertical'
})
...
...
@@ -1419,7 +1421,7 @@ class ContentStoreTest(ContentStoreTestCase):
courses
=
import_from_xml
(
self
.
store
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'conditional_and_poll'
],
static_content_store
=
content_store
)
...
...
cms/djangoapps/contentstore/tests/test_import.py
View file @
e8e7e78e
...
...
@@ -24,6 +24,8 @@ from uuid import uuid4
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
@ddt.ddt
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
)
...
...
@@ -48,7 +50,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'test_import_course'
],
static_content_store
=
content_store
,
do_import_static
=
False
,
...
...
@@ -70,7 +72,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
course_items
=
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data'
,
TEST_DATA_DIR
,
[
'test_import_course_2'
],
target_course_id
=
course
.
id
,
verbose
=
True
,
...
...
@@ -86,7 +88,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'2014_Uni'
],
target_course_id
=
course_id
)
...
...
@@ -131,7 +133,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
content_store
=
contentstore
()
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'
))
...
...
@@ -142,7 +144,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
def
test_no_static_link_rewrites_on_import
(
self
):
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
handouts
=
module_store
.
get_item
(
course_key
.
make_usage_key
(
'course_info'
,
'handouts'
))
...
...
@@ -183,7 +185,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'conditional'
],
target_course_id
=
target_course_id
)
...
...
@@ -213,7 +215,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'open_ended'
],
target_course_id
=
target_course_id
)
...
...
@@ -254,7 +256,7 @@ class ContentStoreImportTest(ModuleStoreTestCase):
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
source_course_name
],
target_course_id
=
target_course_id
)
...
...
cms/djangoapps/contentstore/tests/test_import_draft_order.py
View file @
e8e7e78e
...
...
@@ -2,6 +2,9 @@ from xmodule.modulestore.xml_importer import import_from_xml
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
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
...
...
@@ -10,7 +13,7 @@ class DraftReorderTestCase(ModuleStoreTestCase):
def
test_order
(
self
):
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
sequential
=
store
.
get_item
(
course_key
.
make_usage_key
(
'sequential'
,
'0f4f7649b10141b0bdc9922dcf94515a'
))
verticals
=
sequential
.
children
...
...
cms/djangoapps/contentstore/tests/test_import_pure_xblock.py
View file @
e8e7e78e
...
...
@@ -8,6 +8,9 @@ from xblock.fields import String
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.mongo.draft
import
as_draft
from
django.conf
import
settings
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
class
StubXBlock
(
XBlock
):
...
...
@@ -58,7 +61,7 @@ class XBlockImportTest(ModuleStoreTestCase):
"""
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'
)
...
...
cms/djangoapps/contentstore/tests/utils.py
View file @
e8e7e78e
...
...
@@ -18,6 +18,9 @@ from student.models import Registration
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
,
AssetLocation
from
contentstore.utils
import
reverse_url
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
):
...
...
@@ -137,7 +140,7 @@ class CourseTestCase(ModuleStoreTestCase):
Imports the test toy course and populates it with additional test data
"""
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'
)
# create an Orphan
...
...
cms/djangoapps/contentstore/views/tests/test_assets.py
View file @
e8e7e78e
...
...
@@ -21,6 +21,9 @@ from xmodule.modulestore.django import modulestore
from
xmodule.modulestore.xml_importer
import
import_from_xml
from
django.test.utils
import
override_settings
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
,
AssetLocation
from
django.conf
import
settings
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
class
AssetsTestCase
(
CourseTestCase
):
...
...
@@ -54,7 +57,7 @@ class BasicAssetsTestCase(AssetsTestCase):
course_items
=
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'toy'
],
static_content_store
=
contentstore
(),
verbose
=
True
...
...
@@ -247,7 +250,7 @@ class LockAssetTestCase(AssetsTestCase):
course_items
=
import_from_xml
(
module_store
,
self
.
user
.
id
,
'common/test/data/'
,
TEST_DATA_DIR
,
[
'toy'
],
static_content_store
=
contentstore
(),
verbose
=
True
...
...
common/djangoapps/contentserver/tests/test.py
View file @
e8e7e78e
...
...
@@ -25,6 +25,8 @@ log = logging.getLogger(__name__)
TEST_DATA_CONTENTSTORE
=
copy
.
deepcopy
(
settings
.
CONTENTSTORE
)
TEST_DATA_CONTENTSTORE
[
'DOC_STORE_CONFIG'
][
'db'
]
=
'test_xcontent_
%
s'
%
uuid4
()
.
hex
TEST_DATA_DIR
=
settings
.
COMMON_TEST_DATA_ROOT
@ddt.ddt
@override_settings
(
CONTENTSTORE
=
TEST_DATA_CONTENTSTORE
)
...
...
@@ -47,7 +49,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
self
.
course_key
=
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
)
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
)
...
...
common/lib/xmodule/xmodule/modulestore/tests/django_utils.py
View file @
e8e7e78e
...
...
@@ -116,7 +116,7 @@ def split_mongo_store_config(data_dir):
return
store
def
xml_store_config
(
data_dir
):
def
xml_store_config
(
data_dir
,
course_dirs
=
None
):
"""
Defines default module store using XMLModuleStore.
"""
...
...
@@ -127,6 +127,7 @@ def xml_store_config(data_dir):
'OPTIONS'
:
{
'data_dir'
:
data_dir
,
'default_class'
:
'xmodule.hidden_module.HiddenDescriptor'
,
'course_dirs'
:
course_dirs
,
}
}
}
...
...
common/lib/xmodule/xmodule/modulestore/tests/test_cross_modulestore_import_export.py
View file @
e8e7e78e
...
...
@@ -33,6 +33,8 @@ from xmodule.modulestore.inheritance import InheritanceMixin
from
xmodule.x_module
import
XModuleMixin
from
xmodule.modulestore.xml
import
XMLModuleStore
TEST_DATA_DIR
=
'common/test/data/'
COMMON_DOCSTORE_CONFIG
=
{
'host'
:
MONGO_HOST
,
...
...
@@ -315,7 +317,7 @@ class CrossStoreXMLRoundtrip(CourseComparisonTest):
import_from_xml
(
source_store
,
'test_user'
,
'common/test/data'
,
TEST_DATA_DIR
,
course_dirs
=
[
course_data_name
],
static_content_store
=
source_content
,
target_course_id
=
source_course_key
,
...
...
common/test/data/empty/.gitkeep
0 → 100644
View file @
e8e7e78e
lms/djangoapps/course_wiki/tests/test_access.py
View file @
e8e7e78e
...
...
@@ -9,7 +9,7 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
django.test.utils
import
override_settings
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
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
from
course_wiki
import
settings
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestWikiAccessBase
(
ModuleStoreTestCase
):
"""Base class for testing wiki access."""
def
setUp
(
self
):
...
...
@@ -53,7 +53,6 @@ class TestWikiAccessBase(ModuleStoreTestCase):
]
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
TestWikiAccess
(
TestWikiAccessBase
):
"""Test wiki access for course staff."""
def
setUp
(
self
):
...
...
@@ -114,7 +113,6 @@ class TestWikiAccess(TestWikiAccessBase):
self
.
assertFalse
(
user_is_article_course_staff
(
course_staff
,
self
.
wiki_310b
.
article
))
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
TestWikiAccessForStudent
(
TestWikiAccessBase
):
"""Test access for students."""
def
setUp
(
self
):
...
...
@@ -130,7 +128,6 @@ class TestWikiAccessForStudent(TestWikiAccessBase):
self
.
assertFalse
(
user_is_article_course_staff
(
self
.
student
,
page
.
article
))
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
TestWikiAccessForNumericalCourseNumber
(
TestWikiAccessBase
):
"""Test staff has access if course number is numerical and wiki slug has an underscore appended."""
def
setUp
(
self
):
...
...
@@ -150,7 +147,6 @@ class TestWikiAccessForNumericalCourseNumber(TestWikiAccessBase):
self
.
assertTrue
(
user_is_article_course_staff
(
course_staff
,
page
.
article
))
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
TestWikiAccessForOldFormatCourseStaffGroups
(
TestWikiAccessBase
):
"""Test staff has access if course group has old format."""
def
setUp
(
self
):
...
...
lms/djangoapps/course_wiki/tests/test_middleware.py
View file @
e8e7e78e
...
...
@@ -10,11 +10,11 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
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
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestWikiAccessMiddleware
(
ModuleStoreTestCase
):
"""Tests for WikiAccessMiddleware."""
...
...
lms/djangoapps/course_wiki/tests/tests.py
View file @
e8e7e78e
...
...
@@ -2,20 +2,23 @@ from django.core.urlresolvers import reverse
from
django.test.utils
import
override_settings
from
courseware.tests.tests
import
LoginEnrollmentTestCase
from
courseware.tests.modulestore_config
import
TEST_DATA_MIXED_MODULESTORE
from
xmodule.modulestore.django
import
modulestore
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
courseware.tests.modulestore_config
import
TEST_DATA_MONGO_MODULESTORE
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
mock
import
patch
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
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
self
.
toy
=
modulestore
()
.
get_course
(
SlashSeparatedCourseKey
(
'edX'
,
'toy'
,
'2012_Fall'
))
def
setUp
(
self
):
# Create two accounts
self
.
student
=
'view@test.com'
...
...
lms/djangoapps/courseware/management/commands/tests/test_dump_course.py
View file @
e8e7e78e
...
...
@@ -24,8 +24,9 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.xml_importer
import
import_from_xml
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'
...
...
lms/djangoapps/courseware/tests/__init__.py
View file @
e8e7e78e
...
...
@@ -13,7 +13,7 @@ from django.test.client import Client
from
edxmako.shortcuts
import
render_to_string
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
xmodule.tests
import
get_test_system
,
get_test_descriptor_system
from
opaque_keys.edx.locations
import
Location
...
...
@@ -24,7 +24,7 @@ from lms.lib.xblock.field_data import LmsFieldData
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
):
"""Base class for testing Xmodules with mongo store.
...
...
lms/djangoapps/courseware/tests/test_about.py
View file @
e8e7e78e
...
...
@@ -11,7 +11,7 @@ from django.conf import settings
from
.helpers
import
LoginEnrollmentTestCase
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
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentAllowedFactory
...
...
@@ -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."
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
AboutTestCase
(
LoginEnrollmentTestCase
,
ModuleStoreTestCase
):
"""
Tests about xblock.
"""
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
self
.
about
=
ItemFactory
.
create
(
...
...
@@ -87,7 +91,7 @@ class AboutTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
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
):
"""
This test case will check the About page when a course has a capped enrollment
...
...
@@ -137,7 +141,7 @@ class AboutWithCappedEnrollmentsTestCase(LoginEnrollmentTestCase, ModuleStoreTes
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
):
"""
This test case will check the About page when a course is invitation only.
...
...
@@ -184,7 +188,7 @@ class AboutWithInvitationOnly(ModuleStoreTestCase):
@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
):
"""
Test cases covering about page behavior for courses that use shib enrollment domain ("shib courses")
...
...
@@ -223,7 +227,7 @@ class AboutTestCaseShibCourse(LoginEnrollmentTestCase, ModuleStoreTestCase):
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
):
"""
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 @
e8e7e78e
...
...
@@ -5,17 +5,15 @@ import mock
from
mock
import
Mock
from
django.test
import
TestCase
from
django.test.utils
import
override_settings
from
courseware.tests.factories
import
UserFactory
,
StaffFactory
,
InstructorFactory
from
student.tests.factories
import
AnonymousUserFactory
,
CourseEnrollmentAllowedFactory
from
courseware.tests.tests
import
TEST_DATA_MIXED_MODULESTORE
import
pytz
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
# pylint: disable=C0111
# pylint: disable=protected-access
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
AccessTestCase
(
TestCase
):
"""
Tests for the various access controls on the student dashboard
...
...
lms/djangoapps/dashboard/tests/test_sysadmin.py
View file @
e8e7e78e
...
...
@@ -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
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.sysadmin
import
Users
from
dashboard.git_import
import
GitImportError
...
...
@@ -31,6 +31,9 @@ from xmodule.modulestore.xml import XMLModuleStore
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
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
=
{
'host'
:
MONGO_HOST
,
...
...
lms/djangoapps/django_comment_client/base/tests.py
View file @
e8e7e78e
...
...
@@ -10,7 +10,7 @@ from mock import patch, ANY, Mock
from
nose.tools
import
assert_true
,
assert_equal
# pylint: disable=E0611
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.tests.group_id
import
CohortedTopicGroupIdTestMixin
,
NonCohortedTopicGroupIdTestMixin
,
GroupIdAssertionMixin
from
django_comment_client.tests.utils
import
CohortedContentTestCase
...
...
@@ -27,6 +27,8 @@ log = logging.getLogger(__name__)
CS_PREFIX
=
"http://localhost:4567/api/v1"
# pylint: disable=C0111
class
MockRequestSetupMixin
(
object
):
def
_create_response_mock
(
self
,
data
):
...
...
@@ -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'
)
class
ViewsTestCase
(
UrlResetMixin
,
ModuleStoreTestCase
,
MockRequestSetupMixin
):
...
...
@@ -748,7 +750,7 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
@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
):
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
def
setUp
(
self
):
...
...
@@ -842,7 +844,7 @@ class ViewPermissionsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSet
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
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
...
...
@@ -864,7 +866,7 @@ class CreateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq
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
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
...
...
@@ -892,7 +894,7 @@ class UpdateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq
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
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
...
...
@@ -915,7 +917,7 @@ class CreateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRe
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
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
...
...
@@ -939,7 +941,7 @@ class UpdateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRe
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
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
...
...
@@ -963,7 +965,7 @@ class CreateSubCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, Moc
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
):
def
set_post_counts
(
self
,
mock_request
,
threads_count
=
1
,
comments_count
=
1
):
...
...
lms/djangoapps/django_comment_client/forum/tests.py
View file @
e8e7e78e
...
...
@@ -7,7 +7,7 @@ from django.test.client import Client, RequestFactory
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
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
util.testing
import
UrlResetMixin
from
django_comment_client.tests.group_id
import
(
...
...
@@ -19,17 +19,21 @@ from django_comment_client.tests.utils import CohortedContentTestCase
from
django_comment_client.forum
import
views
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
nose.tools
import
assert_true
# pylint: disable=E0611
from
mock
import
patch
,
Mock
,
ANY
,
call
from
course_groups.models
import
CourseUserGroup
TEST_DATA_MONGO_MODULESTORE
=
mixed_store_config
(
TEST_DATA_DIR
,
{},
include_xml
=
False
)
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
):
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
...
...
@@ -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'
)
class
SingleThreadTestCase
(
ModuleStoreTestCase
):
def
setUp
(
self
):
...
...
@@ -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'
)
class
SingleCohortedThreadTestCase
(
CohortedContentTestCase
):
def
_create_mock_cohorted_thread
(
self
,
mock_request
):
...
...
@@ -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
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
(
org
=
"TestX"
,
number
=
"101"
,
display_name
=
"Test Course"
)
...
...
@@ -798,7 +802,7 @@ class InlineDiscussionTestCase(ModuleStoreTestCase):
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'
)
class
UserProfileTestCase
(
ModuleStoreTestCase
):
...
...
@@ -910,7 +914,7 @@ class UserProfileTestCase(ModuleStoreTestCase):
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'
)
class
CommentsServiceRequestHeadersTestCase
(
UrlResetMixin
,
ModuleStoreTestCase
):
@patch.dict
(
"django.conf.settings.FEATURES"
,
{
"ENABLE_DISCUSSION_SERVICE"
:
True
})
...
...
@@ -971,7 +975,7 @@ class CommentsServiceRequestHeadersTestCase(UrlResetMixin, ModuleStoreTestCase):
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
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
...
...
@@ -991,7 +995,7 @@ class InlineDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
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
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
...
...
@@ -1011,7 +1015,8 @@ class ForumFormDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"title"
],
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
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
...
...
@@ -1035,7 +1040,8 @@ class ForumDiscussionSearchUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin
self
.
assertEqual
(
response_data
[
"discussion_data"
][
0
][
"title"
],
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
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
...
...
@@ -1057,7 +1063,7 @@ class SingleThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
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
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
...
...
@@ -1078,7 +1084,7 @@ class UserProfileUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
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
):
def
setUp
(
self
):
self
.
course
=
CourseFactory
.
create
()
...
...
@@ -1099,7 +1105,7 @@ class FollowedThreadsUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
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
):
"""
Tests for the behavior of views depending on if the student is enrolled
...
...
lms/djangoapps/instructor/tests/test_access.py
View file @
e8e7e78e
...
...
@@ -8,7 +8,7 @@ from xmodule.modulestore.tests.factories import CourseFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
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
django_comment_common.models
import
(
Role
,
...
...
@@ -19,7 +19,7 @@ from instructor.access import (allow_access,
update_forum_role
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAccessList
(
ModuleStoreTestCase
):
""" Test access listings. """
def
setUp
(
self
):
...
...
@@ -41,7 +41,7 @@ class TestInstructorAccessList(ModuleStoreTestCase):
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
):
""" Test access allow. """
def
setUp
(
self
):
...
...
@@ -75,7 +75,7 @@ class TestInstructorAccessAllow(ModuleStoreTestCase):
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
):
""" Test access revoke. """
def
setUp
(
self
):
...
...
@@ -109,7 +109,7 @@ class TestInstructorAccessRevoke(ModuleStoreTestCase):
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
):
"""
Test forum access control.
...
...
lms/djangoapps/instructor/tests/test_api.py
View file @
e8e7e78e
...
...
@@ -25,7 +25,7 @@ from django.utils.timezone import utc
from
django.test
import
RequestFactory
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
courseware.tests.helpers
import
LoginEnrollmentTestCase
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
...
...
@@ -136,7 +136,7 @@ class TestCommonExceptions400(unittest.TestCase):
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
})
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
})
class
TestInstructorAPIBulkAccountCreationAndEnrollment
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
...
...
@@ -528,7 +528,7 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(ModuleStoreTestCase, Log
@ddt.ddt
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAPIEnrollment
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
Test enrollment modification endpoint.
...
...
@@ -1052,7 +1052,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
@ddt.ddt
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAPIBulkBetaEnrollment
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
Test bulk beta modify access endpoint.
...
...
@@ -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
):
"""
Test endpoints whereby instructors can change permissions
...
...
@@ -1603,7 +1603,7 @@ class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase
@ddt.ddt
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorAPILevelsDataDump
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
Test endpoints that show data without side effects.
...
...
@@ -2046,7 +2046,7 @@ class TestInstructorAPILevelsDataDump(ModuleStoreTestCase, LoginEnrollmentTestCa
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
):
"""
Test endpoints whereby instructors can change student grades.
...
...
@@ -2186,7 +2186,7 @@ class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase)
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
})
class
TestInstructorSendEmail
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
...
...
@@ -2268,7 +2268,7 @@ class MockCompletionInfo(object):
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
):
"""
Test instructor task list endpoint.
...
...
@@ -2430,7 +2430,7 @@ class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase):
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'
)
class
TestInstructorEmailContentList
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
...
...
@@ -2566,7 +2566,7 @@ class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCas
@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_API_KEY
=
"robot_api_key"
)
class
TestInstructorAPIAnalyticsProxy
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
...
...
@@ -2748,7 +2748,7 @@ class TestInstructorAPIHelpers(TestCase):
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
):
"""
Test data dumps for reporting.
...
...
@@ -2937,7 +2937,7 @@ class TestDueDateExtensions(ModuleStoreTestCase, LoginEnrollmentTestCase):
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
)
class
TestCourseRegistrationCodes
(
ModuleStoreTestCase
):
"""
...
...
lms/djangoapps/instructor/tests/test_email.py
View file @
e8e7e78e
...
...
@@ -13,7 +13,7 @@ from courseware.tests.tests import TEST_DATA_MONGO_MODULESTORE
from
student.tests.factories
import
AdminFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
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
...
...
@@ -110,7 +110,7 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase):
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
):
"""
Check for email view on the new instructor dashboard
...
...
lms/djangoapps/instructor/tests/test_enrollment.py
View file @
e8e7e78e
...
...
@@ -11,7 +11,7 @@ from django.test import TestCase
from
django.test.utils
import
override_settings
from
student.tests.factories
import
UserFactory
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
instructor.enrollment
import
(
...
...
@@ -286,7 +286,7 @@ class TestInstructorUnenrollDB(TestEnrollmentChangeBase):
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
):
""" Test student module manipulations. """
def
setUp
(
self
):
...
...
@@ -431,7 +431,7 @@ class TestSendBetaRoleEmail(TestCase):
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
):
"""
Test what URLs the function get_email_params returns under different
...
...
lms/djangoapps/instructor/tests/test_hint_manager.py
View file @
e8e7e78e
...
...
@@ -6,14 +6,16 @@ from mock import patch, MagicMock
from
courseware.models
import
XModuleUserStateSummaryField
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
from
student.tests.factories
import
UserFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
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
):
def
setUp
(
self
):
...
...
lms/djangoapps/instructor/tests/test_legacy_anon_csv.py
View file @
e8e7e78e
...
...
@@ -16,17 +16,16 @@ from django.contrib.auth.models import User
from
django.core.urlresolvers
import
reverse
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
from
student.roles
import
CourseStaffRole
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.django
import
modulestore
,
clear_existing_modulestores
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.tests.factories
import
CourseFactory
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
):
'''
Check for download of csv
...
...
@@ -34,8 +33,8 @@ class TestInstructorDashboardAnonCSV(ModuleStoreTestCase, LoginEnrollmentTestCas
# Note -- I copied this setUp from a similar test
def
setUp
(
self
):
clear_existing_modulestores
()
self
.
toy
=
modulestore
()
.
get_course
(
SlashSeparatedCourseKey
(
"edX"
,
"toy"
,
"2012_Fall"
)
)
#
clear_existing_modulestores()
self
.
toy
=
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'toy'
,
display_name
=
'2012_Fall'
)
# Create two accounts
self
.
student
=
'view@test.com'
...
...
lms/djangoapps/instructor/tests/test_legacy_download_csv.py
View file @
e8e7e78e
...
...
@@ -16,22 +16,21 @@ from django.contrib.auth.models import User
from
django.core.urlresolvers
import
reverse
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
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
from
xmodule.modulestore.django
import
modulestore
,
clear_existing_modulestores
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
xmodule.modulestore.tests.factories
import
CourseFactory
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorDashboardGradeDownloadCSV
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
'''
Check for download of csv
'''
def
setUp
(
self
):
clear_existing_modulestores
()
self
.
toy
=
modulestore
()
.
get_course
(
SlashSeparatedCourseKey
(
"edX"
,
"toy"
,
"2012_Fall"
)
)
#
clear_existing_modulestores()
self
.
toy
=
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'toy'
,
display_name
=
'2012_Fall'
)
# Create two accounts
self
.
student
=
'view@test.com'
...
...
lms/djangoapps/instructor/tests/test_legacy_enrollment.py
View file @
e8e7e78e
...
...
@@ -10,7 +10,7 @@ from django.test.utils import override_settings
from
django.contrib.auth.models
import
User
from
django.core.urlresolvers
import
reverse
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
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
,
AdminFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
...
...
@@ -22,7 +22,7 @@ USER_COUNT = 4
@ddt.ddt
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestInstructorEnrollsStudent
(
ModuleStoreTestCase
,
LoginEnrollmentTestCase
):
"""
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 @
e8e7e78e
...
...
@@ -14,11 +14,10 @@ from django_comment_common.models import Role, FORUM_ROLE_ADMINISTRATOR, \
from
django_comment_client.utils
import
has_forum_access
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
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.factories
import
CourseFactory
FORUM_ROLES
=
[
FORUM_ROLE_ADMINISTRATOR
,
FORUM_ROLE_MODERATOR
,
FORUM_ROLE_COMMUNITY_TA
]
...
...
@@ -33,18 +32,14 @@ def action_name(operation, 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
):
'''
Check for change in forum admin role memberships
'''
def
setUp
(
self
):
clear_existing_modulestores
()
courses
=
modulestore
()
.
get_courses
()
self
.
course_id
=
SlashSeparatedCourseKey
(
"edX"
,
"toy"
,
"2012_Fall"
)
self
.
toy
=
modulestore
()
.
get_course
(
self
.
course_id
)
self
.
toy
=
CourseFactory
.
create
(
org
=
'edX'
,
course
=
'toy'
,
display_name
=
'2012_Fall'
)
# Create two accounts
self
.
student
=
'view@test.com'
...
...
lms/djangoapps/instructor/tests/test_legacy_reset.py
View file @
e8e7e78e
...
...
@@ -8,7 +8,7 @@ from django.test.utils import override_settings
from
courseware.tests.helpers
import
LoginEnrollmentTestCase
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
student.tests.factories
import
UserFactory
,
AdminFactory
,
CourseEnrollmentFactory
...
...
@@ -18,7 +18,7 @@ from submissions import api as sub_api
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
):
"""
Reset student state from the legacy instructor dash.
...
...
lms/djangoapps/instructor/tests/test_legacy_xss.py
View file @
e8e7e78e
...
...
@@ -7,7 +7,7 @@ from django.test.client import RequestFactory
from
django.test.utils
import
override_settings
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
edxmako.tests
import
mako_middleware_process_request
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
...
...
@@ -15,8 +15,10 @@ from xmodule.modulestore.tests.factories import CourseFactory
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
):
def
setUp
(
self
):
self
.
_request_factory
=
RequestFactory
()
...
...
lms/djangoapps/instructor/tests/test_spoc_gradebook.py
View file @
e8e7e78e
...
...
@@ -7,7 +7,7 @@ from django.core.urlresolvers import reverse
from
xmodule.modulestore.tests.factories
import
CourseFactory
,
ItemFactory
from
student.tests.factories
import
UserFactory
,
CourseEnrollmentFactory
,
AdminFactory
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
courseware.tests.factories
import
StudentModuleFactory
from
xmodule.modulestore.django
import
modulestore
...
...
@@ -16,7 +16,7 @@ from xmodule.modulestore.django import modulestore
USER_COUNT
=
11
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestGradebook
(
ModuleStoreTestCase
):
"""
Test functionality of the spoc gradebook. Sets up a course with assignments and
...
...
lms/djangoapps/instructor/tests/test_tools.py
View file @
e8e7e78e
...
...
@@ -12,7 +12,7 @@ from django.test.utils import override_settings
from
django.utils.timezone
import
utc
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
xmodule.fields
import
Date
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
...
...
@@ -97,7 +97,7 @@ class TestParseDatetime(unittest.TestCase):
tools
.
parse_datetime
(
'foo'
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
TestFindUnit
(
ModuleStoreTestCase
):
"""
Test the find_unit function.
...
...
@@ -130,7 +130,7 @@ class TestFindUnit(ModuleStoreTestCase):
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
):
"""
Test the get_units_with_due_date function.
...
...
@@ -178,7 +178,7 @@ class TestTitleOrUrl(unittest.TestCase):
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
):
"""
Test the set_due_date_extensions function.
...
...
@@ -252,7 +252,7 @@ class TestSetDueDateExtension(ModuleStoreTestCase):
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
):
"""
Test data dumps for reporting.
...
...
lms/djangoapps/instructor_task/tests/test_base.py
View file @
e8e7e78e
...
...
@@ -25,7 +25,7 @@ from opaque_keys.edx.locations import Location, SlashSeparatedCourseKey
from
student.tests.factories
import
CourseEnrollmentFactory
,
UserFactory
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.models
import
PROGRESS
,
QUEUING
...
...
@@ -99,7 +99,7 @@ class InstructorTaskTestCase(TestCase):
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
):
"""
Base test class for InstructorTask-related tests that require
...
...
@@ -184,7 +184,7 @@ class InstructorTaskCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase)
return
request
@override_settings
(
MODULESTORE
=
TEST_DATA_M
IXED
_MODULESTORE
)
@override_settings
(
MODULESTORE
=
TEST_DATA_M
ONGO
_MODULESTORE
)
class
InstructorTaskModuleTestCase
(
InstructorTaskCourseTestCase
):
"""
Base test class for InstructorTask-related tests that require
...
...
lms/djangoapps/licenses/tests.py
View file @
e8e7e78e
...
...
@@ -15,7 +15,7 @@ from django.core.management import call_command
from
django.core.urlresolvers
import
reverse
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
student.tests.factories
import
UserFactory
...
...
@@ -144,7 +144,7 @@ class LicenseTestCase(TestCase):
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
):
'''Test management command for importing serial numbers'''
def
setUp
(
self
):
...
...
lms/djangoapps/oauth2_handler/tests.py
View file @
e8e7e78e
# pylint: disable=missing-docstring
from
django.test.utils
import
override_settings
from
django.test
import
TestCase
from
courseware.tests.tests
import
TEST_DATA_MIXED_MODULESTORE
from
lang_pref
import
LANGUAGE_KEY
...
...
@@ -14,9 +13,11 @@ from user_api.models import UserPreference
# Will also run default tests for IDTokens and UserInfo
from
oauth2_provider.tests
import
IDTokenTestCase
,
UserInfoTestCase
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
@override_settings
(
MODULESTORE
=
TEST_DATA_MIXED_MODULESTORE
)
class
BaseTestMixin
(
TestCase
):
class
BaseTestMixin
(
ModuleStore
TestCase
):
profile
=
None
def
setUp
(
self
):
...
...
lms/djangoapps/staticbook/tests.py
View file @
e8e7e78e
...
...
@@ -10,7 +10,7 @@ import requests
from
django.test.utils
import
override_settings
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
xmodule.modulestore.tests.factories
import
CourseFactory
from
xmodule.modulestore.tests.django_utils
import
ModuleStoreTestCase
...
...
@@ -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
):
"""
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