diff --git a/openedx/core/djangoapps/content_libraries/tests/test_upstream_downstream_links.py b/openedx/core/djangoapps/content_libraries/tests/test_upstream_downstream_links.py index 19734eda092..e138aff370d 100644 --- a/openedx/core/djangoapps/content_libraries/tests/test_upstream_downstream_links.py +++ b/openedx/core/djangoapps/content_libraries/tests/test_upstream_downstream_links.py @@ -23,6 +23,13 @@ class TestRecreateUpstreamLinks(ModuleStoreTestCase): ENABLED_SIGNALS = ['course_deleted', 'course_published'] + def setUp(self): + super().setUp() + self.now = timezone.now() + freezer = freeze_time(self.now) + freezer.start() + self.addCleanup(freezer.stop) + def call_command(self, *args, **kwargs): """ call command with pass args. @@ -49,10 +56,10 @@ def test_call_for_single_course(self, mock_task): Test command with single course argument """ self.call_command('--course', 'some-course') - mock_task.delay.assert_called_with('some-course', False) + mock_task.delay.assert_called_with('some-course', False, created=self.now) # call with --force self.call_command('--course', 'some-course', '--force') - mock_task.delay.assert_called_with('some-course', True) + mock_task.delay.assert_called_with('some-course', True, created=self.now) @patch( 'openedx.core.djangoapps.content_libraries.management.commands.recreate_upstream_links.create_or_update_upstream_links' # pylint: disable=line-too-long @@ -62,8 +69,8 @@ def test_call_for_multiple_course(self, mock_task): Test command with multiple course arguments """ self.call_command('--course', 'some-course', '--course', 'one-more-course') - mock_task.delay.assert_any_call('some-course', False) - mock_task.delay.assert_any_call('one-more-course', False) + mock_task.delay.assert_any_call('some-course', False, created=self.now) + mock_task.delay.assert_any_call('one-more-course', False, created=self.now) @patch( 'openedx.core.djangoapps.content_libraries.management.commands.recreate_upstream_links.create_or_update_upstream_links' # pylint: disable=line-too-long @@ -75,8 +82,8 @@ def test_call_for_all_courses(self, mock_task): course_key_1 = CourseFactory.create(emit_signals=True).id course_key_2 = CourseFactory.create(emit_signals=True).id self.call_command('--all') - mock_task.delay.assert_any_call(str(course_key_1), False) - mock_task.delay.assert_any_call(str(course_key_2), False) + mock_task.delay.assert_any_call(str(course_key_1), False, created=self.now) + mock_task.delay.assert_any_call(str(course_key_2), False, created=self.now) class TestUpstreamLinksTasks(ModuleStoreTestCase): @@ -105,12 +112,14 @@ def setUp(self): category="html", display_name="An HTML Block", upstream=self.upstream_1, + upstream_version=1, ) self.component_2 = BlockFactory.create( parent=self.unit, category="html", display_name="Another HTML Block", upstream=self.upstream_2, + upstream_version=1, ) self.component_3 = BlockFactory.create( parent=self.unit,