test: prepare tests for removing support for children in Old Mongo

This commit is contained in:
Sagirov Eugeniy
2022-10-28 15:53:17 +03:00
committed by David Ormsbee
parent f6870f7ae7
commit 8f88422c4a
45 changed files with 498 additions and 1063 deletions

View File

@@ -28,9 +28,6 @@ class CompletionBatchTestCase(CompletionWaffleTestMixin, ModuleStoreTestCase):
UNENROLLED_USERNAME = 'unenrolled_user'
COURSE_KEY = 'course-v1:TestX+101+Test'
BLOCK_KEY = 'block-v1:TestX+101+Test+type@problem+block@Test_Problem'
# And for old mongo:
COURSE_KEY_DEPRECATED = 'TestX/201/Test'
BLOCK_KEY_DEPRECATED = 'i4x://TestX/201/problem/Test_Problem'
def setUp(self):
"""
@@ -52,17 +49,6 @@ class CompletionBatchTestCase(CompletionWaffleTestMixin, ModuleStoreTestCase):
parent=self.course, category="problem", display_name="Test Problem", publish_item=False,
)
assert str(self.problem.location) == self.BLOCK_KEY
# And an old mongo course:
self.course_deprecated = CourseFactory.create(
org='TestX', number='201', display_name='Test',
default_store=ModuleStoreEnum.Type.mongo,
)
assert str(self.course_deprecated.id) == self.COURSE_KEY_DEPRECATED
self.problem_deprecated = ItemFactory.create(
parent=self.course_deprecated, category="problem", display_name="Test Problem",
publish_item=False,
)
assert str(self.problem_deprecated.location) == self.BLOCK_KEY_DEPRECATED
# Create users
self.staff_user = UserFactory(is_staff=True)
@@ -71,7 +57,6 @@ class CompletionBatchTestCase(CompletionWaffleTestMixin, ModuleStoreTestCase):
# Enrol one user in the course
CourseEnrollmentFactory.create(user=self.enrolled_user, course_id=self.course.id)
CourseEnrollmentFactory.create(user=self.enrolled_user, course_id=self.course_deprecated.id)
# Login the enrolled user by for all tests
self.client = APIClient()
@@ -101,16 +86,6 @@ class CompletionBatchTestCase(CompletionWaffleTestMixin, ModuleStoreTestCase):
}
}, 200, {'detail': 'ok'}
),
# Valid submission (old mongo)
(
{
'username': ENROLLED_USERNAME,
'course_key': COURSE_KEY_DEPRECATED,
'blocks': {
BLOCK_KEY_DEPRECATED: 1.0,
}
}, 200, {'detail': 'ok'}
),
# Blocks list can be empty, though it's a no-op
(
{
@@ -222,16 +197,6 @@ class CompletionBatchTestCase(CompletionWaffleTestMixin, ModuleStoreTestCase):
}
}, 200, {'detail': 'ok'}
),
# Staff can submit completion on behalf of other users (old mongo)
(
{
'username': ENROLLED_USERNAME,
'course_key': COURSE_KEY_DEPRECATED,
'blocks': {
BLOCK_KEY_DEPRECATED: 1.0,
}
}, 200, {'detail': 'ok'}
),
# User must be enrolled in the course
(
{