-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11467 from edx/perf/speed-up-student-tests
Switch to SharedModuleStoreTestCase in the 'student' app where possible.
- Loading branch information
Showing
7 changed files
with
60 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
from django.conf import settings | ||
from django.core.urlresolvers import reverse | ||
from course_modes.models import CourseMode | ||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase | ||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase | ||
from xmodule.modulestore.tests.factories import CourseFactory | ||
from util.testing import UrlResetMixin | ||
from embargo.test_utils import restrict_course | ||
|
@@ -18,7 +18,7 @@ | |
|
||
@ddt.ddt | ||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms') | ||
class EnrollmentTest(UrlResetMixin, ModuleStoreTestCase): | ||
class EnrollmentTest(UrlResetMixin, SharedModuleStoreTestCase): | ||
""" | ||
Test student enrollment, especially with different course modes. | ||
""" | ||
|
@@ -27,11 +27,15 @@ class EnrollmentTest(UrlResetMixin, ModuleStoreTestCase): | |
EMAIL = "[email protected]" | ||
PASSWORD = "edx" | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
super(EnrollmentTest, cls).setUpClass() | ||
cls.course = CourseFactory.create() | ||
|
||
@patch.dict(settings.FEATURES, {'EMBARGO': True}) | ||
def setUp(self): | ||
""" Create a course and user, then log in. """ | ||
super(EnrollmentTest, self).setUp('embargo') | ||
self.course = CourseFactory.create() | ||
self.user = UserFactory.create(username=self.USERNAME, email=self.EMAIL, password=self.PASSWORD) | ||
self.client.login(username=self.USERNAME, password=self.PASSWORD) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,10 +41,14 @@ class RefundableTest(SharedModuleStoreTestCase): | |
Tests for dashboard utility functions | ||
""" | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
super(RefundableTest, cls).setUpClass() | ||
cls.course = CourseFactory.create() | ||
|
||
def setUp(self): | ||
""" Setup components used by each refund test.""" | ||
super(RefundableTest, self).setUp() | ||
self.course = CourseFactory.create() | ||
self.user = UserFactory.create(username="jack", email="[email protected]", password='test') | ||
self.verified_mode = CourseModeFactory.create( | ||
course_id=self.course.id, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters