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:
@@ -5,11 +5,11 @@ Base test case for the course API views.
|
||||
|
||||
from django.urls import reverse
|
||||
from rest_framework.test import APITestCase
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
|
||||
from common.djangoapps.student.tests.factories import StaffFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
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
|
||||
|
||||
|
||||
# pylint: disable=unused-variable
|
||||
@@ -17,7 +17,6 @@ class BaseCourseViewTest(SharedModuleStoreTestCase, APITestCase):
|
||||
"""
|
||||
Base test class for course data views.
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
|
||||
view_name = None # The name of the view to use in reverse() call in self.get_url()
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -12,19 +12,17 @@ from path import Path as path
|
||||
from rest_framework import status
|
||||
from rest_framework.test import APITestCase
|
||||
from user_tasks.models import UserTaskStatus
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
from common.djangoapps.student.tests.factories import StaffFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
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 # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
|
||||
class CourseImportViewTest(SharedModuleStoreTestCase, APITestCase):
|
||||
"""
|
||||
Test importing courses via a RESTful API (POST method only)
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
|
||||
@@ -9,11 +9,11 @@ from django.test.utils import override_settings
|
||||
from django.urls import reverse
|
||||
from rest_framework import status
|
||||
from rest_framework.test import APITestCase
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
|
||||
from common.djangoapps.student.tests.factories import StaffFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
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
|
||||
|
||||
|
||||
@override_settings(PROCTORING_BACKENDS={'DEFAULT': 'proctortrack', 'proctortrack': {}})
|
||||
@@ -21,8 +21,6 @@ class CourseValidationViewTest(SharedModuleStoreTestCase, APITestCase):
|
||||
"""
|
||||
Test course validation view via a RESTful API
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
|
||||
@@ -6,21 +6,20 @@ Delete course tests.
|
||||
from unittest import mock
|
||||
|
||||
from django.core.management import CommandError, call_command
|
||||
from xmodule.contentstore.content import StaticContent
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
from common.djangoapps.student.roles import CourseInstructorRole
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from xmodule.contentstore.content import StaticContent # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.contentstore.django import contentstore # 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 TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import CourseFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
|
||||
class DeleteCourseTests(ModuleStoreTestCase):
|
||||
"""
|
||||
Test for course deleting functionality of the 'delete_course' command
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
|
||||
YESNO_PATCH_LOCATION = 'cms.djangoapps.contentstore.management.commands.delete_course.query_yes_no'
|
||||
|
||||
def test_invalid_course_key(self):
|
||||
|
||||
@@ -33,7 +33,6 @@ from xmodule.modulestore.django import SignalHandler, modulestore # lint-amnest
|
||||
from xmodule.modulestore.tests.django_utils import ( # lint-amnesty, pylint: disable=wrong-import-order
|
||||
ModuleStoreTestCase,
|
||||
TEST_DATA_MONGO_MODULESTORE,
|
||||
TEST_DATA_SPLIT_MODULESTORE,
|
||||
SharedModuleStoreTestCase,
|
||||
)
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, LibraryFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
@@ -863,12 +862,11 @@ class TestLibrarySearchIndexer(MixedWithOptionsTestCase):
|
||||
self._perform_test_using_store(store_type, self._test_exception)
|
||||
|
||||
|
||||
class GroupConfigurationSearchMongo(CourseTestCase, MixedWithOptionsTestCase):
|
||||
class GroupConfigurationSearchSplit(CourseTestCase, MixedWithOptionsTestCase):
|
||||
"""
|
||||
Tests indexing of content groups on course modules using mongo modulestore.
|
||||
Tests indexing of content groups on course modules using split modulestore.
|
||||
"""
|
||||
CREATE_USER = True
|
||||
MODULESTORE = TEST_DATA_MONGO_MODULESTORE
|
||||
INDEX_NAME = CoursewareSearchIndexer.INDEX_NAME
|
||||
|
||||
def setUp(self):
|
||||
@@ -1362,8 +1360,8 @@ class GroupConfigurationSearchMongo(CourseTestCase, MixedWithOptionsTestCase):
|
||||
mock_index.reset_mock()
|
||||
|
||||
|
||||
class GroupConfigurationSearchSplit(GroupConfigurationSearchMongo): # lint-amnesty, pylint: disable=test-inherits-tests
|
||||
class GroupConfigurationSearchMongo(GroupConfigurationSearchSplit): # pylint: disable=test-inherits-tests
|
||||
"""
|
||||
Tests indexing of content groups on course modules using split modulestore.
|
||||
Tests indexing of content groups on course modules using mongo modulestore.
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
|
||||
MODULESTORE = TEST_DATA_MONGO_MODULESTORE
|
||||
|
||||
@@ -7,7 +7,7 @@ from xmodule.course_module import CourseBlock
|
||||
from xmodule.html_module import HtmlBlock
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.exceptions import DuplicateCourseError
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.seq_module import SequenceBlock
|
||||
|
||||
@@ -16,8 +16,6 @@ class TemplateTests(ModuleStoreTestCase):
|
||||
"""
|
||||
Test finding and using the templates (boilerplates) for xblocks.
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
|
||||
|
||||
def test_get_templates(self):
|
||||
found = templates.all_templates()
|
||||
self.assertIsNotNone(found.get('course'))
|
||||
|
||||
@@ -8,14 +8,14 @@ from unittest import mock, skip
|
||||
|
||||
from django.utils import translation
|
||||
from django.utils.translation import get_language
|
||||
from xmodule.modulestore.django import ModuleI18nService
|
||||
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.tests.utils import AjaxEnabledTestClient
|
||||
from cms.djangoapps.contentstore.views.preview import _preview_module_system
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from openedx.core.lib.edx_six import get_gettext
|
||||
from xmodule.modulestore.django import ModuleI18nService # 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
|
||||
|
||||
|
||||
class FakeTranslations(ModuleI18nService):
|
||||
@@ -57,6 +57,7 @@ class FakeTranslations(ModuleI18nService):
|
||||
|
||||
class TestModuleI18nService(ModuleStoreTestCase):
|
||||
""" Test ModuleI18nService """
|
||||
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
|
||||
|
||||
def setUp(self):
|
||||
""" Setting up tests """
|
||||
|
||||
@@ -8,6 +8,11 @@ from unittest.mock import Mock, patch
|
||||
import ddt
|
||||
from django.test.utils import override_settings
|
||||
from opaque_keys.edx.locator import CourseKey, LibraryLocator
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_MODULESTORE, ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.x_module import STUDIO_VIEW
|
||||
|
||||
from cms.djangoapps.contentstore.tests.utils import AjaxEnabledTestClient, parse_json
|
||||
from cms.djangoapps.contentstore.utils import reverse_library_url, reverse_url, reverse_usage_url
|
||||
@@ -27,17 +32,13 @@ from common.djangoapps.student.roles import (
|
||||
)
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from common.djangoapps.xblock_django.user_service import DjangoXBlockUserService
|
||||
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
|
||||
from xmodule.x_module import STUDIO_VIEW # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
|
||||
class LibraryTestCase(ModuleStoreTestCase):
|
||||
"""
|
||||
Common functionality for content libraries tests
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_MONGO_MODULESTORE
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
@@ -10,12 +10,12 @@ import ddt
|
||||
from django.conf import settings
|
||||
from edx_proctoring.api import get_all_exams_for_course, get_review_policy_by_exam_id
|
||||
from pytz import UTC
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
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.signals.handlers import listen_for_course_publish
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from xmodule.modulestore import ModuleStoreEnum # 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
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@@ -24,6 +24,7 @@ class TestProctoredExams(ModuleStoreTestCase):
|
||||
"""
|
||||
Tests for the publishing of proctored exams
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
|
||||
@@ -3,18 +3,20 @@ Unit tests for checking default forum role "Student" of a user when he creates a
|
||||
after deleting it creates same course again
|
||||
"""
|
||||
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, ModuleStoreTestCase
|
||||
|
||||
from cms.djangoapps.contentstore.tests.utils import AjaxEnabledTestClient
|
||||
from cms.djangoapps.contentstore.utils import delete_course, reverse_url
|
||||
from common.djangoapps.student.models import CourseEnrollment
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
|
||||
class TestUsersDefaultRole(ModuleStoreTestCase):
|
||||
"""
|
||||
Unit tests for checking enrollment and default forum role "Student" of a logged in user
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
Add a user and a course
|
||||
|
||||
@@ -11,17 +11,17 @@ from django.conf import settings
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from django.test.client import Client
|
||||
from opaque_keys.edx.keys import AssetKey, CourseKey
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.inheritance import own_metadata
|
||||
from xmodule.modulestore.split_mongo.split import SplitMongoModuleStore
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_MODULESTORE, ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from xmodule.modulestore.tests.utils import ProceduralCourseTestMixin
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
|
||||
from cms.djangoapps.contentstore.utils import reverse_url
|
||||
from common.djangoapps.student.models import Registration
|
||||
from xmodule.contentstore.django import contentstore # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore import ModuleStoreEnum # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.inheritance import own_metadata # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.split_mongo.split import SplitMongoModuleStore # 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
|
||||
from xmodule.modulestore.tests.utils import ProceduralCourseTestMixin # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT
|
||||
|
||||
@@ -74,6 +74,8 @@ class CourseTestCase(ProceduralCourseTestMixin, ModuleStoreTestCase):
|
||||
Base class for Studio tests that require a logged in user and a course.
|
||||
Also provides helper methods for manipulating and verifying the course.
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_MONGO_MODULESTORE
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
These tests need a user in the DB so that the django Test Client can log them in.
|
||||
|
||||
@@ -7,12 +7,12 @@ import json
|
||||
from unittest.mock import patch
|
||||
|
||||
import ddt
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE
|
||||
from xmodule.modulestore.tests.factories import ItemFactory
|
||||
|
||||
from cms.djangoapps.contentstore.tests.utils import CourseTestCase
|
||||
from cms.djangoapps.contentstore.utils import reverse_usage_url
|
||||
from openedx.core.lib.gating.api import GATING_NAMESPACE_QUALIFIER
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.factories import ItemFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
from ..item import VisibilityState
|
||||
|
||||
|
||||
@@ -27,6 +27,21 @@ from xblock.fields import Scope, ScopeIds, String
|
||||
from xblock.runtime import DictKeyValueStore, KvsFieldData
|
||||
from xblock.test.tools import TestRuntime
|
||||
from xblock.validation import ValidationMessage
|
||||
from xmodule.capa_module import ProblemBlock
|
||||
from xmodule.course_module import DEFAULT_START_DATE
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.exceptions import ItemNotFoundError
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_SPLIT_MODULESTORE, ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, LibraryFactory, check_mongo_calls
|
||||
from xmodule.partitions.partitions import (
|
||||
ENROLLMENT_TRACK_PARTITION_ID,
|
||||
MINIMUM_STATIC_PARTITION_ID,
|
||||
Group,
|
||||
UserPartition
|
||||
)
|
||||
from xmodule.partitions.tests.test_partitions import MockPartitionService
|
||||
from xmodule.x_module import STUDENT_VIEW, STUDIO_VIEW
|
||||
|
||||
from cms.djangoapps.contentstore.tests.utils import CourseTestCase
|
||||
from cms.djangoapps.contentstore.utils import reverse_course_url, reverse_usage_url
|
||||
@@ -40,21 +55,6 @@ from common.djangoapps.xblock_django.models import (
|
||||
from common.djangoapps.xblock_django.user_service import DjangoXBlockUserService
|
||||
from lms.djangoapps.lms_xblock.mixin import NONSENSICAL_ACCESS_RESTRICTION
|
||||
from openedx.core.djangoapps.discussions.models import DiscussionsConfiguration
|
||||
from xmodule.capa_module import ProblemBlock # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.course_module import DEFAULT_START_DATE # lint-amnesty, pylint: disable=wrong-import-order
|
||||
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.exceptions import ItemNotFoundError # lint-amnesty, pylint: disable=wrong-import-order
|
||||
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, LibraryFactory, check_mongo_calls # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.partitions.partitions import ( # lint-amnesty, pylint: disable=wrong-import-order
|
||||
ENROLLMENT_TRACK_PARTITION_ID,
|
||||
MINIMUM_STATIC_PARTITION_ID,
|
||||
Group,
|
||||
UserPartition
|
||||
)
|
||||
from xmodule.partitions.tests.test_partitions import MockPartitionService # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.x_module import STUDENT_VIEW, STUDIO_VIEW # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
from ..component import component_handler, get_component_templates
|
||||
from ..item import (
|
||||
@@ -1334,7 +1334,6 @@ class TestDuplicateItemWithAsides(ItemTest, DuplicateHelper):
|
||||
"""
|
||||
Test the duplicate method for blocks with asides.
|
||||
"""
|
||||
|
||||
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
|
||||
|
||||
def setUp(self):
|
||||
@@ -1899,8 +1898,6 @@ class TestEditItemSplitMongo(TestEditItemSetup):
|
||||
"""
|
||||
Tests for EditItem running on top of the SplitMongoModuleStore.
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
|
||||
|
||||
def test_editing_view_wrappers(self):
|
||||
"""
|
||||
Verify that the editing view only generates a single wrapper, no matter how many times it's loaded
|
||||
|
||||
@@ -15,7 +15,9 @@ from xblock.core import XBlock, XBlockAside
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, upload_file_to_course
|
||||
from xmodule.modulestore.tests.django_utils import (
|
||||
TEST_DATA_MONGO_MODULESTORE, ModuleStoreTestCase, upload_file_to_course,
|
||||
)
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.modulestore.tests.test_asides import AsideTestType
|
||||
from cms.djangoapps.contentstore.utils import reverse_usage_url
|
||||
@@ -222,6 +224,7 @@ class CmsModuleSystemShimTest(ModuleStoreTestCase):
|
||||
"""
|
||||
Tests that the deprecated attributes in the Module System (XBlock Runtime) return the expected values.
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_MONGO_MODULESTORE
|
||||
COURSE_ID = 'edX/CmsModuleShimTest/2021_Fall'
|
||||
PYTHON_LIB_FILENAME = 'test_python_lib.zip'
|
||||
PYTHON_LIB_SOURCE_FILE = './common/test/data/uploads/python_lib.zip'
|
||||
|
||||
@@ -127,13 +127,13 @@ class BaseTranscripts(CourseTestCase):
|
||||
"""
|
||||
data = {
|
||||
'parent_locator': str(self.course.location),
|
||||
'category': 'non_video',
|
||||
'type': 'non_video'
|
||||
'category': 'problem',
|
||||
'type': 'problem'
|
||||
}
|
||||
response = self.client.ajax_post('/xblock/', data)
|
||||
usage_key = self._get_usage_key(response)
|
||||
item = modulestore().get_item(usage_key)
|
||||
self.set_fields_from_xml(self.item, '<non_video youtube="0.75:JMD_ifUUfsU,1.0:hI10vDNYz4M" />')
|
||||
self.set_fields_from_xml(self.item, '<problem youtube="0.75:JMD_ifUUfsU,1.0:hI10vDNYz4M" />')
|
||||
modulestore().update_item(item, self.user.id)
|
||||
|
||||
return usage_key
|
||||
@@ -1037,19 +1037,19 @@ class TestCheckTranscripts(BaseTranscripts):
|
||||
# Not video module: setup
|
||||
data = {
|
||||
'parent_locator': str(self.course.location),
|
||||
'category': 'not_video',
|
||||
'type': 'not_video'
|
||||
'category': 'problem',
|
||||
'type': 'problem'
|
||||
}
|
||||
resp = self.client.ajax_post('/xblock/', data)
|
||||
usage_key = self._get_usage_key(resp)
|
||||
subs_id = str(uuid4())
|
||||
item = modulestore().get_item(usage_key)
|
||||
self.set_fields_from_xml(self.item, ("""
|
||||
<not_video youtube="" sub="{}">
|
||||
<problem youtube="" sub="{}">
|
||||
<source src="http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4"/>
|
||||
<source src="http://www.quirksmode.org/html5/videos/big_buck_bunny.webm"/>
|
||||
<source src="http://www.quirksmode.org/html5/videos/big_buck_bunny.ogv"/>
|
||||
</not_video>
|
||||
</problem>
|
||||
""".format(subs_id)))
|
||||
modulestore().update_item(item, self.user.id)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ from unittest.mock import patch
|
||||
|
||||
from edx_toggles.toggles.testutils import override_waffle_flag
|
||||
from xmodule.modulestore.django import SignalHandler
|
||||
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 CourseFactory, ItemFactory
|
||||
|
||||
from .signals import export_course_metadata
|
||||
@@ -18,7 +18,6 @@ class TestExportCourseMetadata(SharedModuleStoreTestCase):
|
||||
"""
|
||||
Tests for the export_course_metadata function
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_SPLIT_MODULESTORE
|
||||
ENABLED_SIGNALS = ['course_published']
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -6,23 +6,24 @@ Tests for the Studio authoring XBlock mixin.
|
||||
from django.conf import settings
|
||||
from django.test.utils import override_settings
|
||||
from xblock.core import XBlock
|
||||
|
||||
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
|
||||
from common.lib.xmodule.xmodule.tests.test_export import PureXBlock
|
||||
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 xmodule.partitions.partitions import ( # lint-amnesty, pylint: disable=wrong-import-order
|
||||
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
|
||||
from xmodule.partitions.partitions import (
|
||||
ENROLLMENT_TRACK_PARTITION_ID,
|
||||
MINIMUM_STATIC_PARTITION_ID,
|
||||
Group,
|
||||
UserPartition
|
||||
)
|
||||
|
||||
from common.djangoapps.course_modes.tests.factories import CourseModeFactory
|
||||
from common.lib.xmodule.xmodule.tests.test_export import PureXBlock
|
||||
|
||||
|
||||
class AuthoringMixinTestCase(ModuleStoreTestCase):
|
||||
"""
|
||||
Tests the studio authoring XBlock mixin.
|
||||
"""
|
||||
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
|
||||
GROUP_NO_LONGER_EXISTS = "This group no longer exists"
|
||||
NO_CONTENT_OR_ENROLLMENT_GROUPS = "Access to this component is not restricted"
|
||||
NO_CONTENT_ENROLLMENT_TRACK_ENABLED = "You can restrict access to this component to learners in specific enrollment tracks or content groups" # lint-amnesty, pylint: disable=line-too-long
|
||||
|
||||
Reference in New Issue
Block a user