-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Clean up all modulestore testcases #6078
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,23 +2,24 @@ | |
| ''' | ||
| Utilities for contentstore tests | ||
| ''' | ||
|
|
||
| import json | ||
|
|
||
| from django.test.client import Client | ||
| from django.conf import settings | ||
| from django.contrib.auth.models import User | ||
| from django.test.client import Client | ||
| from django.test.utils import override_settings | ||
| from opaque_keys.edx.locations import SlashSeparatedCourseKey, AssetLocation | ||
|
|
||
| from contentstore.utils import reverse_url | ||
| from student.models import Registration | ||
| from xmodule.modulestore.split_mongo.split import SplitMongoModuleStore | ||
| from xmodule.contentstore.django import contentstore | ||
| from xmodule.modulestore import ModuleStoreEnum | ||
| from xmodule.modulestore.inheritance import own_metadata | ||
| from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase | ||
| from xmodule.modulestore.tests.django_utils import TEST_DATA_MOCK_MODULESTORE | ||
| from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory | ||
| from xmodule.modulestore.xml_importer import import_from_xml | ||
| 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 | ||
|
|
||
|
|
@@ -66,7 +67,12 @@ def get_json(self, path, data=None, follow=False, **extra): | |
| return self.get(path, data or {}, follow, HTTP_ACCEPT="application/json", **extra) | ||
|
|
||
|
|
||
| @override_settings(MODULESTORE=TEST_DATA_MOCK_MODULESTORE) | ||
| class CourseTestCase(ModuleStoreTestCase): | ||
| """ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks SO much for the doc. I had wanted to docstring this and other classes before but didn't understand them enough to describe them. Very useful to have doc! |
||
| Base class for Studio tests that require a logged in user and a course. | ||
| Also provides helper methods for manipulating and verifying the course. | ||
| """ | ||
| def setUp(self): | ||
| """ | ||
| These tests need a user in the DB so that the django Test Client can log them in. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
| Provides unit tests for SSL based authentication portions | ||
| of the external_auth app. | ||
| """ | ||
|
|
||
| import unittest | ||
|
|
||
| from django.conf import settings | ||
|
|
@@ -13,17 +12,16 @@ | |
| from django.test.client import Client | ||
| from django.test.client import RequestFactory | ||
| from django.test.utils import override_settings | ||
| from mock import Mock | ||
|
|
||
| import external_auth.views | ||
| from edxmako.middleware import MakoMiddleware | ||
| from external_auth.models import ExternalAuthMap | ||
| from opaque_keys import InvalidKeyError | ||
| import external_auth.views | ||
| from mock import Mock | ||
|
|
||
| from student.models import CourseEnrollment | ||
| from student.roles import CourseStaffRole | ||
| from student.tests.factories import UserFactory | ||
| from xmodule.modulestore.tests.django_utils import (ModuleStoreTestCase, | ||
| mixed_store_config) | ||
| from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: either combine this or move it up a few lines to be under the other 'from xmodule.modulstore.tests.django_utils' |
||
| from xmodule.modulestore.tests.django_utils import TEST_DATA_MOCK_MODULESTORE | ||
| from xmodule.modulestore.tests.factories import CourseFactory | ||
|
|
||
| FEATURES_WITH_SSL_AUTH = settings.FEATURES.copy() | ||
|
|
@@ -35,8 +33,6 @@ | |
| FEATURES_WITHOUT_SSL_AUTH = settings.FEATURES.copy() | ||
| FEATURES_WITHOUT_SSL_AUTH['AUTH_USE_CERTIFICATES'] = False | ||
|
|
||
| TEST_DATA_MIXED_MODULESTORE = mixed_store_config(settings.COMMON_TEST_DATA_ROOT, {}) | ||
|
|
||
|
|
||
| @override_settings(FEATURES=FEATURES_WITH_SSL_AUTH) | ||
| class SSLClientTest(ModuleStoreTestCase): | ||
|
|
@@ -325,7 +321,7 @@ def test_ssl_decorator_auto_signup(self): | |
|
|
||
| @unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') | ||
| @override_settings(FEATURES=FEATURES_WITH_SSL_AUTH_AUTO_ACTIVATE, | ||
| MODULESTORE=TEST_DATA_MIXED_MODULESTORE) | ||
| MODULESTORE=TEST_DATA_MOCK_MODULESTORE) | ||
| def test_ssl_lms_redirection(self): | ||
| """ | ||
| Auto signup auth user and ensure they return to the original | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review note: This will make sure that the studio tests use the lightest weight modulestore by default. The studio testcases rely on this CourseTestCase class rather than ModuleStoreTestCase directly.