test: more Old Mongo removal from tests

Convert more tests from MONGO_AMNESTY to SPLIT modulestores.

This is in preparation for just wholesale denying access to Old
Mongo, so I either converted tests to split or just deleted some
test variants that were Old Mongo specific. (e.g. ddt lines)
This commit is contained in:
Michael Terry
2022-01-31 14:00:57 -05:00
parent bcb0aa923e
commit b905de757b
42 changed files with 577 additions and 878 deletions

View File

@@ -8,7 +8,7 @@ import unittest
import simplejson as json
from django.conf import settings
from django.urls import reverse
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, SharedModuleStoreTestCase
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from common.djangoapps.student.tests.factories import GlobalStaffFactory
@@ -20,7 +20,6 @@ class TestCrowdsourceHinter(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Create the test environment with the crowdsourcehinter xblock.
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
STUDENTS = [
{'email': 'view@test.com', 'password': 'foo'},
{'email': 'view2@test.com', 'password': 'foo'}

View File

@@ -14,19 +14,21 @@ import simplejson as json
from ddt import data, ddt
from django.conf import settings
from django.urls import reverse
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, SharedModuleStoreTestCase
from edx_toggles.toggles.testutils import override_waffle_flag
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
from common.djangoapps.student.tests.factories import GlobalStaffFactory
from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase
from lms.djangoapps.courseware.toggles import COURSEWARE_USE_LEGACY_FRONTEND
from openedx.core.lib.url_utils import quote_slashes
@override_waffle_flag(COURSEWARE_USE_LEGACY_FRONTEND, active=True)
class TestRecommender(SharedModuleStoreTestCase, LoginEnrollmentTestCase):
"""
Check that Recommender state is saved properly
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
STUDENTS = [
{'email': 'view@test.com', 'password': 'foo'},
{'email': 'view2@test.com', 'password': 'foo'}

View File

@@ -48,12 +48,14 @@ import pytz
from bs4 import BeautifulSoup
from django.conf import settings
from django.urls import reverse
from edx_toggles.toggles.testutils import override_waffle_flag
from xblock.plugin import Plugin
from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_AMNESTY_MODULESTORE, SharedModuleStoreTestCase
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
import lms.djangoapps.lms_xblock.runtime
from lms.djangoapps.courseware.tests.helpers import LoginEnrollmentTestCase
from lms.djangoapps.courseware.toggles import COURSEWARE_USE_LEGACY_FRONTEND
class XBlockEventTestMixin:
@@ -240,7 +242,7 @@ class XBlockScenarioTestCaseMixin:
with cls.store.bulk_operations(cls.course.id, emit_signals=False):
for chapter_config in cls.test_configuration:
chapter = ItemFactory.create(
parent=cls.course,
parent_location=cls.course.location,
display_name="ch_" + chapter_config['urlname'],
category='chapter'
)
@@ -335,6 +337,7 @@ class XBlockStudentTestCaseMixin:
self.login(email, password)
@override_waffle_flag(COURSEWARE_USE_LEGACY_FRONTEND, active=True)
class XBlockTestCase(XBlockStudentTestCaseMixin,
XBlockScenarioTestCaseMixin,
XBlockEventTestMixin,
@@ -346,7 +349,6 @@ class XBlockTestCase(XBlockStudentTestCaseMixin,
Class for all XBlock-internal test cases (as opposed to
integration tests).
"""
MODULESTORE = TEST_DATA_MONGO_AMNESTY_MODULESTORE
test_configuration = None # Children must override this!
entry_point = 'xblock.test.v0'