Merge pull request #29911 from openedx/mikix/more-old-mongo-test-cleanup

test: more Old Mongo removal from tests
This commit is contained in:
Michael Terry
2022-02-11 15:10:45 -05:00
committed by GitHub
42 changed files with 577 additions and 878 deletions

View File

@@ -11,7 +11,7 @@ import pytest
from django.conf import settings
from django.urls import reverse
from openedx_events.tests.utils import OpenEdxEventsTestMixin
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, SharedModuleStoreTestCase
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from common.djangoapps.course_modes.models import CourseMode
@@ -31,12 +31,11 @@ from openedx.core.djangoapps.embargo.test_utils import restrict_course
@ddt.ddt
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_SPECIAL_EXAMS': True})
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
class EnrollmentTest(UrlResetMixin, SharedModuleStoreTestCase, OpenEdxEventsTestMixin):
class EnrollmentTest(UrlResetMixin, ModuleStoreTestCase, OpenEdxEventsTestMixin):
"""
Test student enrollment, especially with different course modes.
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
ENABLED_OPENEDX_EVENTS = []
USERNAME = "Bob"
@@ -54,23 +53,21 @@ class EnrollmentTest(UrlResetMixin, SharedModuleStoreTestCase, OpenEdxEventsTest
"""
super().setUpClass()
cls.start_events_isolation()
cls.course = CourseFactory.create()
cls.course_limited = CourseFactory.create()
cls.proctored_course = CourseFactory(
enable_proctored_exams=True, enable_timed_exams=True
)
cls.proctored_course_no_exam = CourseFactory(
enable_proctored_exams=True, enable_timed_exams=True
)
@patch.dict(settings.FEATURES, {'EMBARGO': True})
def setUp(self):
""" Create a course and user, then log in. """
super().setUp()
self.course = CourseFactory.create()
self.course_limited = CourseFactory.create(max_student_enrollments_allowed=1)
self.proctored_course = CourseFactory(
enable_proctored_exams=True, enable_timed_exams=True
)
self.proctored_course_no_exam = CourseFactory(
enable_proctored_exams=True, enable_timed_exams=True
)
self.user = UserFactory.create(username=self.USERNAME, email=self.EMAIL, password=self.PASSWORD)
self.client.login(username=self.USERNAME, password=self.PASSWORD)
self.course_limited.max_student_enrollments_allowed = 1
self.store.update_item(self.course_limited, self.user.id)
self.urls = [
reverse('course_modes_choose', kwargs={'course_id': str(self.course.id)})
]
@@ -87,7 +84,7 @@ class EnrollmentTest(UrlResetMixin, SharedModuleStoreTestCase, OpenEdxEventsTest
ItemFactory.create(
parent=chapter, category='sequential', display_name='Test Proctored Exam',
graded=True, is_time_limited=True, default_time_limit_minutes=10,
is_proctored_exam=True, publish_item=True
is_proctored_enabled=True, publish_item=True
)
@ddt.data(