Unit Test Improvements
TE-489
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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')
|
||||
@@ -314,7 +316,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
|
||||
@@ -343,7 +345,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'})
|
||||
@@ -370,7 +372,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'})
|
||||
@@ -401,7 +403,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')
|
||||
|
||||
@@ -423,7 +425,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())
|
||||
@@ -1212,7 +1214,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)
|
||||
@@ -1259,7 +1261,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)
|
||||
|
||||
@@ -1294,7 +1296,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')
|
||||
|
||||
@@ -1309,17 +1311,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')
|
||||
@@ -1341,7 +1343,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'})
|
||||
@@ -1410,7 +1412,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
|
||||
)
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,6 +9,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 xmodule.modulestore.mongo.draft import as_draft
|
||||
from django.conf import settings
|
||||
|
||||
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
|
||||
|
||||
|
||||
class StubXBlock(XBlock):
|
||||
@@ -59,7 +62,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')
|
||||
|
||||
@@ -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):
|
||||
@@ -135,7 +138,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ from xmodule.modulestore.tests.mongo_connection import MONGO_PORT_NUM, MONGO_HOS
|
||||
from xmodule.modulestore.inheritance import InheritanceMixin
|
||||
from xmodule.x_module import XModuleMixin
|
||||
|
||||
TEST_DATA_DIR = 'common/test/data/'
|
||||
|
||||
|
||||
COMMON_DOCSTORE_CONFIG = {
|
||||
'host': MONGO_HOST,
|
||||
@@ -289,7 +291,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,
|
||||
|
||||
0
common/test/data/empty/.gitkeep
Normal file
0
common/test/data/empty/.gitkeep
Normal file
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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):
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_MODULESTORE
|
||||
from course_wiki.views import get_or_create_root
|
||||
|
||||
|
||||
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class TestWikiAccessMiddleware(ModuleStoreTestCase):
|
||||
"""Tests for WikiAccessMiddleware."""
|
||||
|
||||
|
||||
@@ -2,21 +2,24 @@ 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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class WikiRedirectTestCase(LoginEnrollmentTestCase):
|
||||
"""
|
||||
Tests for wiki course redirection.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.toy = CourseFactory.create(org='edX', course='toy', display_name='2012_Fall')
|
||||
|
||||
def setUp(self):
|
||||
|
||||
# Load the toy course
|
||||
self.toy = modulestore().get_course(SlashSeparatedCourseKey('edX', 'toy', '2012_Fall'))
|
||||
|
||||
# Create two accounts
|
||||
self.student = 'view@test.com'
|
||||
self.instructor = 'view2@test.com'
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class BaseTestXmodule(ModuleStoreTestCase):
|
||||
"""Base class for testing Xmodules with mongo store.
|
||||
|
||||
|
||||
@@ -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_MONGO_MODULESTORE, TEST_DATA_MIXED_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class AboutWithClosedEnrollment(ModuleStoreTestCase):
|
||||
"""
|
||||
This test case will check the About page for a course that has enrollment start/end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class UsersEndpointTestCase(ModuleStoreTestCase, MockRequestSetupMixin):
|
||||
|
||||
def set_post_counts(self, mock_request, threads_count=1, comments_count=1):
|
||||
|
||||
@@ -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_MIXED_MODULESTORE)
|
||||
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
@patch('requests.request')
|
||||
class SingleThreadTestCase(ModuleStoreTestCase):
|
||||
def setUp(self):
|
||||
@@ -276,7 +280,7 @@ class SingleThreadTestCase(ModuleStoreTestCase):
|
||||
)
|
||||
|
||||
|
||||
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class EnrollmentTestCase(ModuleStoreTestCase):
|
||||
"""
|
||||
Tests for the behavior of views depending on if the student is enrolled
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class TestInstructorAccessForum(ModuleStoreTestCase):
|
||||
"""
|
||||
Test forum access control.
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
"""
|
||||
Test enrollment modification endpoint.
|
||||
@@ -1052,7 +1052,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
"""
|
||||
Test bulk beta modify access endpoint.
|
||||
@@ -1365,7 +1365,7 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
|
||||
)
|
||||
|
||||
|
||||
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
@override_settings(REGISTRATION_CODE_LENGTH=8)
|
||||
class TestCourseRegistrationCodes(ModuleStoreTestCase):
|
||||
"""
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class TestNewInstructorDashboardEmailViewXMLBacked(ModuleStoreTestCase):
|
||||
"""
|
||||
Check for email view on the new instructor dashboard
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class TestGetEmailParams(ModuleStoreTestCase):
|
||||
"""
|
||||
Test what URLs the function get_email_params returns under different
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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):
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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'
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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'
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
"""
|
||||
Check Enrollment/Unenrollment with/without auto-enrollment on activation and with/without email notification
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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'
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class InstructorResetStudentStateTest(ModuleStoreTestCase, LoginEnrollmentTestCase):
|
||||
"""
|
||||
Reset student state from the legacy instructor dash.
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.tests import TEST_DATA_MONGO_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()
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.tests import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class TestGradebook(ModuleStoreTestCase):
|
||||
"""
|
||||
Test functionality of the spoc gradebook. Sets up a course with assignments and
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class TestDataDumps(ModuleStoreTestCase):
|
||||
"""
|
||||
Test data dumps for reporting.
|
||||
|
||||
@@ -21,7 +21,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_MIXED_MODULESTORE
|
||||
from courseware.tests.tests import LoginEnrollmentTestCase, TEST_DATA_MONGO_MODULESTORE
|
||||
|
||||
from instructor_task.api_helper import encode_problem_and_student_input
|
||||
from instructor_task.models import PROGRESS, QUEUING
|
||||
@@ -95,7 +95,7 @@ class InstructorTaskTestCase(TestCase):
|
||||
return self._create_entry(task_state=task_state, task_output=progress, student=student)
|
||||
|
||||
|
||||
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class InstructorTaskCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
|
||||
"""
|
||||
Base test class for InstructorTask-related tests that require
|
||||
@@ -168,7 +168,7 @@ class InstructorTaskCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase)
|
||||
return request
|
||||
|
||||
|
||||
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class InstructorTaskModuleTestCase(InstructorTaskCourseTestCase):
|
||||
"""
|
||||
Base test class for InstructorTask-related tests that require
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class CommandTest(ModuleStoreTestCase):
|
||||
'''Test management command for importing serial numbers'''
|
||||
def setUp(self):
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
# 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(ModuleStoreTestCase):
|
||||
profile = None
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -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_MIXED_MODULESTORE
|
||||
from courseware.tests.modulestore_config import TEST_DATA_MONGO_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_MIXED_MODULESTORE)
|
||||
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
|
||||
class StaticBookTest(ModuleStoreTestCase):
|
||||
"""
|
||||
Helpers for the static book tests.
|
||||
|
||||
Reference in New Issue
Block a user