Better support specifying of modulestore configuration in test cases

The existing pattern of using `override_settings(MODULESTORE=...)` prevented
us from having more than one layer of subclassing in modulestore tests.

In a structure like:

    @override_settings(MODULESTORE=store_a)
    class BaseTestCase(ModuleStoreTestCase):
        def setUp(self):
            # use store

    @override_settings(MODULESTORE=store_b)
    class ChildTestCase(BaseTestCase):
        def setUp(self):
            # use store

In this case, the store actions performed in `BaseTestCase` on behalf of
`ChildTestCase` would still use `store_a`, even though the `ChildTestCase`
had specified to use `store_b`. This is because the `override_settings`
decorator would be the innermost wrapper around the `BaseTestCase.setUp` method,
no matter what `ChildTestCase` does.

To remedy this, we move the call to `override_settings` into the
`ModuleStoreTestCase.setUp` method, and use a cleanup to remove the override.
Subclasses can just defined the `MODULESTORE` class attribute to specify which
modulestore to use _for the entire `setUp` chain_.

[PLAT-419]
This commit is contained in:
Calen Pennington
2015-01-23 15:38:49 -05:00
parent a92ca9d79a
commit b353ed2ea2
103 changed files with 107 additions and 381 deletions

View File

@@ -12,6 +12,7 @@ from contentstore import utils
from contentstore.tests.utils import CourseTestCase
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from xmodule.modulestore.django import modulestore
@@ -164,7 +165,7 @@ class ExtraPanelTabTestCase(TestCase):
self.assertEqual(actual_tabs, expected_tabs)
class CourseImageTestCase(TestCase):
class CourseImageTestCase(ModuleStoreTestCase):
"""Tests for course image URLs."""
def test_get_image_url(self):

View File

@@ -67,7 +67,6 @@ class AjaxEnabledTestClient(Client):
return self.get(path, data or {}, follow, HTTP_ACCEPT="application/json", **extra)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CourseTestCase(ModuleStoreTestCase):
"""
Base class for Studio tests that require a logged in user and a course.
@@ -81,6 +80,7 @@ class CourseTestCase(ModuleStoreTestCase):
will be cleared out before each test case execution and deleted
afterwards.
"""
self.user_password = super(CourseTestCase, self).setUp()
self.client = AjaxEnabledTestClient()

View File

@@ -22,7 +22,7 @@ from cms.djangoapps.xblock_config.models import StudioConfig
from xmodule.modulestore.django import modulestore
class GetPreviewHtmlTestCase(TestCase):
class GetPreviewHtmlTestCase(ModuleStoreTestCase):
"""
Tests for get_preview_fragment.

View File

@@ -6,6 +6,7 @@ from contentstore.tests.utils import CourseTestCase
from django.test import TestCase
from xmodule.x_module import STUDENT_VIEW
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.tabs import CourseTabList, WikiTab
from contentstore.utils import reverse_course_url
from xmodule.modulestore.django import modulestore
@@ -192,7 +193,7 @@ class TabsPageTests(CourseTestCase):
self.assertIn('<span data-tooltip="Drag to reorder" class="drag-handle action"></span>', html)
class PrimitiveTabEdit(TestCase):
class PrimitiveTabEdit(ModuleStoreTestCase):
"""Tests for the primitive tab edit data manipulations"""
def test_delete(self):

View File

@@ -17,14 +17,8 @@ from xmodule.modulestore.tests.django_utils import (
from xmodule.modulestore.tests.factories import CourseFactory, CourseAboutFactory
from student.tests.factories import UserFactory
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@ddt.ddt
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class CourseInfoTest(ModuleStoreTestCase, APITestCase):
"""

View File

@@ -16,12 +16,7 @@ from course_about import data
from course_about.errors import CourseNotFoundError
from xmodule.modulestore.django import modulestore
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class CourseAboutDataTest(ModuleStoreTestCase):
"""

View File

@@ -22,14 +22,8 @@ from course_about import api
from course_about.errors import CourseNotFoundError, CourseAboutError
from xmodule.modulestore.django import modulestore
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@ddt.ddt
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class CourseInfoTest(ModuleStoreTestCase, APITestCase):
"""

View File

@@ -18,13 +18,7 @@ from student.models import CourseEnrollment
from course_modes.models import CourseMode, Mode
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@ddt.ddt
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class CourseModeViewTest(UrlResetMixin, ModuleStoreTestCase):
@patch.dict(settings.FEATURES, {'MODE_CREATION_FOR_TESTING': True})

View File

@@ -16,7 +16,6 @@ from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import TEST_DATA_MOCK_MODULESTORE
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class EmbargoCourseFormTest(ModuleStoreTestCase):
"""Test the course form properly validates course IDs"""

View File

@@ -24,13 +24,7 @@ from config_models.models import cache
from embargo.models import EmbargoedCourse, EmbargoedState, IPFilter
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@ddt.ddt
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class EmbargoMiddlewareTests(ModuleStoreTestCase):
"""

View File

@@ -19,13 +19,8 @@ from student.tests.factories import UserFactory, CourseModeFactory
from student.models import CourseEnrollment, EnrollmentClosedError, CourseFullError, AlreadyEnrolledError
from enrollment import data
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@ddt.ddt
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class EnrollmentDataTest(ModuleStoreTestCase):
"""

View File

@@ -20,13 +20,8 @@ from enrollment.errors import CourseEnrollmentError
from student.tests.factories import UserFactory, CourseModeFactory
from student.models import CourseEnrollment
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@ddt.ddt
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class EnrollmentTest(ModuleStoreTestCase, APITestCase):
"""

View File

@@ -73,7 +73,7 @@ def gen_all_identities():
@ddt
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE, SESSION_ENGINE='django.contrib.sessions.backends.cache')
@override_settings(SESSION_ENGINE='django.contrib.sessions.backends.cache')
class ShibSPTest(ModuleStoreTestCase):
"""
Tests for the Shibboleth SP, which communicates via request.META

View File

@@ -14,7 +14,6 @@ from xmodule.modulestore.tests.django_utils import TEST_DATA_MOCK_MODULESTORE
from student.tests.factories import UserFactory, AnonymousUserFactory
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CountryMiddlewareTests(TestCase):
"""
Tests of CountryMiddleware.

View File

@@ -14,7 +14,6 @@ from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestMidcourseReverificationWindow(ModuleStoreTestCase):
""" Tests for MidcourseReverificationWindow objects """

View File

@@ -24,12 +24,12 @@ from xmodule.modulestore.tests.factories import CourseFactory
from bulk_email.models import CourseAuthorization # pylint: disable=import-error
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class TestStudentDashboardEmailView(ModuleStoreTestCase):
"""
Check for email view displayed with flag
"""
def setUp(self):
super(TestStudentDashboardEmailView, self).setUp()
@@ -92,12 +92,13 @@ class TestStudentDashboardEmailView(ModuleStoreTestCase):
self.assertTrue(self.email_modal_link in response.content)
@override_settings(MODULESTORE=TEST_DATA_MIXED_TOY_MODULESTORE)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class TestStudentDashboardEmailViewXMLBacked(ModuleStoreTestCase):
"""
Check for email view on student dashboard, with XML backed course.
"""
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
def setUp(self):
self.course_name = 'edX/toy/2012_Fall'

View File

@@ -8,25 +8,19 @@ from mock import patch
from django.test.utils import override_settings
from django.conf import settings
from django.core.urlresolvers import reverse
from xmodule.modulestore.tests.django_utils import (
ModuleStoreTestCase, mixed_store_config
)
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from student.tests.factories import UserFactory, CourseModeFactory
from student.models import CourseEnrollment
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@ddt.ddt
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class EnrollmentTest(ModuleStoreTestCase):
"""
Test student enrollment, especially with different course modes.
"""
USERNAME = "Bob"
EMAIL = "bob@example.com"
PASSWORD = "edx"

View File

@@ -319,11 +319,11 @@ class LoginTest(TestCase):
self.assertNotIn(log_string, format_string)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class ExternalAuthShibTest(ModuleStoreTestCase):
"""
Tests how login_user() interacts with ExternalAuth, in particular Shib
"""
def setUp(self):
super(ExternalAuthShibTest, self).setUp()
self.course = CourseFactory.create(

View File

@@ -12,9 +12,7 @@ from django.test.utils import override_settings
from util.testing import UrlResetMixin
from xmodule.modulestore.tests.factories import CourseFactory
from student.tests.factories import CourseModeFactory
from xmodule.modulestore.tests.django_utils import (
ModuleStoreTestCase, mixed_store_config
)
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
# This relies on third party auth being enabled and configured
@@ -23,10 +21,6 @@ from xmodule.modulestore.tests.django_utils import (
THIRD_PARTY_AUTH_BACKENDS = ["google-oauth2", "facebook"]
THIRD_PARTY_AUTH_PROVIDERS = ["Google", "Facebook"]
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
def _third_party_login_url(backend_name, auth_entry, course_id=None, redirect_url=None):
"""Construct the login URL to start third party authentication. """
@@ -43,7 +37,6 @@ def _third_party_login_url(backend_name, auth_entry, course_id=None, redirect_ur
@ddt.ddt
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class LoginFormTest(UrlResetMixin, ModuleStoreTestCase):
"""Test rendering of the login form. """
@@ -156,7 +149,6 @@ class LoginFormTest(UrlResetMixin, ModuleStoreTestCase):
@ddt.ddt
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class RegisterFormTest(UrlResetMixin, ModuleStoreTestCase):
"""Test rendering of the registration form. """

View File

@@ -17,17 +17,13 @@ from student.helpers import (
)
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, mixed_store_config
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from student.tests.factories import UserFactory, CourseEnrollmentFactory
from course_modes.tests.factories import CourseModeFactory
from verify_student.models import SoftwareSecurePhotoVerification # pylint: disable=F0401
from util.testing import UrlResetMixin
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@patch.dict(settings.FEATURES, {'AUTOMATIC_VERIFY_STUDENT_IDENTITY_FOR_TESTING': True})
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
@ddt.ddt

View File

@@ -28,7 +28,6 @@ from student.views import (process_survey_link, _cert_info,
from student.tests.factories import UserFactory, CourseModeFactory
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.django_utils import TEST_DATA_MOCK_MODULESTORE
# These imports refer to lms djangoapps.
# Their testcases are only run under lms.
@@ -180,7 +179,6 @@ class CourseEndingTest(TestCase):
self.assertIsNone(_cert_info(user, course2, cert_status))
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class DashboardTest(ModuleStoreTestCase):
"""
Tests for dashboard utility functions
@@ -615,7 +613,6 @@ class EnrollInCourseTest(TestCase):
self.assert_enrollment_mode_change_event_was_emitted(user, course_id, "honor")
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class ChangeEnrollmentViewTest(ModuleStoreTestCase):
"""Tests the student.views.change_enrollment view"""
@@ -698,7 +695,6 @@ class ChangeEnrollmentViewTest(ModuleStoreTestCase):
self.assertEqual(enrollment_mode, u'honor')
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class PaidRegistrationTest(ModuleStoreTestCase):
"""
Tests for paid registration functionality (not verified student), involves shoppingcart
@@ -731,7 +727,6 @@ class PaidRegistrationTest(ModuleStoreTestCase):
shoppingcart.models.Order.get_cart_for_user(self.user), self.course.id))
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class AnonymousLookupTable(ModuleStoreTestCase):
"""
Tests for anonymous_id_functions

View File

@@ -16,14 +16,10 @@ from django.test.utils import override_settings
from xmodule.modulestore.tests.factories import CourseFactory
from student.tests.factories import UserFactory, CourseModeFactory
from student.models import CourseEnrollment
from xmodule.modulestore.tests.django_utils import (
ModuleStoreTestCase, mixed_store_config
)
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from openedx.core.djangoapps.user_api.models import UserOrgTag
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
THIRD_PARTY_AUTH_CONFIGURED = (
settings.FEATURES.get('ENABLE_THIRD_PARTY_AUTH') and
getattr(settings, 'THIRD_PARTY_AUTH', {})
@@ -31,7 +27,6 @@ THIRD_PARTY_AUTH_CONFIGURED = (
@unittest.skipUnless(THIRD_PARTY_AUTH_CONFIGURED, "Third party auth must be configured")
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@ddt.ddt
class PipelineEnrollmentTest(ModuleStoreTestCase):
"""Test that the pipeline auto-enrolls students upon successful authentication. """

View File

@@ -12,6 +12,7 @@ from mock import patch
from django.conf import settings
from django.contrib.auth.models import User
from django.test import TestCase
from django.test.utils import override_settings
from request_cache.middleware import RequestCache
from xmodule.contentstore.django import _CONTENTSTORE
@@ -189,15 +190,14 @@ class ModuleStoreTestCase(TestCase):
Usage:
1. Create a subclass of `ModuleStoreTestCase`
2. Use Django's @override_settings decorator to use
the desired modulestore configuration.
2. (optional) If you need a specific variety of modulestore, or particular ModuleStore
options, set the MODULESTORE class attribute of your test class to the
appropriate modulestore config.
For example:
MIXED_CONFIG = mixed_store_config(data_dir, mappings)
@override_settings(MODULESTORE=MIXED_CONFIG)
class FooTest(ModuleStoreTestCase):
MODULESTORE = mixed_store_config(data_dir, mappings)
# ...
3. Use factories (e.g. `CourseFactory`, `ItemFactory`) to populate
@@ -219,6 +219,9 @@ class ModuleStoreTestCase(TestCase):
`clear_existing_modulestores()` directly in
your `setUp()` method.
"""
MODULESTORE = TEST_DATA_MOCK_MODULESTORE
def setUp(self, **kwargs):
"""
Creates a test User if `create_user` is True.
@@ -227,6 +230,18 @@ class ModuleStoreTestCase(TestCase):
Args:
create_user - specifies whether or not to create a test User. Default is True.
"""
settings_override = override_settings(MODULESTORE=self.MODULESTORE)
settings_override.__enter__()
self.addCleanup(settings_override.__exit__, None, None, None)
# Clear out any existing modulestores,
# which will cause them to be re-created
clear_existing_modulestores()
self.addCleanup(self.drop_mongo_collections)
self.addCleanup(RequestCache().clear_request_cache)
super(ModuleStoreTestCase, self).setUp()
self.store = modulestore()
@@ -293,43 +308,6 @@ class ModuleStoreTestCase(TestCase):
if hasattr(module_store, 'close_connections'):
module_store.close_connections()
@classmethod
def setUpClass(cls):
"""
Delete the existing modulestores, causing them to be reloaded.
"""
# Clear out any existing modulestores,
# which will cause them to be re-created
# the next time they are accessed.
clear_existing_modulestores()
TestCase.setUpClass()
def _pre_setup(self):
"""
Flush the ModuleStore.
"""
# Flush the Mongo modulestore
self.drop_mongo_collections()
# Call superclass implementation
super(ModuleStoreTestCase, self)._pre_setup()
def _post_teardown(self):
"""
Flush the ModuleStore after each test.
"""
self.drop_mongo_collections()
# Clear out the existing modulestores,
# which will cause them to be re-created
# the next time they are accessed.
# We do this at *both* setup and teardown just to be safe.
clear_existing_modulestores()
# clear RequestCache to emulate its clearance after each http request.
RequestCache().clear_request_cache()
# Call superclass implementation
super(ModuleStoreTestCase, self)._post_teardown()
def create_sample_course(self, org, course, run, block_info_tree=None, course_fields=None):
"""
create a course in the default modulestore from the collection of BlockInfo

View File

@@ -41,7 +41,6 @@ def mock_render_to_response(*args, **kwargs):
RENDER_MOCK = Mock(side_effect=mock_render_to_response)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class AnonymousIndexPageTest(ModuleStoreTestCase):
"""
Tests that anonymous users can access the '/' page, Need courses with start date
@@ -115,7 +114,6 @@ class AnonymousIndexPageTest(ModuleStoreTestCase):
self.assertEqual(response._headers.get("location")[1], "/login") # pylint: disable=protected-access
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class PreRequisiteCourseCatalog(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test to simulate and verify fix for disappearing courses in
@@ -163,7 +161,6 @@ class PreRequisiteCourseCatalog(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertIn('course that has pre requisite', resp.content)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class IndexPageCourseCardsSortingTests(ModuleStoreTestCase):
"""
Test for Index page course cards sorting

View File

@@ -19,7 +19,6 @@ from xmodule.modulestore.tests.factories import CourseFactory
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestOptoutCourseEmails(ModuleStoreTestCase):
"""

View File

@@ -92,7 +92,6 @@ class EmailSendFromDashboardTestCase(ModuleStoreTestCase):
patch.stopall()
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
class TestEmailSendFromDashboardMockedHtmlToText(EmailSendFromDashboardTestCase):
@@ -300,7 +299,6 @@ class TestEmailSendFromDashboardMockedHtmlToText(EmailSendFromDashboardTestCase)
self.assertItemsEqual(outbox_contents, should_send_contents)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
@skipIf(os.environ.get("TRAVIS") == 'true', "Skip this test in Travis CI.")
class TestEmailSendFromDashboard(EmailSendFromDashboardTestCase):

View File

@@ -38,7 +38,6 @@ class EmailTestException(Exception):
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
class TestEmailErrors(ModuleStoreTestCase):
"""

View File

@@ -18,7 +18,6 @@ from xmodule.modulestore.django import modulestore
from xmodule.modulestore import ModuleStoreEnum
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CourseAuthorizationFormTest(ModuleStoreTestCase):
"""Test the CourseAuthorizationAdminForm form for Mongo-backed courses."""
@@ -123,9 +122,9 @@ class CourseAuthorizationFormTest(ModuleStoreTestCase):
form.save()
@override_settings(MODULESTORE=TEST_DATA_MIXED_TOY_MODULESTORE)
class CourseAuthorizationXMLFormTest(ModuleStoreTestCase):
"""Check that XML courses cannot be authorized for email."""
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': True})
def test_xml_course_authorization(self):
@@ -146,7 +145,6 @@ class CourseAuthorizationXMLFormTest(ModuleStoreTestCase):
form.save()
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CourseEmailTemplateFormTest(ModuleStoreTestCase):
"""Test the CourseEmailTemplateForm that is used in the Django admin subsystem."""

View File

@@ -27,7 +27,6 @@ from class_dashboard.views import has_instructor_access_for_class
USER_COUNT = 11
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestGetProblemGradeDistribution(ModuleStoreTestCase):
"""
Tests related to class_dashboard/dashboard_data.py

View File

@@ -14,7 +14,6 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from class_dashboard import views
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestViews(ModuleStoreTestCase):
"""
Tests related to class_dashboard/views.py

View File

@@ -17,7 +17,6 @@ from course_wiki.utils import user_is_article_course_staff, course_wiki_slug
from course_wiki import settings
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestWikiAccessBase(ModuleStoreTestCase):
"""Base class for testing wiki access."""
def setUp(self):

View File

@@ -14,7 +14,6 @@ from xmodule.modulestore.tests.django_utils import TEST_DATA_MOCK_MODULESTORE
from course_wiki.views import get_or_create_root
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestWikiAccessMiddleware(ModuleStoreTestCase):
"""Tests for WikiAccessMiddleware."""

View File

@@ -2,14 +2,13 @@ from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from courseware.tests.tests import LoginEnrollmentTestCase
from xmodule.modulestore.tests.django_utils import TEST_DATA_MOCK_MODULESTORE
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from mock import patch
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class WikiRedirectTestCase(LoginEnrollmentTestCase):
class WikiRedirectTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for wiki course redirection.
"""

View File

@@ -200,17 +200,17 @@ class CommandsTestBase(TestCase):
assert_in('edX-simple-2012_Fall/sequential/Lecture_2.xml', names)
@override_settings(MODULESTORE=TEST_DATA_MIXED_XML_MODULESTORE)
class CommandsXMLTestCase(CommandsTestBase, ModuleStoreTestCase):
"""
Test case for management commands using the xml modulestore.
"""
MODULESTORE = TEST_DATA_MIXED_XML_MODULESTORE
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
class CommandsMongoTestCase(CommandsTestBase, ModuleStoreTestCase):
"""
Test case for management commands using the mixed mongo modulestore.
"""
MODULESTORE = TEST_DATA_MONGO_MODULESTORE

View File

@@ -24,7 +24,6 @@ from lms.djangoapps.lms_xblock.field_data import LmsFieldData
from lms.djangoapps.lms_xblock.runtime import quote_slashes
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
class BaseTestXmodule(ModuleStoreTestCase):
"""Base class for testing Xmodules with mongo store.
@@ -41,6 +40,8 @@ class BaseTestXmodule(ModuleStoreTestCase):
This class should not contain any tests, because CATEGORY
should be defined in child class.
"""
MODULESTORE = TEST_DATA_MONGO_MODULESTORE
USER_COUNT = 2
COURSE_DATA = {}

View File

@@ -33,7 +33,6 @@ 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_MOCK_MODULESTORE)
class AboutTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests about xblock.
@@ -182,11 +181,12 @@ class AboutTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertEqual(resp.status_code, 200)
@override_settings(MODULESTORE=TEST_DATA_MIXED_CLOSED_MODULESTORE)
class AboutTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for the course about page
"""
MODULESTORE = TEST_DATA_MIXED_CLOSED_MODULESTORE
# The following XML test course (which lives at common/test/data/2014)
# is closed; we're testing that an about page still appears when
# the course is already closed
@@ -212,7 +212,6 @@ class AboutTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertIn(self.xml_data, resp.content)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class AboutWithCappedEnrollmentsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
This test case will check the About page when a course has a capped enrollment
@@ -263,7 +262,6 @@ class AboutWithCappedEnrollmentsTestCase(LoginEnrollmentTestCase, ModuleStoreTes
self.assertNotIn(REG_STR, resp.content)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class AboutWithInvitationOnly(ModuleStoreTestCase):
"""
This test case will check the About page when a course is invitation only.
@@ -311,7 +309,6 @@ class AboutWithInvitationOnly(ModuleStoreTestCase):
@patch.dict(settings.FEATURES, {'RESTRICT_ENROLL_BY_REG_METHOD': True})
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class AboutTestCaseShibCourse(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Test cases covering about page behavior for courses that use shib enrollment domain ("shib courses")
@@ -351,7 +348,6 @@ class AboutTestCaseShibCourse(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertIn(REG_STR, resp.content)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class AboutWithClosedEnrollment(ModuleStoreTestCase):
"""
This test case will check the About page for a course that has enrollment start/end
@@ -395,7 +391,6 @@ class AboutWithClosedEnrollment(ModuleStoreTestCase):
self.assertNotIn('<span class="important-dates-item-text">$10</span>', resp.content)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch.dict(settings.FEATURES, {'ENABLE_SHOPPING_CART': True})
@patch.dict(settings.FEATURES, {'ENABLE_PAID_COURSE_REGISTRATION': True})
class AboutPurchaseCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):

View File

@@ -16,6 +16,7 @@ from xmodule.course_module import (
CATALOG_VISIBILITY_NONE
)
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from util.milestones_helpers import (
set_prerequisite_courses,
@@ -27,7 +28,7 @@ from util.milestones_helpers import (
# pylint: disable=protected-access
class AccessTestCase(LoginEnrollmentTestCase):
class AccessTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for the various access controls on the student dashboard
"""

View File

@@ -15,7 +15,6 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from .helpers import LoginEnrollmentTestCase
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CourseInfoTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for the Course Info page
@@ -49,11 +48,12 @@ class CourseInfoTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertNotIn("OOGIE BLOOGIE", resp.content)
@override_settings(MODULESTORE=TEST_DATA_MIXED_CLOSED_MODULESTORE)
class CourseInfoTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for the Course Info page for an XML course
"""
MODULESTORE = TEST_DATA_MIXED_CLOSED_MODULESTORE
# The following XML test course (which lives at common/test/data/2014)
# is closed; we're testing that a course info page still appears when
# the course is already closed

View File

@@ -9,10 +9,11 @@ from django.core.urlresolvers import reverse
from survey.models import SurveyForm
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from courseware.tests.helpers import LoginEnrollmentTestCase
class SurveyViewsTests(LoginEnrollmentTestCase):
class SurveyViewsTests(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
All tests for the views.py file
"""

View File

@@ -148,7 +148,6 @@ class XmlCourseImageTestCase(XModuleXmlImportTest):
self.assertEquals(course_image_url(course), u'/static/xml_test_course/before after.jpg')
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CoursesRenderTest(ModuleStoreTestCase):
"""Test methods related to rendering courses content."""
@@ -196,9 +195,10 @@ class CoursesRenderTest(ModuleStoreTestCase):
self.assertIn("this module is temporarily unavailable", course_about)
@override_settings(MODULESTORE=TEST_DATA_MIXED_TOY_MODULESTORE)
class XmlCoursesRenderTest(ModuleStoreTestCase):
"""Test methods related to rendering courses content for an XML course."""
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
toy_course_key = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall')
def test_get_course_info_section_render(self):

View File

@@ -7,7 +7,6 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey
from xmodule.modulestore.tests.django_utils import TEST_DATA_MOCK_MODULESTORE
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestDraftModuleStore(TestCase):
"""
Test the draft modulestore

View File

@@ -15,7 +15,6 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from util.milestones_helpers import generate_milestone_namespace, NAMESPACE_CHOICES
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class EntranceExamTestCases(ModuleStoreTestCase):
"""
Check that content is properly gated. Create a test course from scratch to mess with.

View File

@@ -27,7 +27,6 @@ def _grade_with_errors(student, request, course, keep_raw_scores=False):
return grade(student, request, course, keep_raw_scores=keep_raw_scores)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestGradeIteration(ModuleStoreTestCase):
"""
Test iteration through student gradesets.

View File

@@ -9,7 +9,7 @@ from django.test.utils import override_settings
from xmodule.modulestore.tests.django_utils import TEST_DATA_MOCK_MODULESTORE
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE, LANGUAGES=(('eo', 'Esperanto'),))
@override_settings(LANGUAGES=(('eo', 'Esperanto'),))
class I18nTestCase(TestCase):
"""
Tests for i18n

View File

@@ -124,7 +124,6 @@ class TestLTI(BaseTestXmodule):
self.assertEqual(generated_content, expected_content)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestLTIModuleListing(ModuleStoreTestCase):
"""
a test for the rest endpoint that lists LTI modules in a course

View File

@@ -20,7 +20,6 @@ from xmodule.modulestore.tests.factories import ItemFactory, CourseFactory
from xmodule.partitions.partitions import Group, UserPartition
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class MasqueradeTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Base class for masquerade tests that sets up a test course and enrolls a user in the course.

View File

@@ -14,7 +14,6 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestMicrosites(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
This is testing of the Microsite feature

View File

@@ -15,7 +15,6 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CoursewareMiddlewareTestCase(ModuleStoreTestCase):
"""Tests that courseware middleware is correctly redirected"""

View File

@@ -72,7 +72,6 @@ class EmptyXModuleDescriptor(XModuleDescriptor): # pylint: disable=abstract-met
@ddt.ddt
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class ModuleRenderTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Tests of courseware.module_render
@@ -248,7 +247,6 @@ class ModuleRenderTestCase(ModuleStoreTestCase, LoginEnrollmentTestCase):
render.get_module_for_descriptor(self.mock_user, request, descriptor, field_data_cache, self.toy_course.id)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestHandleXBlockCallback(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test the handle_xblock_callback function
@@ -403,7 +401,6 @@ class TestHandleXBlockCallback(ModuleStoreTestCase, LoginEnrollmentTestCase):
@ddt.ddt
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestTOC(ModuleStoreTestCase):
"""Check the Table of Contents for a course"""
def setup_modulestore(self, default_ms, num_finds, num_sends):
@@ -499,7 +496,6 @@ class TestTOC(ModuleStoreTestCase):
self.assertIn(toc_section, actual)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestHtmlModifiers(ModuleStoreTestCase):
"""
Tests to verify that standard modifications to the output of XModule/XBlock
@@ -695,7 +691,6 @@ class ViewInStudioTest(ModuleStoreTestCase):
self.module = self._get_module(course_key, descriptor, location)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class MongoViewInStudioTest(ViewInStudioTest):
"""Test the 'View in Studio' link visibility in a mongo backed course."""
@@ -724,12 +719,10 @@ class MongoViewInStudioTest(ViewInStudioTest):
self.assertNotIn('View Unit in Studio', result_fragment.content)
@override_settings(MODULESTORE=TEST_DATA_MIXED_TOY_MODULESTORE)
class MixedViewInStudioTest(ViewInStudioTest):
"""Test the 'View in Studio' link visibility in a mixed mongo backed course."""
def setUp(self):
super(MixedViewInStudioTest, self).setUp()
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
def test_view_in_studio_link_mongo_backed(self):
"""Mixed mongo courses that are mongo backed should see 'View in Studio' links."""
@@ -750,12 +743,9 @@ class MixedViewInStudioTest(ViewInStudioTest):
self.assertNotIn('View Unit in Studio', result_fragment.content)
@override_settings(MODULESTORE=TEST_DATA_XML_MODULESTORE)
class XmlViewInStudioTest(ViewInStudioTest):
"""Test the 'View in Studio' link visibility in an xml backed course."""
def setUp(self):
super(XmlViewInStudioTest, self).setUp()
MODULESTORE = TEST_DATA_XML_MODULESTORE
def test_view_in_studio_link_xml_backed(self):
"""Course in XML only modulestore should not see 'View in Studio' links."""
@@ -764,7 +754,6 @@ class XmlViewInStudioTest(ViewInStudioTest):
self.assertNotIn('View Unit in Studio', result_fragment.content)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch.dict('django.conf.settings.FEATURES', {'DISPLAY_DEBUG_INFO_TO_STAFF': True, 'DISPLAY_HISTOGRAMS_TO_STAFF': True})
@patch('courseware.module_render.has_access', Mock(return_value=True))
class TestStaffDebugInfo(ModuleStoreTestCase):
@@ -886,7 +875,6 @@ PER_STUDENT_ANONYMIZED_DESCRIPTORS = set(
@ddt.ddt
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestAnonymousStudentId(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test that anonymous_student_id is set correctly across a variety of XBlock types
@@ -954,7 +942,6 @@ class TestAnonymousStudentId(ModuleStoreTestCase, LoginEnrollmentTestCase):
)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch('track.views.tracker')
class TestModuleTrackingContext(ModuleStoreTestCase):
"""
@@ -1148,7 +1135,6 @@ class TestRebindModule(TestSubmittingProblems):
@ddt.ddt
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestEventPublishing(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Tests of event publishing for both XModules and XBlocks.

View File

@@ -14,7 +14,6 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestNavigation(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Check that navigation state is saved properly.

View File

@@ -20,10 +20,7 @@ from courseware.tests.factories import GlobalStaffFactory
from lms.djangoapps.lms_xblock.runtime import quote_slashes
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class TestRecommender(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Check that Recommender state is saved properly

View File

@@ -15,7 +15,6 @@ from xmodule.partitions.partitions import Group, UserPartition
from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class SplitTestBase(ModuleStoreTestCase):
"""
Sets up a basic course and user for split test testing.
@@ -271,7 +270,6 @@ class TestSplitTestVert(SplitTestBase):
html1 = self._html(cond1vert, 1)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class SplitTestPosition(ModuleStoreTestCase):
"""
Check that we can change positions in a course with partitions defined

View File

@@ -30,7 +30,6 @@ from xmodule.partitions.partitions import Group, UserPartition
from openedx.core.djangoapps.user_api.tests.factories import UserCourseTagFactory
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestSubmittingProblems(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Check that a course gets graded properly.
@@ -648,7 +647,6 @@ class ProblemWithUploadedFilesTest(TestSubmittingProblems):
self.assertItemsEqual(kwargs['files'].keys(), filenames.split())
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestPythonGradedResponse(TestSubmittingProblems):
"""
Check that we can submit a schematic and custom response, and it answers properly.

View File

@@ -26,10 +26,11 @@ if settings.FEATURES.get('MILESTONES_APP', False):
from milestones.models import MilestoneRelationshipType
@override_settings(MODULESTORE=TEST_DATA_MIXED_TOY_MODULESTORE)
class StaticTabDateTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""Test cases for Static Tab Dates."""
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
def setUp(self):
super(StaticTabDateTestCase, self).setUp()
self.course = CourseFactory.create()
@@ -76,11 +77,13 @@ class StaticTabDateTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertIn("this module is temporarily unavailable", static_tab)
@override_settings(MODULESTORE=TEST_DATA_MIXED_CLOSED_MODULESTORE)
class StaticTabDateTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Tests for the static tab dates of an XML course
"""
MODULESTORE = TEST_DATA_MIXED_CLOSED_MODULESTORE
# The following XML test course (which lives at common/test/data/2014)
# is closed; we're testing that tabs still appear when
# the course is already closed
@@ -107,11 +110,12 @@ class StaticTabDateTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase):
self.assertIn(self.xml_data, resp.content)
@override_settings(MODULESTORE=TEST_DATA_MIXED_CLOSED_MODULESTORE)
class EntranceExamsTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Validate tab behavior when dealing with Entrance Exams
"""
MODULESTORE = TEST_DATA_MIXED_CLOSED_MODULESTORE
if settings.FEATURES.get('ENTRANCE_EXAMS', False):
def setUp(self):

View File

@@ -22,7 +22,6 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from student.tests.factories import UserFactory, CourseEnrollmentFactory
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestViewAuth(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Check that view authentication works properly.
@@ -389,7 +388,6 @@ class TestViewAuth(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertTrue(self.enroll(self.course))
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestBetatesterAccess(ModuleStoreTestCase):
"""
Tests for the beta tester feature

View File

@@ -35,11 +35,11 @@ from util.tests.test_date_utils import fake_ugettext, fake_pgettext
from util.views import ensure_valid_course_key
@override_settings(MODULESTORE=TEST_DATA_MIXED_TOY_MODULESTORE)
class TestJumpTo(ModuleStoreTestCase):
"""
Check the jumpto link for a course.
"""
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
def setUp(self):
super(TestJumpTo, self).setUp()
@@ -77,8 +77,7 @@ class TestJumpTo(ModuleStoreTestCase):
@ddt.ddt
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class ViewsTestCase(TestCase):
class ViewsTestCase(ModuleStoreTestCase):
"""
Tests for views.py methods.
"""
@@ -467,7 +466,7 @@ class ViewsTestCase(TestCase):
# setting TIME_ZONE_DISPLAYED_FOR_DEADLINES explicitly
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE, TIME_ZONE_DISPLAYED_FOR_DEADLINES="UTC")
@override_settings(TIME_ZONE_DISPLAYED_FOR_DEADLINES="UTC")
class BaseDueDateTests(ModuleStoreTestCase):
"""
Base class that verifies that due dates are rendered correctly on a page
@@ -583,7 +582,6 @@ class TestAccordionDueDate(BaseDueDateTests):
)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class StartDateTests(ModuleStoreTestCase):
"""
Test that start dates are properly localized and displayed on the student
@@ -639,7 +637,6 @@ class StartDateTests(ModuleStoreTestCase):
self.assertIn("2015-JULY-17", text)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class ProgressPageTests(ModuleStoreTestCase):
"""
Tests that verify that the progress page works correctly.

View File

@@ -113,11 +113,11 @@ class PageLoaderTestCase(LoginEnrollmentTestCase):
self.assertNotIsInstance(descriptor, ErrorDescriptor)
@override_settings(MODULESTORE=XML_MODULESTORE)
class TestXmlCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
"""
Check that all pages in test courses load properly from XML.
"""
MODULESTORE = XML_MODULESTORE
def setUp(self):
super(TestXmlCoursesLoad, self).setUp()
@@ -130,11 +130,11 @@ class TestXmlCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
self.check_all_pages_load(SlashSeparatedCourseKey('edX', 'toy', '2012_Fall'))
@override_settings(MODULESTORE=TOY_MODULESTORE)
class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase):
"""
Check that all pages in test courses load properly from Mongo.
"""
MODULESTORE = TOY_MODULESTORE
def setUp(self):
super(TestMongoCoursesLoad, self).setUp()

View File

@@ -35,7 +35,6 @@ FEATURES_WITH_SSL_AUTH = settings.FEATURES.copy()
FEATURES_WITH_SSL_AUTH['AUTH_USE_CERTIFICATES'] = True
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@override_settings(MONGODB_LOG=TEST_MONGODB_LOG)
@unittest.skipUnless(settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD'),
"ENABLE_SYSADMIN_DASHBOARD not set")

View File

@@ -16,7 +16,6 @@ from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class RefundTests(ModuleStoreTestCase):
"""
Tests for the manual refund page

View File

@@ -115,7 +115,6 @@ class SysadminBaseTestCase(ModuleStoreTestCase):
self.addCleanup(shutil.rmtree, path)
@override_settings(MODULESTORE=TEST_DATA_XML_MODULESTORE)
@unittest.skipUnless(settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD'),
"ENABLE_SYSADMIN_DASHBOARD not set")
@override_settings(GIT_IMPORT_WITH_XMLMODULESTORE=True)
@@ -123,6 +122,7 @@ class TestSysadmin(SysadminBaseTestCase):
"""
Test sysadmin dashboard features using XMLModuleStore
"""
MODULESTORE = TEST_DATA_XML_MODULESTORE
def test_staff_access(self):
"""Test access controls."""
@@ -405,7 +405,6 @@ class TestSysadmin(SysadminBaseTestCase):
@override_settings(MONGODB_LOG=TEST_MONGODB_LOG)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@unittest.skipUnless(settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD'),
"ENABLE_SYSADMIN_DASHBOARD not set")
class TestSysAdminMongoCourseImport(SysadminBaseTestCase):

View File

@@ -162,7 +162,6 @@ class ThreadActionGroupIdTestCase(
)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch('lms.lib.comment_client.utils.requests.request')
class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
@@ -750,7 +749,6 @@ class ViewsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
@patch("lms.lib.comment_client.utils.requests.request")
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class ViewPermissionsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSetupMixin):
@patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
def setUp(self):
@@ -844,7 +842,6 @@ class ViewPermissionsTestCase(UrlResetMixin, ModuleStoreTestCase, MockRequestSet
self.assertEqual(response.status_code, 200)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CreateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin):
def setUp(self):
super(CreateThreadUnicodeTestCase, self).setUp()
@@ -868,7 +865,6 @@ class CreateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq
self.assertEqual(mock_request.call_args[1]["data"]["title"], text)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class UpdateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin):
def setUp(self):
super(UpdateThreadUnicodeTestCase, self).setUp()
@@ -898,7 +894,6 @@ class UpdateThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockReq
self.assertEqual(mock_request.call_args[1]["data"]["commentable_id"], "test_commentable")
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CreateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin):
def setUp(self):
super(CreateCommentUnicodeTestCase, self).setUp()
@@ -923,7 +918,6 @@ class CreateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRe
self.assertEqual(mock_request.call_args[1]["data"]["body"], text)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class UpdateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin):
def setUp(self):
super(UpdateCommentUnicodeTestCase, self).setUp()
@@ -949,7 +943,6 @@ class UpdateCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRe
self.assertEqual(mock_request.call_args[1]["data"]["body"], text)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CreateSubCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, MockRequestSetupMixin):
def setUp(self):
super(CreateSubCommentUnicodeTestCase, self).setUp()
@@ -975,7 +968,6 @@ class CreateSubCommentUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin, Moc
self.assertEqual(mock_request.call_args[1]["data"]["body"], text)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class UsersEndpointTestCase(ModuleStoreTestCase, MockRequestSetupMixin):
def set_post_counts(self, mock_request, threads_count=1, comments_count=1):

View File

@@ -38,7 +38,6 @@ log = logging.getLogger(__name__)
# pylint: disable=missing-docstring
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class ViewsExceptionTestCase(UrlResetMixin, ModuleStoreTestCase):
@patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
@@ -182,7 +181,6 @@ class PartialDictMatcher(object):
])
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch('requests.request')
class SingleThreadTestCase(ModuleStoreTestCase):
def setUp(self):
@@ -295,12 +293,12 @@ class SingleThreadTestCase(ModuleStoreTestCase):
@ddt.ddt
@patch('requests.request')
@override_settings(MODULESTORE=TEST_DATA_MONGO_MODULESTORE)
class SingleThreadQueryCountTestCase(ModuleStoreTestCase):
"""
Ensures the number of modulestore queries is deterministic based on the
number of responses retrieved for a given discussion thread.
"""
MODULESTORE = TEST_DATA_MONGO_MODULESTORE
@ddt.data(
# old mongo: number of responses plus 16. TODO: O(n)!
@@ -341,7 +339,6 @@ class SingleThreadQueryCountTestCase(ModuleStoreTestCase):
self.assertEquals(len(json.loads(response.content)["content"]["children"]), num_thread_responses)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch('requests.request')
class SingleCohortedThreadTestCase(CohortedContentTestCase):
def _create_mock_cohorted_thread(self, mock_request):
@@ -834,7 +831,6 @@ class FollowedThreadsDiscussionGroupIdTestCase(CohortedContentTestCase, Cohorted
)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class InlineDiscussionTestCase(ModuleStoreTestCase):
def setUp(self):
super(InlineDiscussionTestCase, self).setUp()
@@ -866,7 +862,6 @@ class InlineDiscussionTestCase(ModuleStoreTestCase):
self.assertEqual(response_data["discussion_data"][0]["courseware_title"], expected_courseware_title)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch('requests.request')
class UserProfileTestCase(ModuleStoreTestCase):
@@ -980,7 +975,6 @@ class UserProfileTestCase(ModuleStoreTestCase):
self.assertEqual(response.status_code, 405)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch('requests.request')
class CommentsServiceRequestHeadersTestCase(UrlResetMixin, ModuleStoreTestCase):
@patch.dict("django.conf.settings.FEATURES", {"ENABLE_DISCUSSION_SERVICE": True})
@@ -991,7 +985,7 @@ class CommentsServiceRequestHeadersTestCase(UrlResetMixin, ModuleStoreTestCase):
password = "bar"
# Invoke UrlResetMixin
super(CommentsServiceRequestHeadersTestCase, self).setUp()
super(CommentsServiceRequestHeadersTestCase, self).setUp(create_user=False)
self.course = CourseFactory.create()
self.student = UserFactory.create(username=username, password=password)
CourseEnrollmentFactory.create(user=self.student, course_id=self.course.id)
@@ -1043,7 +1037,6 @@ class CommentsServiceRequestHeadersTestCase(UrlResetMixin, ModuleStoreTestCase):
self.assert_all_calls_have_header(mock_request, "X-Edx-Api-Key", "test_api_key")
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class InlineDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
def setUp(self):
super(InlineDiscussionUnicodeTestCase, self).setUp()
@@ -1065,7 +1058,6 @@ class InlineDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
self.assertEqual(response_data["discussion_data"][0]["body"], text)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class ForumFormDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
def setUp(self):
super(ForumFormDiscussionUnicodeTestCase, self).setUp()
@@ -1088,7 +1080,6 @@ class ForumFormDiscussionUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
self.assertEqual(response_data["discussion_data"][0]["body"], text)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class ForumDiscussionSearchUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
def setUp(self):
super(ForumDiscussionSearchUnicodeTestCase, self).setUp()
@@ -1115,7 +1106,6 @@ class ForumDiscussionSearchUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin
self.assertEqual(response_data["discussion_data"][0]["body"], text)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class SingleThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
def setUp(self):
super(SingleThreadUnicodeTestCase, self).setUp()
@@ -1139,7 +1129,6 @@ class SingleThreadUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
self.assertEqual(response_data["content"]["body"], text)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class UserProfileUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
def setUp(self):
super(UserProfileUnicodeTestCase, self).setUp()
@@ -1162,7 +1151,6 @@ class UserProfileUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
self.assertEqual(response_data["discussion_data"][0]["body"], text)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class FollowedThreadsUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
def setUp(self):
super(FollowedThreadsUnicodeTestCase, self).setUp()
@@ -1185,7 +1173,6 @@ class FollowedThreadsUnicodeTestCase(ModuleStoreTestCase, UnicodeTestMixin):
self.assertEqual(response_data["discussion_data"][0]["body"], text)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class EnrollmentTestCase(ModuleStoreTestCase):
"""
Tests for the behavior of views depending on if the student is enrolled

View File

@@ -10,11 +10,12 @@ import django_comment_common.models as models
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@override_settings(MODULESTORE=TEST_DATA_MIXED_TOY_MODULESTORE)
class RoleClassTestCase(ModuleStoreTestCase):
"""
Tests for roles of the comment client service integration
"""
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
def setUp(self):
super(RoleClassTestCase, self).setUp()

View File

@@ -42,7 +42,6 @@ class DictionaryTestCase(TestCase):
self.assertEqual(utils.merge_dict(d1, d2), expected)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class AccessUtilsTestCase(ModuleStoreTestCase):
"""
Base testcase class for access and roles for the
@@ -85,7 +84,6 @@ class AccessUtilsTestCase(ModuleStoreTestCase):
self.assertFalse(ret)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CoursewareContextTestCase(ModuleStoreTestCase):
"""
Base testcase class for courseware context for the
@@ -148,7 +146,6 @@ class CoursewareContextTestCase(ModuleStoreTestCase):
assertThreadCorrect(threads[1], self.discussion2, "Subsection / Discussion 2")
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CategoryMapTestCase(ModuleStoreTestCase):
"""
Base testcase class for discussion categories for the

View File

@@ -10,7 +10,6 @@ from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CohortedContentTestCase(ModuleStoreTestCase):
"""
Sets up a course with a student, a moderator and their cohorts.

View File

@@ -56,7 +56,7 @@ class TestProblem(object):
@skipUnless(settings.FEATURES["ENABLE_EDXNOTES"], "EdxNotes feature needs to be enabled.")
class EdxNotesDecoratorTest(TestCase):
class EdxNotesDecoratorTest(ModuleStoreTestCase):
"""
Tests for edxnotes decorator.
"""
@@ -775,7 +775,7 @@ class EdxNotesHelpersTest(ModuleStoreTestCase):
@skipUnless(settings.FEATURES["ENABLE_EDXNOTES"], "EdxNotes feature needs to be enabled.")
class EdxNotesViewsTest(TestCase):
class EdxNotesViewsTest(ModuleStoreTestCase):
"""
Tests for EdxNotes views.
"""

View File

@@ -29,7 +29,6 @@ from instructor.utils import get_module_for_student
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class OpenEndedPostTest(ModuleStoreTestCase):
"""Test the openended_post management command."""
@@ -131,7 +130,6 @@ class OpenEndedPostTest(ModuleStoreTestCase):
self.assertFalse(result)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class OpenEndedStatsTest(ModuleStoreTestCase):
"""Test the openended_stats management command."""

View File

@@ -19,7 +19,6 @@ from instructor.access import (allow_access,
update_forum_role)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestInstructorAccessList(ModuleStoreTestCase):
""" Test access listings. """
def setUp(self):
@@ -43,7 +42,6 @@ class TestInstructorAccessList(ModuleStoreTestCase):
self.assertEqual(set(beta_testers), set(self.beta_testers))
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestInstructorAccessAllow(ModuleStoreTestCase):
""" Test access allow. """
def setUp(self):
@@ -79,7 +77,6 @@ class TestInstructorAccessAllow(ModuleStoreTestCase):
allow_access(self.course, user, 'staff')
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestInstructorAccessRevoke(ModuleStoreTestCase):
""" Test access revoke. """
def setUp(self):
@@ -115,7 +112,6 @@ class TestInstructorAccessRevoke(ModuleStoreTestCase):
revoke_access(self.course, user, 'robot-not-a-level')
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestInstructorAccessForum(ModuleStoreTestCase):
"""
Test forum access control.

View File

@@ -144,7 +144,6 @@ class TestCommonExceptions400(TestCase):
self.assertIn("Task is already running", result["error"])
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
@@ -301,7 +300,6 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch.dict(settings.FEATURES, {'ALLOW_AUTOMATED_SIGNUPS': True})
class TestInstructorAPIBulkAccountCreationAndEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
@@ -551,7 +549,6 @@ class TestInstructorAPIBulkAccountCreationAndEnrollment(ModuleStoreTestCase, Log
@ddt.ddt
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test enrollment modification endpoint.
@@ -1139,7 +1136,6 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
@ddt.ddt
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test bulk beta modify access endpoint.
@@ -1454,7 +1450,6 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test endpoints whereby instructors can change permissions
@@ -1694,7 +1689,6 @@ class TestInstructorAPILevelsAccess(ModuleStoreTestCase, LoginEnrollmentTestCase
@ddt.ddt
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True})
class TestInstructorAPILevelsDataDump(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
@@ -2157,7 +2151,6 @@ class TestInstructorAPILevelsDataDump(ModuleStoreTestCase, LoginEnrollmentTestCa
self.assertEqual(response.status_code, 400)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test endpoints whereby instructors can change student grades.
@@ -2298,7 +2291,6 @@ class TestInstructorAPIRegradeTask(ModuleStoreTestCase, LoginEnrollmentTestCase)
self.assertTrue(act.called)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch('bulk_email.models.html_to_text', Mock(return_value='Mocking CourseEmail.text_message'))
@patch.dict(settings.FEATURES, {'ENABLE_INSTRUCTOR_EMAIL': True, 'REQUIRE_COURSE_EMAIL_AUTH': False})
class TestInstructorSendEmail(ModuleStoreTestCase, LoginEnrollmentTestCase):
@@ -2383,7 +2375,6 @@ class MockCompletionInfo(object):
return False, 'Task Errored In Some Way'
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test instructor task list endpoint.
@@ -2547,7 +2538,6 @@ class TestInstructorAPITaskLists(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.assertEqual(actual_tasks, expected_tasks)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch.object(instructor_task.api, 'get_instructor_task_history')
class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
@@ -2685,7 +2675,6 @@ class TestInstructorEmailContentList(ModuleStoreTestCase, LoginEnrollmentTestCas
@ddt.ddt
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@override_settings(ANALYTICS_SERVER_URL="http://robotanalyticsserver.netbot:900/")
@override_settings(ANALYTICS_API_KEY="robot_api_key")
class TestInstructorAPIAnalyticsProxy(ModuleStoreTestCase, LoginEnrollmentTestCase):
@@ -2869,7 +2858,6 @@ class TestInstructorAPIHelpers(TestCase):
msk_from_problem_urlname(*args)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestDueDateExtensions(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Test data dumps for reporting.
@@ -3058,7 +3046,6 @@ class TestDueDateExtensions(ModuleStoreTestCase, LoginEnrollmentTestCase):
self.user1.profile.name, self.user1.username)})
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@override_settings(REGISTRATION_CODE_LENGTH=8)
class TestCourseRegistrationCodes(ModuleStoreTestCase):
"""
@@ -3510,7 +3497,6 @@ class TestCourseRegistrationCodes(ModuleStoreTestCase):
self.assertTrue(body.startswith(EXPECTED_COUPON_CSV_HEADER))
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestBulkCohorting(ModuleStoreTestCase):
"""
Test adding users to cohorts in bulk via CSV upload.

View File

@@ -5,7 +5,6 @@ Unit tests for the localization of emails sent by instructor.api methods.
from django.core import mail
from django.core.urlresolvers import reverse
from django.test import TestCase
from courseware.tests.factories import InstructorFactory
from lang_pref import LANGUAGE_KEY
@@ -13,9 +12,10 @@ from student.models import CourseEnrollment
from student.tests.factories import UserFactory
from openedx.core.djangoapps.user_api.models import UserPreference
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
class TestInstructorAPIEnrollmentEmailLocalization(TestCase):
class TestInstructorAPIEnrollmentEmailLocalization(ModuleStoreTestCase):
"""
Test whether the enroll, unenroll and beta role emails are sent in the
proper language, i.e: the student's language.

View File

@@ -17,7 +17,6 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestECommerceDashboardViews(ModuleStoreTestCase):
"""
Check for E-commerce view on the new instructor dashboard

View File

@@ -16,7 +16,6 @@ from student.tests.factories import AdminFactory
from xmodule.modulestore.tests.factories import CourseFactory
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase):
"""
Check for email view on the new instructor dashboard
@@ -106,7 +105,6 @@ class TestNewInstructorDashboardEmailViewMongoBacked(ModuleStoreTestCase):
self.assertFalse(self.email_link in response.content)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestNewInstructorDashboardEmailViewXMLBacked(ModuleStoreTestCase):
"""
Check for email view on the new instructor dashboard

View File

@@ -292,7 +292,6 @@ class TestInstructorUnenrollDB(TestEnrollmentChangeBase):
return self._run_state_change_test(before_ideal, after_ideal, action)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestInstructorEnrollmentStudentModule(TestCase):
""" Test student module manipulations. """
def setUp(self):
@@ -439,7 +438,6 @@ class TestSendBetaRoleEmail(TestCase):
send_beta_role_email(bad_action, self.user, self.email_params)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestGetEmailParams(ModuleStoreTestCase):
"""
Test what URLs the function get_email_params returns under different
@@ -484,7 +482,7 @@ class TestGetEmailParams(ModuleStoreTestCase):
self.assertEqual(result['course_url'], self.course_url)
class TestRenderMessageToString(TestCase):
class TestRenderMessageToString(ModuleStoreTestCase):
"""
Test that email templates can be rendered in a language chosen manually.
"""

View File

@@ -15,7 +15,6 @@ from xmodule.modulestore.tests.factories import CourseFactory
# pylint: disable=missing-docstring
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class HintManagerTest(ModuleStoreTestCase):
def setUp(self):

View File

@@ -22,7 +22,6 @@ USER_COUNT = 4
@ddt.ddt
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestInstructorEnrollsStudent(ModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Check Enrollment/Unenrollment with/without auto-enrollment on activation and with/without email notification

View File

@@ -18,7 +18,6 @@ from instructor.views import legacy
# pylint: disable=missing-docstring
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestXss(ModuleStoreTestCase):
def setUp(self):
super(TestXss, self).setUp()

View File

@@ -16,7 +16,6 @@ from xmodule.modulestore.django import modulestore
USER_COUNT = 11
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestGradebook(ModuleStoreTestCase):
"""
Test functionality of the spoc gradebook. Sets up a course with assignments and

View File

@@ -98,7 +98,6 @@ class TestParseDatetime(unittest.TestCase):
tools.parse_datetime('foo')
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestFindUnit(ModuleStoreTestCase):
"""
Test the find_unit function.
@@ -134,7 +133,6 @@ class TestFindUnit(ModuleStoreTestCase):
tools.find_unit(self.course, url)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestGetUnitsWithDueDate(ModuleStoreTestCase):
"""
Test the get_units_with_due_date function.
@@ -184,7 +182,6 @@ class TestTitleOrUrl(unittest.TestCase):
self.assertEquals(tools.title_or_url(unit), 'test:hello')
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestSetDueDateExtension(ModuleStoreTestCase):
"""
Test the set_due_date_extensions function.
@@ -260,7 +257,6 @@ class TestSetDueDateExtension(ModuleStoreTestCase):
self.assertEqual(self.extended_due(self.homework), None)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestDataDumps(ModuleStoreTestCase):
"""
Test data dumps for reporting.

View File

@@ -100,7 +100,6 @@ class InstructorTaskTestCase(TestCase):
return self._create_entry(task_state=task_state, task_output=progress, student=student)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class InstructorTaskCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase):
"""
Base test class for InstructorTask-related tests that require
@@ -185,7 +184,6 @@ class InstructorTaskCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase)
return request
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class InstructorTaskModuleTestCase(InstructorTaskCourseTestCase):
"""
Base test class for InstructorTask-related tests that require

View File

@@ -146,7 +146,6 @@ class LicenseTestCase(TestCase):
self.assertEqual(302, response.status_code)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CommandTest(ModuleStoreTestCase):
'''Test management command for importing serial numbers'''
def setUp(self):

View File

@@ -16,10 +16,11 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from oauth2_provider.tests import IDTokenTestCase, UserInfoTestCase
@override_settings(MODULESTORE=TEST_DATA_MIXED_TOY_MODULESTORE)
class BaseTestMixin(ModuleStoreTestCase):
profile = None
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
def setUp(self):
super(BaseTestMixin, self).setUp()

View File

@@ -104,13 +104,13 @@ class StudentProblemListMockQuery(object):
}
@override_settings(MODULESTORE=TEST_DATA_MIXED_TOY_MODULESTORE)
class TestStaffGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
'''
Check that staff grading service proxy works. Basically just checking the
access control and error handling logic -- all the actual work is on the
backend.
'''
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
def setUp(self):
super(TestStaffGradingService, self).setUp()
@@ -258,7 +258,6 @@ class TestStaffGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestPeerGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
'''
Check that staff grading service proxy works. Basically just checking the
@@ -446,7 +445,6 @@ class TestPeerGradingService(ModuleStoreTestCase, LoginEnrollmentTestCase):
)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestPanel(ModuleStoreTestCase):
"""
Run tests on the open ended panel
@@ -491,7 +489,6 @@ class TestPanel(ModuleStoreTestCase):
self.assertRegexpMatches(response.content, "Here is a list of open ended problems for this course.")
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestPeerGradingFound(ModuleStoreTestCase):
"""
Test to see if peer grading modules can be found properly.
@@ -514,7 +511,6 @@ class TestPeerGradingFound(ModuleStoreTestCase):
self.assertEqual(found, False)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class TestStudentProblemList(ModuleStoreTestCase):
"""
Test if the student problem list correctly fetches and parses problems.

View File

@@ -16,7 +16,6 @@ from shoppingcart.models import Order, PaidCourseRegistration
from shoppingcart.context_processor import user_has_cart_context_processor
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class UserCartContextProcessorUnitTest(ModuleStoreTestCase):
"""
Unit test for shoppingcart context_processor

View File

@@ -20,11 +20,6 @@ from student.tests.factories import UserFactory
from course_modes.models import CourseMode
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
def fake_all_orgs(default=None): # pylint: disable=unused-argument
"""
create a fake list of all microsites
@@ -46,7 +41,6 @@ def non_microsite(name, default=None): # pylint: disable=unused-argument
return None
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True})
class TestOrderHistoryOnMicrositeDashboard(ModuleStoreTestCase):
"""

View File

@@ -41,12 +41,7 @@ from shoppingcart.exceptions import (
from opaque_keys.edx.locator import CourseLocator
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@ddt.ddt
class OrderTest(ModuleStoreTestCase):
def setUp(self):
@@ -404,7 +399,6 @@ class OrderItemTest(TestCase):
self.assertEquals(set([]), inst_set)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class PaidCourseRegistrationTest(ModuleStoreTestCase):
def setUp(self):
super(PaidCourseRegistrationTest, self).setUp()
@@ -545,7 +539,6 @@ class PaidCourseRegistrationTest(ModuleStoreTestCase):
self.assertTrue(PaidCourseRegistration.contained_in_order(cart, self.course_key))
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class CertificateItemTest(ModuleStoreTestCase):
"""
Tests for verifying specific CertificateItem functionality
@@ -781,7 +774,6 @@ class CertificateItemTest(ModuleStoreTestCase):
self.assertFalse(ret_val)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class DonationTest(ModuleStoreTestCase):
"""Tests for the donation order item type. """

View File

@@ -22,7 +22,6 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class ReportTypeTests(ModuleStoreTestCase):
"""
Tests for the models used to generate certificate status reports
@@ -180,7 +179,6 @@ class ReportTypeTests(ModuleStoreTestCase):
self.assertEqual(csv.replace('\r\n', '\n').strip(), self.CORRECT_UNI_REVENUE_SHARE_CSV.strip())
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class ItemizedPurchaseReportTest(ModuleStoreTestCase):
"""
Tests for the models used to generate itemized purchase reports

View File

@@ -62,12 +62,6 @@ render_mock = Mock(side_effect=mock_render_to_response)
postpay_mock = Mock()
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True})
@ddt.ddt
class ShoppingCartViewsTests(ModuleStoreTestCase):
@@ -1255,7 +1249,6 @@ class ShoppingCartViewsTests(ModuleStoreTestCase):
self._assert_404(reverse('shoppingcart.views.billing_details', args=[]))
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class ReceiptRedirectTest(ModuleStoreTestCase):
"""Test special-case redirect from the receipt page. """
@@ -1317,7 +1310,6 @@ class ReceiptRedirectTest(ModuleStoreTestCase):
self.assertRedirects(resp, redirect_url)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True})
class ShoppingcartViewsClosedEnrollment(ModuleStoreTestCase):
"""
@@ -1431,7 +1423,6 @@ class ShoppingcartViewsClosedEnrollment(ModuleStoreTestCase):
self.assertIn('40.00', resp.content)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_PAID_COURSE_REGISTRATION': True})
class RegistrationCodeRedemptionCourseEnrollment(ModuleStoreTestCase):
"""
@@ -1562,7 +1553,6 @@ class RegistrationCodeRedemptionCourseEnrollment(ModuleStoreTestCase):
self.assertIn(self.course.display_name, response.content)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@ddt.ddt
class DonationViewTest(ModuleStoreTestCase):
"""Tests for making a donation.
@@ -1720,7 +1710,6 @@ class DonationViewTest(ModuleStoreTestCase):
return reverse("shoppingcart.views.show_receipt", kwargs={"ordernum": order_id})
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class CSVReportViewsTest(ModuleStoreTestCase):
"""
Test suite for CSV Purchase Reporting

View File

@@ -46,7 +46,6 @@ HTML_BOOK = {
}
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class StaticBookTest(ModuleStoreTestCase):
"""
Helpers for the static book tests.

View File

@@ -26,9 +26,6 @@ from xmodule.modulestore.tests.factories import CourseFactory
from student.tests.factories import CourseModeFactory
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@ddt.ddt
class StudentAccountUpdateTest(UrlResetMixin, TestCase):
""" Tests for the student account views that update the user's account information. """
@@ -377,7 +374,6 @@ class StudentAccountUpdateTest(UrlResetMixin, TestCase):
@ddt.ddt
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class StudentAccountLoginAndRegistrationTest(ModuleStoreTestCase):
""" Tests for the student account views that update the user's account information. """

View File

@@ -11,11 +11,12 @@ from django.contrib.auth.models import User
from survey.models import SurveyForm
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from survey.utils import is_survey_required_for_course, must_answer_survey
class SurveyModelsTests(TestCase):
class SurveyModelsTests(ModuleStoreTestCase):
"""
All tests for the utils.py file
"""

View File

@@ -13,9 +13,10 @@ from django.core.urlresolvers import reverse
from survey.models import SurveyForm
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
class SurveyViewsTests(TestCase):
class SurveyViewsTests(ModuleStoreTestCase):
"""
All tests for the views.py file
"""

View File

@@ -14,12 +14,6 @@ from student.models import CourseEnrollment
from course_modes.tests.factories import CourseModeFactory
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class TestProfEdVerification(ModuleStoreTestCase):
"""
Integration test for professional ed verification, including course mode selection.

View File

@@ -505,7 +505,6 @@ class TestPhotoVerification(TestCase):
self.assertEqual(result, second_attempt)
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
@patch.dict(settings.VERIFY_STUDENT, FAKE_SETTINGS)
@patch('verify_student.models.S3Connection', new=MockS3Connection)
@patch('verify_student.models.Key', new=MockKey)

View File

@@ -37,11 +37,6 @@ from verify_student.models import SoftwareSecurePhotoVerification
from reverification.tests.factories import MidcourseReverificationWindowFactory
# Since we don't need any XML course fixtures, use a modulestore configuration
# that disables the XML modulestore.
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
def mock_render_to_response(*args, **kwargs):
return render_to_response(*args, **kwargs)
@@ -64,7 +59,6 @@ class StartView(TestCase):
self.assertHttpForbidden(self.client.get(self.start_url()))
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
@ddt.ddt
class TestPayAndVerifyView(ModuleStoreTestCase):
"""
@@ -769,7 +763,6 @@ class TestPayAndVerifyView(ModuleStoreTestCase):
self.assertRedirects(response, url)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class TestCreateOrder(ModuleStoreTestCase):
"""
Tests for the create order view.
@@ -854,7 +847,6 @@ class TestCreateOrder(ModuleStoreTestCase):
attempt.approve()
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class TestCreateOrderView(ModuleStoreTestCase):
"""
Tests for the create_order view of verified course enrollment process.
@@ -1126,7 +1118,6 @@ class TestSubmitPhotosForVerification(TestCase):
self.assertEqual(info['full_name'], full_name)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class TestPhotoVerificationResultsCallback(ModuleStoreTestCase):
"""
Tests for the results_callback view.
@@ -1343,7 +1334,6 @@ class TestPhotoVerificationResultsCallback(ModuleStoreTestCase):
self.assertIsNotNone(CourseEnrollment.objects.get(course_id=self.course_id))
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class TestReverifyView(ModuleStoreTestCase):
"""
Tests for the reverification views
@@ -1392,7 +1382,6 @@ class TestReverifyView(ModuleStoreTestCase):
self.assertTrue(context['error'])
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class TestMidCourseReverifyView(ModuleStoreTestCase):
"""
Tests for the midcourse reverification views.
@@ -1515,7 +1504,6 @@ class TestMidCourseReverifyView(ModuleStoreTestCase):
self.assertEqual(response.status_code, 404)
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class TestReverificationBanner(ModuleStoreTestCase):
"""
Tests for toggling the "midcourse reverification failed" banner off.

View File

@@ -8,7 +8,7 @@ from xblock.validation import ValidationMessage
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.modulestore_settings import update_module_store_settings
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_MIXED_TOY_MODULESTORE
from xmodule.partitions.partitions import Group, UserPartition
@@ -147,16 +147,7 @@ class XBlockGetParentTest(LmsXBlockMixinTestCase):
Test that XBlock.get_parent returns correct results with each modulestore
backend.
"""
def _pre_setup(self):
# load the one xml course into the xml store
update_module_store_settings(
settings.MODULESTORE,
mappings={'edX/toy/2012_Fall': ModuleStoreEnum.Type.xml},
xml_store_options={
'data_dir': settings.COMMON_TEST_DATA_ROOT # where toy course lives
},
)
super(XBlockGetParentTest, self)._pre_setup()
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split, ModuleStoreEnum.Type.xml)
def test_parents(self, modulestore_type):

View File

@@ -9,6 +9,7 @@ from django.core.urlresolvers import reverse
from edxmako import add_lookup, LOOKUP
from lms import startup
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from util import keyword_substitution
@@ -43,7 +44,7 @@ class TemplateLookupTests(TestCase):
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_FEEDBACK_SUBMISSION': True})
class HelpModalTests(TestCase):
class HelpModalTests(ModuleStoreTestCase):
"""Tests for the help modal"""
def setUp(self):
super(HelpModalTests, self).setUp()

View File

@@ -10,20 +10,12 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey
from student.models import CourseEnrollment
from student.tests.factories import UserFactory
from xmodule.modulestore.django import modulestore, clear_existing_modulestores
from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_TOY_MODULESTORE, mixed_store_config
from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_TOY_MODULESTORE, mixed_store_config, ModuleStoreTestCase
from ..models import CourseUserGroup, CourseUserGroupPartitionGroup
from .. import cohorts
from ..tests.helpers import topic_name_to_id, config_course_cohorts, CohortFactory
# NOTE: running this with the lms.envs.test config works without
# manually overriding the modulestore. However, running with
# cms.envs.test doesn't.
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
TEST_MAPPING = {'edX/toy/2012_Fall': 'xml'}
TEST_DATA_MIXED_MODULESTORE = mixed_store_config(TEST_DATA_DIR, TEST_MAPPING)
@patch("openedx.core.djangoapps.course_groups.cohorts.tracker")
class TestCohortSignals(TestCase):
@@ -123,11 +115,12 @@ class TestCohortSignals(TestCase):
self.assertFalse(mock_tracker.emit.called)
@override_settings(MODULESTORE=TEST_DATA_MIXED_TOY_MODULESTORE)
class TestCohorts(TestCase):
class TestCohorts(ModuleStoreTestCase):
"""
Test the cohorts feature
"""
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
def setUp(self):
"""
Make sure that course is reloaded every time--clear out the modulestore.
@@ -595,8 +588,8 @@ class TestCohorts(TestCase):
)
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
class TestCohortsAndPartitionGroups(TestCase):
class TestCohortsAndPartitionGroups(ModuleStoreTestCase):
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
def setUp(self):
"""

View File

@@ -15,7 +15,7 @@ from courseware.tests.test_masquerade import StaffMasqueradeTestCase
from student.tests.factories import UserFactory
from xmodule.partitions.partitions import Group, UserPartition, UserPartitionError
from xmodule.modulestore.django import modulestore, clear_existing_modulestores
from xmodule.modulestore.tests.django_utils import mixed_store_config
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, mixed_store_config, TEST_DATA_MIXED_TOY_MODULESTORE
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme
@@ -26,16 +26,11 @@ from ..cohorts import add_user_to_cohort, get_course_cohorts
from .helpers import CohortFactory, config_course_cohorts
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
TEST_MAPPING = {'edX/toy/2012_Fall': 'xml'}
TEST_DATA_MIXED_MODULESTORE = mixed_store_config(TEST_DATA_DIR, TEST_MAPPING, include_xml=True)
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
class TestCohortPartitionScheme(django.test.TestCase):
class TestCohortPartitionScheme(ModuleStoreTestCase):
"""
Test the logic for linking a user to a partition group based on their cohort.
"""
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
def setUp(self):
"""
@@ -274,11 +269,12 @@ class TestExtension(django.test.TestCase):
UserPartition.get_scheme('other')
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
class TestGetCohortedUserPartition(django.test.TestCase):
class TestGetCohortedUserPartition(ModuleStoreTestCase):
"""
Test that `get_cohorted_user_partition` returns the first user_partition with scheme `CohortPartitionScheme`.
"""
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
def setUp(self):
"""
Regenerate a course with cohort configuration, partition and groups,

View File

@@ -29,7 +29,6 @@ from ..cohorts import (
from .helpers import config_course_cohorts, CohortFactory
@override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE)
class CohortViewsTestCase(ModuleStoreTestCase):
"""
Base class which sets up a course and staff/non-staff users.

View File

@@ -24,12 +24,8 @@ from openedx.core.djangoapps.user_api.models import UserOrgTag
from openedx.core.djangoapps.user_api.management.commands import email_opt_in_list
MODULESTORE_CONFIG = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}, include_xml=False)
@ddt.ddt
@skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
@override_settings(MODULESTORE=MODULESTORE_CONFIG)
class EmailOptInListTest(ModuleStoreTestCase):
"""Tests for the email opt-in list management command. """

Some files were not shown because too many files have changed in this diff Show More