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

@@ -12,13 +12,13 @@ import pytz
from freezegun import freeze_time
from opaque_keys.edx.keys import UsageKey
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
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, check_mongo_calls
from openedx.core.djangolib.testing.utils import skip_unless_lms
from common.djangoapps.student.tests.factories import AdminFactory, UserFactory
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, check_mongo_calls # lint-amnesty, pylint: disable=wrong-import-order
from .. import DEFAULT_FIELDS, OPTIONAL_FIELDS, PathItem
from ..models import Bookmark, XBlockCache, parse_path_data
@@ -35,6 +35,7 @@ class BookmarksTestsBase(ModuleStoreTestCase):
"""
Test the Bookmark model.
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
ALL_FIELDS = DEFAULT_FIELDS + OPTIONAL_FIELDS
STORE_TYPE = ModuleStoreEnum.Type.mongo
TEST_PASSWORD = 'test'

View File

@@ -6,6 +6,7 @@ Tests for tasks.
import ddt
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE
from xmodule.modulestore.tests.factories import ItemFactory, check_mongo_calls
from ..models import XBlockCache
@@ -18,6 +19,7 @@ class XBlockCacheTaskTests(BookmarksTestsBase):
"""
Test the XBlockCache model.
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
def setUp(self):
super().setUp()

View File

@@ -11,9 +11,10 @@ import ddt
from django.conf import settings
from django.urls import reverse
from rest_framework.test import APIClient
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE
from openedx.core.djangolib.testing.utils import skip_unless_lms
from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order
from .test_api import BookmarkApiEventTestMixin
from .test_models import BookmarksTestsBase
@@ -71,6 +72,7 @@ class BookmarksListViewTests(BookmarksViewsTestsBase):
GET /api/bookmarks/v1/bookmarks/?course_id={course_id1}
POST /api/bookmarks/v1/bookmarks
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
@ddt.data(
(1, False),

View File

@@ -8,12 +8,12 @@ from urllib import parse
import pytest
import pytz
from opaque_keys.edx.keys import CourseKey
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from openedx.core.djangoapps.ccxcon import api as ccxconapi
from common.djangoapps.student.tests.factories import AdminFactory
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, SharedModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory # lint-amnesty, pylint: disable=wrong-import-order
from .factories import CcxConFactory
@@ -36,8 +36,6 @@ class APIsTestCase(SharedModuleStoreTestCase):
"""
Unit tests for the API module functions
"""
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
@classmethod
def setUpClass(cls):
super().setUpClass()

View File

@@ -39,7 +39,7 @@ class CourseBlocksSignalTest(ModuleStoreTestCase):
assert test_display_name != orig_block_structure.get_xblock_field(self.course_usage_key, 'display_name')
self.course.display_name = test_display_name
self.store.update_item(self.course, self.user.id)
self.update_course(self.course, self.user.id)
# Cached version of course has been updated
updated_block_structure = bs_manager.get_collected()
@@ -52,7 +52,7 @@ class CourseBlocksSignalTest(ModuleStoreTestCase):
with override_waffle_switch(INVALIDATE_CACHE_ON_PUBLISH, active=invalidate_cache_enabled):
self.course.display_name = test_display_name
self.store.update_item(self.course, self.user.id)
self.update_course(self.course, self.user.id)
assert mock_bs_manager_clear.called == invalidate_cache_enabled

View File

@@ -9,7 +9,7 @@ import ddt
from xmodule.data import CertificatesDisplayBehaviors
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, check_mongo_calls
from ..models import CourseOverview
@@ -23,6 +23,7 @@ class CourseOverviewSignalsTestCase(ModuleStoreTestCase):
"""
Tests for CourseOverview signals.
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
ENABLED_SIGNALS = ['course_deleted', 'course_published']
TODAY = datetime.datetime.utcnow()
NEXT_WEEK = TODAY + datetime.timedelta(days=7)

View File

@@ -16,14 +16,13 @@ from django.conf import settings
from django.test import RequestFactory
from django.test.client import Client
from django.test.utils import override_settings
from opaque_keys import InvalidKeyError
from xmodule.contentstore.django import contentstore
from xmodule.contentstore.content import StaticContent, VERSIONED_ASSETS_PREFIX
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_MODULESTORE, SharedModuleStoreTestCase
from xmodule.modulestore.xml_importer import import_course_from_xml
from xmodule.assetstore.assetmgr import AssetManager
from opaque_keys import InvalidKeyError # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.exceptions import ItemNotFoundError
from common.djangoapps.student.models import CourseEnrollment
@@ -74,6 +73,7 @@ class ContentStoreToyCourseTest(SharedModuleStoreTestCase):
"""
Tests that use the toy course.
"""
MODULESTORE = TEST_DATA_MONGO_MODULESTORE
@classmethod
def setUpClass(cls):

View File

@@ -2,8 +2,11 @@
from datetime import timedelta
from unittest.mock import patch # lint-amnesty, pylint: disable=wrong-import-order
from edx_toggles.toggles.testutils import override_waffle_flag
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from cms.djangoapps.contentstore.config.waffle import CUSTOM_RELATIVE_DATES
from edx_toggles.toggles.testutils import override_waffle_flag # lint-amnesty, pylint: disable=wrong-import-order
from openedx.core.djangoapps.course_date_signals.handlers import (
_gather_graded_items,
_get_custom_pacing_children,
@@ -11,12 +14,13 @@ from openedx.core.djangoapps.course_date_signals.handlers import (
extract_dates_from_course
)
from openedx.core.djangoapps.course_date_signals.models import SelfPacedRelativeDatesConfig
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
from . import utils
class SelfPacedDueDatesTests(ModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
def setUp(self):
super().setUp()
self.course = CourseFactory.create()
@@ -200,6 +204,8 @@ class SelfPacedCustomDueDateTests(ModuleStoreTestCase):
"""
Tests the custom Personalized Learner Schedule (PLS) dates in self paced courses
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
def setUp(self):
super().setUp()
SelfPacedRelativeDatesConfig.objects.create(enabled=True)

View File

@@ -273,7 +273,7 @@ class TestModuleStoreSerializer(TestDumpToNeo4jCommandBase):
'test_block_type', 'test_block_id'
).for_branch(
'test_branch'
).for_version('test_version')
).for_version(b'test_version')
assert location.branch is not None
assert location.version_guid is not None

View File

@@ -8,7 +8,7 @@ from django.http import JsonResponse
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from opaque_keys.edx.keys import CourseKey, UsageKey
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreIsolationMixin
from xmodule.modulestore.tests.django_utils import ModuleStoreIsolationMixin
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, ToyCourseFactory
from common.djangoapps.course_modes.models import CourseMode
@@ -21,7 +21,6 @@ class ProviderState(ModuleStoreIsolationMixin):
""" Provider State Setup """
COURSE_KEY = "course-v1:edX+DemoX+Demo_Course"
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
def clean_db(self, user, course_key):
""" Utility method to clean db """

View File

@@ -17,7 +17,7 @@ from edx_django_utils.cache import TieredCache
from edx_toggles.toggles.testutils import override_waffle_flag
from xmodule.data import CertificatesDisplayBehaviors
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, SharedModuleStoreTestCase
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import ItemFactory, ToyCourseFactory
from xmodule.partitions.partitions import ENROLLMENT_TRACK_PARTITION_ID
@@ -56,8 +56,6 @@ class BaseCoursewareTests(SharedModuleStoreTestCase):
"""
Base class for courseware API tests
"""
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
@classmethod
def setUpClass(cls):
super().setUpClass()

View File

@@ -7,6 +7,9 @@ from unittest import mock
from django.conf import settings
from opaque_keys.edx.keys import CourseKey
from pytest import mark
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
@@ -16,9 +19,6 @@ from openedx.core.djangoapps.catalog.tests.factories import (
)
from openedx.core.djangolib.testing.utils import skip_unless_lms
from openedx.features.enterprise_support.tests.factories import EnterpriseCustomerUserFactory
from xmodule.modulestore.django import modulestore # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.factories import CourseFactory # lint-amnesty, pylint: disable=wrong-import-order
if settings.ROOT_URLCONF == 'lms.urls':
from openedx.core.djangoapps.demographics.api.status import show_user_demographics, show_call_to_action_for_user
@@ -33,8 +33,6 @@ class TestShowDemographics(SharedModuleStoreTestCase):
"""
Tests for whether the demographics collection fields should be shown
"""
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
@classmethod
def setUpClass(cls):
super().setUpClass()

View File

@@ -4,10 +4,11 @@ Tests for discussions tasks.
import ddt
import mock
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from openedx.core.djangoapps.discussions.data import DiscussionTopicContext
from openedx.core.djangoapps.discussions.tasks import update_discussions_settings_from_course
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
@ddt.ddt
@@ -16,6 +17,8 @@ class UpdateDiscussionsSettingsFromCourseTestCase(ModuleStoreTestCase):
"""
Tests for the discussions settings update tasks
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
def setUp(self):
super().setUp()
self.course = course = CourseFactory.create()

View File

@@ -2,7 +2,7 @@
Tests for discussions course block transformer
"""
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from lms.djangoapps.course_blocks.api import get_course_blocks
@@ -16,7 +16,6 @@ class DiscussionsTopicLinkTransformerTestCase(TransformerRegistryTestMixin, Modu
Tests behaviour of BlockCompletionTransformer
"""
TRANSFORMER_CLASS_TO_TEST = DiscussionsTopicLinkTransformer
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
def setUp(self):
super().setUp()

View File

@@ -9,12 +9,14 @@ from config_models.models import cache as config_cache
from django.conf import settings
from django.core.cache import cache as django_cache
from django.urls import reverse
from edx_toggles.toggles.testutils import override_waffle_flag
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from openedx.core.djangolib.testing.utils import skip_unless_lms
from common.djangoapps.student.tests.factories import UserFactory
from common.djangoapps.util.testing import UrlResetMixin
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.factories import CourseFactory # lint-amnesty, pylint: disable=wrong-import-order
from lms.djangoapps.course_home_api.toggles import COURSE_HOME_USE_LEGACY_FRONTEND
from ..models import IPFilter, RestrictedCourse
from ..test_utils import restrict_course
@@ -22,6 +24,7 @@ from ..test_utils import restrict_course
@ddt.ddt
@skip_unless_lms
@override_waffle_flag(COURSE_HOME_USE_LEGACY_FRONTEND, active=True)
class EmbargoMiddlewareAccessTests(UrlResetMixin, ModuleStoreTestCase):
"""Tests of embargo middleware country access rules.

View File

@@ -9,6 +9,8 @@ import itertools
import json
import unittest
from unittest.mock import patch
from urllib.parse import quote
import pytest
import ddt
import httpretty
@@ -23,6 +25,8 @@ from django.urls import reverse
from freezegun import freeze_time
from rest_framework import status
from rest_framework.test import APITestCase
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, check_mongo_calls_range
from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
@@ -43,8 +47,6 @@ from common.djangoapps.student.roles import CourseStaffRole
from common.djangoapps.student.tests.factories import AdminFactory, SuperuserFactory, UserFactory
from common.djangoapps.util.models import RateLimitConfiguration
from common.djangoapps.util.testing import UrlResetMixin
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.factories import CourseFactory, check_mongo_calls_range # lint-amnesty, pylint: disable=wrong-import-order
class EnrollmentTestMixin:
@@ -1598,6 +1600,7 @@ class CourseEnrollmentsApiListTest(APITestCase, ModuleStoreTestCase):
"""
Test the course enrollments list API.
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
CREATED_DATA = datetime.datetime(2018, 1, 1, 0, 0, 1, tzinfo=pytz.UTC)
def setUp(self):
@@ -1698,12 +1701,12 @@ class CourseEnrollmentsApiListTest(APITestCase, ModuleStoreTestCase):
def test_user_not_authenticated(self):
self.client.logout()
response = self.client.get(self.url, {'course_id': str(self.course.id)})
response = self.client.get(self.url, {'course_id': quote(str(self.course.id))})
assert response.status_code == status.HTTP_401_UNAUTHORIZED
def test_user_not_authorized(self):
self.client.login(username=self.student1.username, password='edx')
response = self.client.get(self.url, {'course_id': str(self.course.id)})
response = self.client.get(self.url, {'course_id': quote(str(self.course.id))})
assert response.status_code == status.HTTP_403_FORBIDDEN
@ddt.data(

View File

@@ -10,12 +10,12 @@ from pytz import UTC
from unittest.mock import patch # lint-amnesty, pylint: disable=wrong-import-order
from django.conf import settings
from xmodule.modulestore import ModuleStoreEnum
from xmodule.data import CertificatesDisplayBehaviors
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from openedx.core.djangoapps.models.course_details import ABOUT_ATTRIBUTES, CourseDetails
from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.data import CertificatesDisplayBehaviors # 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 # lint-amnesty, pylint: disable=wrong-import-order
EXAMPLE_CERTIFICATE_AVAILABLE_DATE = datetime.date(2020, 1, 1)
@@ -25,6 +25,7 @@ class CourseDetailsTestCase(ModuleStoreTestCase):
"""
Tests the first course settings page (course dates, overview, etc.).
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
def setUp(self):
super().setUp()

View File

@@ -16,6 +16,10 @@ from django.test.utils import override_settings
from django.urls import reverse
from pytz import utc
from testfixtures import LogCapture
from xmodule.data import CertificatesDisplayBehaviors
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory as ModuleStoreCourseFactory
from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
@@ -49,12 +53,6 @@ from openedx.core.djangoapps.site_configuration.tests.factories import SiteFacto
from openedx.core.djangolib.testing.utils import skip_unless_lms
from common.djangoapps.student.tests.factories import AnonymousUserFactory, CourseEnrollmentFactory, UserFactory
from common.djangoapps.util.date_utils import strftime_localized
from xmodule.data import CertificatesDisplayBehaviors # 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 ( # lint-amnesty, pylint: disable=wrong-import-order
ModuleStoreTestCase, SharedModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE
)
from xmodule.modulestore.tests.factories import CourseFactory as ModuleStoreCourseFactory # lint-amnesty, pylint: disable=wrong-import-order
ECOMMERCE_URL_ROOT = 'https://ecommerce.example.com'
UTILS_MODULE = 'openedx.core.djangoapps.programs.utils'
@@ -1654,7 +1652,6 @@ class TestProgramEnrollment(SharedModuleStoreTestCase):
Requests to the data in the Program cache are mocked out.
"""
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
MICROBACHELORS = 'microbachelors'
@classmethod

View File

@@ -1,7 +1,11 @@
# lint-amnesty, pylint: disable=missing-module-docstring
import datetime
from unittest.mock import patch
import pytest
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from openedx.core.djangoapps.schedules.content_highlights import (
course_has_highlights_from_store,
get_all_course_highlights,
@@ -12,14 +16,10 @@ from openedx.core.djangoapps.schedules.exceptions import CourseUpdateDoesNotExis
from openedx.core.djangolib.testing.utils import skip_unless_lms
from common.djangoapps.student.models import CourseEnrollment
from common.djangoapps.student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory # lint-amnesty, pylint: disable=wrong-import-order
@skip_unless_lms
class TestContentHighlights(ModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
def setUp(self):
super().setUp()
self._setup_course()

View File

@@ -206,6 +206,8 @@ class TestCourseNextSectionUpdateResolver(SchedulesResolverTestMixin, ModuleStor
"""
Tests the TestCourseNextSectionUpdateResolver.
"""
ENABLED_SIGNALS = ['course_published']
def setUp(self):
super().setUp()
self.today = datetime.datetime.utcnow()

View File

@@ -20,7 +20,7 @@ from openedx.core.djangolib.testing.utils import skip_unless_lms
from common.djangoapps.student.models import CourseEnrollment
from common.djangoapps.student.tests.factories import CourseEnrollmentFactory
from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, SharedModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.factories import CourseFactory # lint-amnesty, pylint: disable=wrong-import-order
from ..models import Schedule
@@ -94,7 +94,7 @@ class CreateScheduleTests(SharedModuleStoreTestCase): # lint-amnesty, pylint: d
@ddt.ddt
@skip_unless_lms
class UpdateScheduleTests(SharedModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring
class UpdateScheduleTests(ModuleStoreTestCase): # lint-amnesty, pylint: disable=missing-class-docstring
ENABLED_SIGNALS = ['course_published']
VERIFICATION_DEADLINE_DAYS = 14
@@ -115,7 +115,7 @@ class UpdateScheduleTests(SharedModuleStoreTestCase): # lint-amnesty, pylint: d
self.assert_schedule_dates(enrollment.schedule, enrollment.course.start)
course.start = course.start + datetime.timedelta(days=3) # new course start changes to another future date
self.store.update_item(course, ModuleStoreEnum.UserID.test)
self.update_course(course, ModuleStoreEnum.UserID.test)
enrollment = CourseEnrollment.objects.get(id=enrollment.id)
self.assert_schedule_dates(enrollment.schedule, course.start) # start set to new course start
@@ -125,7 +125,7 @@ class UpdateScheduleTests(SharedModuleStoreTestCase): # lint-amnesty, pylint: d
self.assert_schedule_dates(enrollment.schedule, enrollment.created)
course.start = course.start + datetime.timedelta(days=3) # new course start changes to another future date
self.store.update_item(course, ModuleStoreEnum.UserID.test)
self.update_course(course, ModuleStoreEnum.UserID.test)
enrollment = CourseEnrollment.objects.get(id=enrollment.id)
self.assert_schedule_dates(enrollment.schedule, course.start) # start set to new course start
@@ -136,7 +136,7 @@ class UpdateScheduleTests(SharedModuleStoreTestCase): # lint-amnesty, pylint: d
self.assert_schedule_dates(enrollment.schedule, previous_start)
course.start = course.start + datetime.timedelta(days=-10) # new course start changes to a past date
self.store.update_item(course, ModuleStoreEnum.UserID.test)
self.update_course(course, ModuleStoreEnum.UserID.test)
enrollment = CourseEnrollment.objects.get(id=enrollment.id)
self.assert_schedule_dates(enrollment.schedule, course.start) # start set to new course start

View File

@@ -122,7 +122,8 @@ class CompletionUtilsTestCase(SharedModuleStoreTestCase, CompletionWaffleTestMix
self.cruft_user
)
assert block_url ==\
'test_url:9999/courses/{org}/{course}/{run}/jump_to/i4x://{org}/{course}/vertical/{vertical_id}'.format(
'test_url:9999/courses/course-v1:{org}+{course}+{run}/jump_to/'\
'block-v1:{org}+{course}+{run}+type@vertical+block@{vertical_id}'.format(
org=self.course.location.course_key.org,
course=self.course.location.course_key.course,
run=self.course.location.course_key.run,

View File

@@ -11,6 +11,8 @@ from ddt import data, ddt, unpack
from django.conf import settings
from milestones import api as milestones_api
from milestones.tests.utils import MilestonesTestCaseMixin
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from common.djangoapps.student.tests.factories import UserFactory
from lms.djangoapps.gating import api as lms_gating_api
@@ -20,8 +22,6 @@ from lms.djangoapps.grades.tests.base import GradeTestBase
from lms.djangoapps.grades.tests.utils import mock_get_score
from openedx.core.lib.gating import api as gating_api
from openedx.core.lib.gating.exceptions import GatingValidationError
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory # lint-amnesty, pylint: disable=wrong-import-order
@ddt
@@ -29,9 +29,6 @@ class TestGatingApi(ModuleStoreTestCase, MilestonesTestCaseMixin):
"""
Tests for the gating API
"""
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
def setUp(self):
"""
Initial data setup
@@ -354,6 +351,8 @@ class TestGatingGradesIntegration(GradeTestBase):
"""
Tests the integration between the gating API and our Persistent Grades framework.
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
def test_get_subsection_grade_percentage(self):
user = self.request.user

View File

@@ -12,6 +12,10 @@ from django.test.client import RequestFactory
from opaque_keys.edx.asides import AsideUsageKeyV1, AsideUsageKeyV2
from web_fragments.fragment import Fragment
from xblock.core import XBlockAside
from xmodule.modulestore import ModuleStoreEnum
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from xmodule.modulestore.tests.test_asides import AsideTestType
from openedx.core.lib.url_utils import quote_slashes
from openedx.core.lib.xblock_builtin import get_css_dependencies, get_js_dependencies
@@ -26,10 +30,6 @@ from openedx.core.lib.xblock_utils import (
wrap_fragment,
wrap_xblock
)
from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory # lint-amnesty, pylint: disable=wrong-import-order
from xmodule.modulestore.tests.test_asides import AsideTestType # lint-amnesty, pylint: disable=wrong-import-order
@ddt.ddt
@@ -231,6 +231,7 @@ class TestXblockUtils(SharedModuleStoreTestCase):
class TestXBlockAside(SharedModuleStoreTestCase):
"""Test the xblock aside function."""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
@classmethod
def setUpClass(cls):