From c87e81e3c343fe8f903deead79c4b4f6455eea8e Mon Sep 17 00:00:00 2001 From: Manuel Kaufmann Date: Mon, 30 Apr 2018 22:20:03 -0500 Subject: [PATCH] Fix mock calls in test cases --- .../rtd_tests/tests/test_core_utils.py | 57 +++++++++---------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/readthedocs/rtd_tests/tests/test_core_utils.py b/readthedocs/rtd_tests/tests/test_core_utils.py index 9e7828c4828..9c5d5c0b46b 100644 --- a/readthedocs/rtd_tests/tests/test_core_utils.py +++ b/readthedocs/rtd_tests/tests/test_core_utils.py @@ -5,7 +5,6 @@ from django_dynamic_fixture import get from django.test import TestCase -from django.test.utils import override_settings from readthedocs.projects.models import Project from readthedocs.builds.models import Version @@ -22,60 +21,58 @@ def setUp(self): def test_trigger_build_time_limit(self, update_docs): """Pass of time limit""" trigger_build(project=self.project, version=self.version) - update_docs().apply_async.assert_has_calls([ + update_docs().si.assert_has_calls([ mock.call( + self.project.pk, time_limit=720, soft_time_limit=600, queue=mock.ANY, - kwargs={ - 'pk': self.project.id, - 'force': False, - 'record': True, - 'build_pk': mock.ANY, - 'version_pk': self.version.id - } - ) + force=False, + record=True, + build_pk=mock.ANY, + version_pk=self.version.id, + ), ]) + update_docs().si().apply_async.assert_called() @mock.patch('readthedocs.projects.tasks.UpdateDocsTask') def test_trigger_build_invalid_time_limit(self, update_docs): """Time limit as string""" self.project.container_time_limit = '200s' trigger_build(project=self.project, version=self.version) - update_docs().apply_async.assert_has_calls([ + update_docs().si.assert_has_calls([ mock.call( + self.project.pk, time_limit=720, soft_time_limit=600, queue=mock.ANY, - kwargs={ - 'pk': self.project.id, - 'force': False, - 'record': True, - 'build_pk': mock.ANY, - 'version_pk': self.version.id - } - ) + force=False, + record=True, + build_pk=mock.ANY, + version_pk=self.version.id, + ), ]) + update_docs().si().apply_async.assert_called() @mock.patch('readthedocs.projects.tasks.UpdateDocsTask') def test_trigger_build_rounded_time_limit(self, update_docs): """Time limit should round down""" self.project.container_time_limit = 3 trigger_build(project=self.project, version=self.version) - update_docs().apply_async.assert_has_calls([ + update_docs().si.assert_has_calls([ mock.call( - time_limit=3, - soft_time_limit=3, + self.project.pk, + time_limit=720, + soft_time_limit=600, queue=mock.ANY, - kwargs={ - 'pk': self.project.id, - 'force': False, - 'record': True, - 'build_pk': mock.ANY, - 'version_pk': self.version.id - } - ) + force=False, + record=True, + build_pk=mock.ANY, + version_pk=self.version.id, + ), ]) + update_docs().si().apply_async.assert_called() + def test_slugify(self): """Test additional slugify"""