Patch Registry.execute so that it is undoen at end of test

This commit is contained in:
Stewart Becker 2014-07-21 22:45:27 +01:00
parent 2555bc50d4
commit 9a1ce000b7

View File

@ -508,7 +508,7 @@ class TestSlideController(TestCase):
mocked_update_preview = MagicMock()
mocked_preview_widget = MagicMock()
mocked_slide_selected = MagicMock()
Registry.execute = mocked_execute
with patch.object(Registry, 'execute') as mocked_execute:
Registry.create()
slide_controller = SlideController(None)
slide_controller.service_item = mocked_item
@ -539,7 +539,7 @@ class TestSlideController(TestCase):
mocked_update_preview = MagicMock()
mocked_preview_widget = MagicMock()
mocked_slide_selected = MagicMock()
Registry.execute = mocked_execute
with patch.object(Registry, 'execute') as mocked_execute:
Registry.create()
slide_controller = SlideController(None)
slide_controller.service_item = mocked_item
@ -556,3 +556,5 @@ class TestSlideController(TestCase):
self.assertEqual(0, mocked_update_preview.call_count, 'Update preview should not have been called')
mocked_preview_widget.change_slide.assert_called_once_with(7)
mocked_slide_selected.assert_called_once_with()