Merge pull request #31425 from openedx/ashultz0/wait-for-exam-update

wait for exam block to actually be committed before trying to update off it
This commit is contained in:
Andrew Shultz
2022-12-13 11:00:46 -05:00
committed by GitHub
3 changed files with 8 additions and 4 deletions

View File

@@ -125,9 +125,9 @@ def listen_for_course_publish(sender, course_key, **kwargs): # pylint: disable=
dump_course_to_neo4j
)
# register special exams asynchronously
# register special exams asynchronously after the data is ready
course_key_str = str(course_key)
update_special_exams_and_publish.delay(course_key_str)
transaction.on_commit(lambda: update_special_exams_and_publish.delay(course_key_str))
if key_supports_outlines(course_key):
# Push the course outline to learning_sequences asynchronously.

View File

@@ -2,7 +2,7 @@
Test the exams service integration into Studio
"""
from datetime import datetime, timedelta
from unittest.mock import patch
from unittest.mock import patch, Mock
import ddt
from django.conf import settings
@@ -19,6 +19,8 @@ from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory
@override_waffle_flag(EXAMS_IDA, active=True)
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_SPECIAL_EXAMS': True})
@patch('cms.djangoapps.contentstore.exams._patch_course_exams')
@patch('cms.djangoapps.contentstore.signals.handlers.transaction.on_commit',
new=Mock(side_effect=lambda func: func()),) # run right away
class TestExamService(ModuleStoreTestCase):
"""
Test for syncing exams to the exam service

View File

@@ -4,7 +4,7 @@ Tests for the edx_proctoring integration into Studio
from datetime import datetime, timedelta
from unittest.mock import patch
from unittest.mock import patch, Mock
import ddt
from django.conf import settings
@@ -20,6 +20,8 @@ from common.djangoapps.student.tests.factories import UserFactory
@ddt.ddt
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_SPECIAL_EXAMS': True})
@patch('cms.djangoapps.contentstore.signals.handlers.transaction.on_commit',
new=Mock(side_effect=lambda func: func()),) # run right away
class TestProctoredExams(ModuleStoreTestCase):
"""
Tests for the publishing of proctored exams