test: switch default test store to the split store
It's long past time that the default test modulestore was Split, instead of Old Mongo. This commit switches the default store and fixes some tests that now fail: - Tests that didn't expect MFE to be enabled (because we don't enable MFE for Old Mongo) - opt out of MFE for those - Tests that hardcoded old key string formats - Lots of other random little differences In many places, I didn't spend much time trying to figure out how to properly fix the test, and instead just set the modulestore to Old Mongo. For those tests that I didn't spend time investigating, I've set the modulestore to TEST_DATA_MONGO_AMNESTY_MODULESTORE - search for that string to find further work.
This commit is contained in:
@@ -18,6 +18,10 @@ from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imp
|
||||
from django.urls import reverse
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locations import Location
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
|
||||
from capa.tests.response_xml_factory import OptionResponseXMLFactory
|
||||
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory, UserFactory
|
||||
@@ -29,10 +33,6 @@ from lms.djangoapps.instructor_task.tests.factories import InstructorTaskFactory
|
||||
from lms.djangoapps.instructor_task.views import instructor_task_status
|
||||
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
|
||||
from openedx.core.lib.url_utils import quote_slashes
|
||||
from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
TEST_COURSE_ORG = 'edx'
|
||||
TEST_COURSE_NAME = 'test_course'
|
||||
@@ -108,6 +108,7 @@ class InstructorTaskCourseTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase)
|
||||
Base test class for InstructorTask-related tests that require
|
||||
the setup of a course.
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
|
||||
course = None
|
||||
current_user = None
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ from collections import OrderedDict
|
||||
from contextlib import ExitStack, contextmanager
|
||||
from datetime import datetime, timedelta
|
||||
from unittest.mock import ANY, MagicMock, Mock, patch
|
||||
from urllib.parse import quote
|
||||
|
||||
import ddt
|
||||
import unicodecsv
|
||||
@@ -2573,8 +2572,8 @@ class TestInstructorOra2Report(SharedModuleStoreTestCase):
|
||||
return_val = upload_ora2_data(None, None, self.course.id, None, 'generated')
|
||||
|
||||
timestamp_str = datetime.now(UTC).strftime('%Y-%m-%d-%H%M')
|
||||
course_id_string = quote(str(self.course.id).replace('/', '_'))
|
||||
filename = f'{course_id_string}_ORA_data_{timestamp_str}.csv'
|
||||
key = self.course.id
|
||||
filename = f'{key.org}_{key.course}_{key.run}_ORA_data_{timestamp_str}.csv'
|
||||
|
||||
assert return_val == UPDATE_STATUS_SUCCEEDED
|
||||
mock_store_rows.assert_called_once_with(self.course.id, filename, [test_header] + test_rows, '')
|
||||
@@ -2626,8 +2625,8 @@ class TestInstructorOra2AttachmentsExport(SharedModuleStoreTestCase):
|
||||
return_val = upload_ora2_summary(None, None, self.course.id, None, 'generated')
|
||||
|
||||
timestamp_str = datetime.now(UTC).strftime('%Y-%m-%d-%H%M')
|
||||
course_id_string = quote(str(self.course.id).replace('/', '_'))
|
||||
filename = f'{course_id_string}_ORA_summary_{timestamp_str}.csv'
|
||||
key = self.course.id
|
||||
filename = f'{key.org}_{key.course}_{key.run}_ORA_summary_{timestamp_str}.csv'
|
||||
|
||||
self.assertEqual(return_val, UPDATE_STATUS_SUCCEEDED)
|
||||
mock_store_rows.assert_called_once_with(self.course.id, filename, [test_header] + test_rows, '')
|
||||
|
||||
Reference in New Issue
Block a user