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:
Michael Terry
2022-02-01 14:01:26 -05:00
parent a6a27104cd
commit cb1bb7fa64
140 changed files with 707 additions and 596 deletions

View File

@@ -10,6 +10,7 @@ from django.test import TestCase
from edx_django_utils.cache import RequestCache
from opaque_keys.edx.keys import CourseKey
from testfixtures import LogCapture
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from common.djangoapps.student.api import get_course_access_role
from common.djangoapps.student.roles import CourseStaffRole
@@ -363,7 +364,7 @@ class TestLinkProgramEnrollments(TestLinkProgramEnrollmentsMixin, TestCase):
self._assert_user_enrolled_in_program_courses(self.user_2, self.program, self.fruit_course, self.animal_course)
class TestLinkProgramEnrollmentsErrors(TestLinkProgramEnrollmentsMixin, TestCase):
class TestLinkProgramEnrollmentsErrors(TestLinkProgramEnrollmentsMixin, ModuleStoreTestCase):
""" Tests for linking error behavior """
def test_program_enrollment_not_found__nonexistant(self):

View File

@@ -20,6 +20,9 @@ from organizations.tests.factories import OrganizationFactory as LMSOrganization
from rest_framework import status
from rest_framework.test import APITestCase
from social_django.models import UserSocialAuth
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory as ModulestoreCourseFactory
from xmodule.modulestore.tests.factories import ItemFactory
from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.student.models import CourseEnrollment
@@ -52,9 +55,6 @@ from openedx.core.djangoapps.catalog.tests.factories import (
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.djangoapps.content.course_overviews.tests.factories import CourseOverviewFactory
from openedx.core.djangolib.testing.utils import CacheIsolationMixin
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.factories import CourseFactory as ModulestoreCourseFactory # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.factories import ItemFactory # lint-amnesty, pylint: disable=wrong-import-order
from .. import views
from ..constants import (
@@ -96,6 +96,7 @@ class EnrollmentsDataMixin(ProgramCacheMixin):
Mixin to define some shared test data objects for program/course enrollment
view tests.
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
view_name = 'SET-ME-IN-SUBCLASS'
@classmethod
@@ -1636,6 +1637,8 @@ class ProgramCourseEnrollmentOverviewGetTests(
"""
Tests for the ProgramCourseEnrollmentOverview view GET method.
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
patch_resume_url = mock.patch(
_UTILS_PATCH_FORMAT.format('get_resume_urls_for_enrollments'),
autospec=True,