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

@@ -62,22 +62,22 @@ class BackfillCourseOutlinesTest(SharedModuleStoreTestCase):
)
with cls.store.bulk_operations(course_key):
section = ItemFactory.create(
parent_location=course.location,
parent=course,
category="chapter",
display_name="A Section"
)
sequence = ItemFactory.create(
parent_location=section.location,
parent=section,
category="sequential",
display_name="A Sequence"
)
unit = ItemFactory.create(
parent_location=sequence.location,
parent=sequence,
category="vertical",
display_name="A Unit"
)
ItemFactory.create(
parent_location=unit.location,
parent=unit,
category="html",
display_name="An HTML Module"
)

View File

@@ -136,18 +136,18 @@ class OutlineFromModuleStoreTestCase(ModuleStoreTestCase):
"""Make sure sequences go into the right places."""
with self.store.bulk_operations(self.course_key):
section_1 = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name="Section 1 - Three Sequences",
)
ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name="Section 2 - Empty",
)
for i in range(3):
ItemFactory.create(
parent_location=section_1.location,
parent=section_1,
category='sequential',
display_name=f"Seq_1_{i}",
)
@@ -164,23 +164,23 @@ class OutlineFromModuleStoreTestCase(ModuleStoreTestCase):
def test_duplicate_children(self):
with self.store.bulk_operations(self.course_key):
section_1 = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name="Section",
)
seq = ItemFactory.create(
parent_location=section_1.location,
parent=section_1,
category='sequential',
display_name="standard_seq"
)
section_2 = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name="Section 2",
children=[seq.location]
)
section_3 = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name="Section 3",
children=[seq.location]
@@ -215,42 +215,42 @@ class OutlineFromModuleStoreTestCase(ModuleStoreTestCase):
# Course -> Section -> Unit (No Sequence)
with self.store.bulk_operations(self.course_key):
section_1 = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name="Section",
)
# This Unit should be skipped
ItemFactory.create(
parent_location=section_1.location,
parent=section_1,
category='vertical',
display_name="u1"
)
ItemFactory.create(
parent_location=section_1.location,
parent=section_1,
category='sequential',
display_name="standard_seq"
)
ItemFactory.create(
parent_location=section_1.location,
parent=section_1,
category='problemset',
display_name="pset_seq"
)
ItemFactory.create(
parent_location=section_1.location,
parent=section_1,
category='videosequence',
display_name="video_seq"
)
# This should work fine
section_2 = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name="Section 2",
)
# Second error message here
ItemFactory.create(
parent_location=section_2.location,
parent=section_2,
category='vertical',
display_name="u2"
)
@@ -278,12 +278,12 @@ class OutlineFromModuleStoreTestCase(ModuleStoreTestCase):
# Course -> Sequence (No Section)
with self.store.bulk_operations(self.course_key):
seq = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='sequential',
display_name="Sequence",
)
ItemFactory.create(
parent_location=seq.location,
parent=seq,
category='vertical',
display_name="Unit",
)
@@ -302,12 +302,12 @@ class OutlineFromModuleStoreTestCase(ModuleStoreTestCase):
"""
with self.store.bulk_operations(self.course_key):
section = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name=None,
)
sequence = ItemFactory.create(
parent_location=section.location,
parent=section,
category='sequential',
display_name=None,
)
@@ -325,7 +325,7 @@ class OutlineFromModuleStoreTestCase(ModuleStoreTestCase):
"""
with self.store.bulk_operations(self.course_key):
section = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name='Ch 1',
group_access={
@@ -335,7 +335,7 @@ class OutlineFromModuleStoreTestCase(ModuleStoreTestCase):
}
)
ItemFactory.create(
parent_location=section.location,
parent=section,
category='sequential',
display_name='Seq 1',
group_access={
@@ -354,14 +354,14 @@ class OutlineFromModuleStoreTestCase(ModuleStoreTestCase):
"""Testing empty case to make sure bubble-up code doesn't break."""
with self.store.bulk_operations(self.course_key):
section = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name='Ch 0',
)
# Bubble up with no children (nothing happens)
ItemFactory.create(
parent_location=section.location,
parent=section,
category='sequential',
display_name='Seq 0',
group_access={}
@@ -375,20 +375,20 @@ class OutlineFromModuleStoreTestCase(ModuleStoreTestCase):
"""Group settings should bubble up from Unit to Seq. if only one unit"""
with self.store.bulk_operations(self.course_key):
section = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name='Ch 0',
)
# Bubble up with 1 child (grabs the setting from child)
seq_1 = ItemFactory.create(
parent_location=section.location,
parent=section,
category='sequential',
display_name='Seq 1',
group_access={}
)
ItemFactory.create(
parent_location=seq_1.location,
parent=seq_1,
category='vertical',
display_name='Single Vertical',
group_access={
@@ -406,27 +406,27 @@ class OutlineFromModuleStoreTestCase(ModuleStoreTestCase):
"""If all Units have the same group_access, bubble up to Sequence."""
with self.store.bulk_operations(self.course_key):
section = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name='Ch 0',
)
# Bubble up with n children, all matching for one group
seq_n = ItemFactory.create(
parent_location=section.location,
parent=section,
category='sequential',
display_name='Seq N',
group_access={}
)
for i in range(4):
ItemFactory.create(
parent_location=seq_n.location,
parent=seq_n,
category='vertical',
display_name=f'vertical {i}',
group_access={50: [3, 4], 51: [i]} # Only 50 should get bubbled up
)
ItemFactory.create(
parent_location=seq_n.location,
parent=seq_n,
category='vertical',
display_name='vertical 5',
group_access={50: [4, 3], 51: [5]} # Ordering should be normalized
@@ -441,20 +441,20 @@ class OutlineFromModuleStoreTestCase(ModuleStoreTestCase):
"""Don't bubble up from Unit if Seq has a conflicting group_access."""
with self.store.bulk_operations(self.course_key):
section = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name='Ch 0',
)
# Bubble up with 1 child (grabs the setting from child)
seq_1 = ItemFactory.create(
parent_location=section.location,
parent=section,
category='sequential',
display_name='Seq 1',
group_access={50: [3, 4]}
)
ItemFactory.create(
parent_location=seq_1.location,
parent=seq_1,
category='vertical',
display_name='Single Vertical',
group_access={50: [1, 2]},
@@ -494,12 +494,12 @@ class OutlineFromModuleStoreTestCase(ModuleStoreTestCase):
"""
with self.store.bulk_operations(self.course_key):
section = ItemFactory.create(
parent_location=self.draft_course.location,
parent=self.draft_course,
category='chapter',
display_name="Generated Section",
)
sequence = ItemFactory.create(
parent_location=section.location,
parent=section,
category='sequential',
**kwargs,
)