feat!: Remove inheritance-related code from Old Mongo
This commit is contained in:
committed by
David Ormsbee
parent
672b1341c4
commit
3f3d0d25d8
@@ -226,8 +226,8 @@ class TestGetBlocksQueryCounts(TestGetBlocksQueryCountsBase):
|
||||
)
|
||||
|
||||
@ddt.data(
|
||||
(ModuleStoreEnum.Type.mongo, 5, True, 24),
|
||||
(ModuleStoreEnum.Type.mongo, 5, False, 14),
|
||||
(ModuleStoreEnum.Type.mongo, 19, True, 24),
|
||||
(ModuleStoreEnum.Type.mongo, 19, False, 14),
|
||||
(ModuleStoreEnum.Type.split, 2, True, 24),
|
||||
(ModuleStoreEnum.Type.split, 2, False, 14),
|
||||
)
|
||||
|
||||
@@ -155,7 +155,7 @@ class TestCourseDetailSerializer(TestCourseSerializer): # lint-amnesty, pylint:
|
||||
|
||||
"""
|
||||
# 1 mongo call is made to get the course About overview text.
|
||||
expected_mongo_calls = 1
|
||||
expected_mongo_calls = 2
|
||||
serializer_class = CourseDetailSerializer
|
||||
|
||||
def setUp(self):
|
||||
|
||||
@@ -153,8 +153,8 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest
|
||||
assert mock_block_structure_create.call_count == 1
|
||||
|
||||
@ddt.data(
|
||||
(ModuleStoreEnum.Type.mongo, 1, 41, True),
|
||||
(ModuleStoreEnum.Type.mongo, 1, 41, False),
|
||||
(ModuleStoreEnum.Type.mongo, 2, 41, True),
|
||||
(ModuleStoreEnum.Type.mongo, 2, 41, False),
|
||||
(ModuleStoreEnum.Type.split, 2, 41, True),
|
||||
(ModuleStoreEnum.Type.split, 2, 41, False),
|
||||
)
|
||||
@@ -167,7 +167,7 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest
|
||||
self._apply_recalculate_subsection_grade()
|
||||
|
||||
@ddt.data(
|
||||
(ModuleStoreEnum.Type.mongo, 1, 41),
|
||||
(ModuleStoreEnum.Type.mongo, 2, 41),
|
||||
(ModuleStoreEnum.Type.split, 2, 41),
|
||||
)
|
||||
@ddt.unpack
|
||||
@@ -213,7 +213,7 @@ class RecalculateSubsectionGradeTest(HasCourseWithProblemsMixin, ModuleStoreTest
|
||||
)
|
||||
|
||||
@ddt.data(
|
||||
(ModuleStoreEnum.Type.mongo, 1, 41),
|
||||
(ModuleStoreEnum.Type.mongo, 2, 41),
|
||||
(ModuleStoreEnum.Type.split, 2, 41),
|
||||
)
|
||||
@ddt.unpack
|
||||
|
||||
@@ -11,7 +11,7 @@ import ddt
|
||||
import pytz
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import check_mongo_calls
|
||||
from xmodule.modulestore.tests.factories import check_mongo_calls_range
|
||||
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from lms.djangoapps.course_blocks.api import get_course_blocks
|
||||
@@ -429,11 +429,11 @@ class MultiProblemModulestoreAccessTestCase(CourseStructureTestCase, SharedModul
|
||||
self.client.login(username=self.student.username, password=password)
|
||||
|
||||
@ddt.data(
|
||||
(ModuleStoreEnum.Type.split, 2),
|
||||
(ModuleStoreEnum.Type.mongo, 2),
|
||||
(ModuleStoreEnum.Type.split, 2, 2),
|
||||
(ModuleStoreEnum.Type.mongo, 22, 15),
|
||||
)
|
||||
@ddt.unpack
|
||||
def test_modulestore_performance(self, store_type, expected_mongo_queries):
|
||||
def test_modulestore_performance(self, store_type, max_mongo_calls, min_mongo_calls):
|
||||
"""
|
||||
Test that a constant number of mongo calls are made regardless of how
|
||||
many grade-related blocks are in the course.
|
||||
@@ -470,5 +470,5 @@ class MultiProblemModulestoreAccessTestCase(CourseStructureTestCase, SharedModul
|
||||
with self.store.default_store(store_type):
|
||||
blocks = self.build_course(course)
|
||||
clear_course_from_cache(blocks['course'].id)
|
||||
with check_mongo_calls(expected_mongo_queries):
|
||||
with check_mongo_calls_range(max_mongo_calls, min_mongo_calls):
|
||||
get_course_blocks(self.student, blocks['course'].location, self.transformers)
|
||||
|
||||
@@ -377,15 +377,13 @@ class TestReportMixin:
|
||||
"""
|
||||
csv data may contain numeric values that are converted to strings, and fractional
|
||||
numbers can be imprecise (e.g. 1 / 6 is sometimes '0.16666666666666666' and other times
|
||||
'0.166666666667'). This function mutates the provided input (sorry) and returns
|
||||
a new dictionary that contains only the numerically-valued items from it, rounded
|
||||
to four decimal places.
|
||||
'0.166666666667'). This function returns a new dictionary that contains only the
|
||||
numerically-valued items from it, rounded to four decimal places.
|
||||
"""
|
||||
extracted = {}
|
||||
for key in list(dictionary):
|
||||
try:
|
||||
float(dictionary[key])
|
||||
extracted[key] = round(float(dictionary.pop(key)), 4)
|
||||
extracted[key] = round(float(dictionary[key]), 4)
|
||||
except ValueError:
|
||||
pass
|
||||
return extracted
|
||||
|
||||
@@ -370,7 +370,7 @@ class TestInstructorGradeReport(InstructorGradeReportTestCase):
|
||||
self._verify_cell_data_for_user(verified_user.username, course.id, 'Certificate Eligible', 'Y', num_rows=2)
|
||||
|
||||
@ddt.data(
|
||||
(ModuleStoreEnum.Type.mongo, 4, 47),
|
||||
(ModuleStoreEnum.Type.mongo, 6, 47),
|
||||
(ModuleStoreEnum.Type.split, 2, 48),
|
||||
)
|
||||
@ddt.unpack
|
||||
@@ -1779,8 +1779,7 @@ class TestGradeReport(TestReportMixin, InstructorTaskModuleTestCase):
|
||||
self.define_option_problem('Unreleased', parent=self.unreleased_section)
|
||||
|
||||
@patch.dict(settings.FEATURES, {'DISABLE_START_DATES': False})
|
||||
@ddt.data(True, False)
|
||||
def test_grade_report(self, persistent_grades_enabled):
|
||||
def test_grade_report(self):
|
||||
self.submit_student_answer(self.student.username, 'Problem1', ['Option 1'])
|
||||
|
||||
with patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task'):
|
||||
|
||||
@@ -371,7 +371,7 @@ class TestAssignmentsForProblem(ModuleStoreTestCase):
|
||||
assert count == 3
|
||||
|
||||
def test_with_no_graded_assignments(self):
|
||||
with check_mongo_calls(3):
|
||||
with check_mongo_calls(7):
|
||||
assignments = outcomes.get_assignments_for_problem(
|
||||
self.unit, self.user_id, self.course.id
|
||||
)
|
||||
@@ -379,7 +379,7 @@ class TestAssignmentsForProblem(ModuleStoreTestCase):
|
||||
|
||||
def test_with_graded_unit(self):
|
||||
self.create_graded_assignment(self.unit, 'graded_unit', self.outcome_service)
|
||||
with check_mongo_calls(3):
|
||||
with check_mongo_calls(7):
|
||||
assignments = outcomes.get_assignments_for_problem(
|
||||
self.unit, self.user_id, self.course.id
|
||||
)
|
||||
@@ -388,7 +388,7 @@ class TestAssignmentsForProblem(ModuleStoreTestCase):
|
||||
|
||||
def test_with_graded_vertical(self):
|
||||
self.create_graded_assignment(self.vertical, 'graded_vertical', self.outcome_service)
|
||||
with check_mongo_calls(3):
|
||||
with check_mongo_calls(7):
|
||||
assignments = outcomes.get_assignments_for_problem(
|
||||
self.unit, self.user_id, self.course.id
|
||||
)
|
||||
@@ -398,7 +398,7 @@ class TestAssignmentsForProblem(ModuleStoreTestCase):
|
||||
def test_with_graded_unit_and_vertical(self):
|
||||
self.create_graded_assignment(self.unit, 'graded_unit', self.outcome_service)
|
||||
self.create_graded_assignment(self.vertical, 'graded_vertical', self.outcome_service)
|
||||
with check_mongo_calls(3):
|
||||
with check_mongo_calls(7):
|
||||
assignments = outcomes.get_assignments_for_problem(
|
||||
self.unit, self.user_id, self.course.id
|
||||
)
|
||||
@@ -409,7 +409,7 @@ class TestAssignmentsForProblem(ModuleStoreTestCase):
|
||||
def test_with_unit_used_twice(self):
|
||||
self.create_graded_assignment(self.unit, 'graded_unit', self.outcome_service)
|
||||
self.create_graded_assignment(self.unit, 'graded_unit2', self.outcome_service)
|
||||
with check_mongo_calls(3):
|
||||
with check_mongo_calls(7):
|
||||
assignments = outcomes.get_assignments_for_problem(
|
||||
self.unit, self.user_id, self.course.id
|
||||
)
|
||||
@@ -420,7 +420,7 @@ class TestAssignmentsForProblem(ModuleStoreTestCase):
|
||||
def test_with_unit_graded_for_different_user(self):
|
||||
self.create_graded_assignment(self.unit, 'graded_unit', self.outcome_service)
|
||||
other_user = UserFactory.create()
|
||||
with check_mongo_calls(3):
|
||||
with check_mongo_calls(7):
|
||||
assignments = outcomes.get_assignments_for_problem(
|
||||
self.unit, other_user.id, self.course.id
|
||||
)
|
||||
@@ -430,7 +430,7 @@ class TestAssignmentsForProblem(ModuleStoreTestCase):
|
||||
other_outcome_service = self.create_outcome_service('second_consumer')
|
||||
self.create_graded_assignment(self.unit, 'graded_unit', self.outcome_service)
|
||||
self.create_graded_assignment(self.unit, 'graded_unit2', other_outcome_service)
|
||||
with check_mongo_calls(3):
|
||||
with check_mongo_calls(7):
|
||||
assignments = outcomes.get_assignments_for_problem(
|
||||
self.unit, self.user_id, self.course.id
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user