Skip to content

Commit

Permalink
fixup! test: Update the course in the cache after it's got new content.
Browse files Browse the repository at this point in the history
  • Loading branch information
feanil committed Sep 23, 2024
1 parent 3d24b18 commit e900a5e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lms/djangoapps/instructor_task/tests/test_tasks_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from pytz import UTC

import openedx.core.djangoapps.user_api.course_tag.api as course_tag_api
import openedx.core.djangoapps.content.block_structure.api as bs_api
from xmodule.capa.tests.response_xml_factory import MultipleChoiceResponseXMLFactory # lint-amnesty, pylint: disable=wrong-import-order
from common.djangoapps.course_modes.models import CourseMode
from common.djangoapps.student.models import CourseEnrollment, CourseEnrollmentAllowed
Expand Down Expand Up @@ -396,6 +397,8 @@ def test_query_counts(self):
)
_ = CreditCourseFactory(course_key=course.id)

bs_api.update_course_in_cache(course.id)

num_users = 5
for _ in range(num_users):
user = UserFactory.create()
Expand All @@ -406,7 +409,7 @@ def test_query_counts(self):

with patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task'):
with check_mongo_calls(2):
with self.assertNumQueries(63):
with self.assertNumQueries(46):
CourseGradeReport.generate(None, None, course.id, {}, 'graded')

def test_inactive_enrollments(self):
Expand Down

0 comments on commit e900a5e

Please sign in to comment.