Fix mock calls
Use the proper assertion methods of the mocks. Change-Id: I7b02f3b52012976a3ed0b8d5fc445653c0546547
This commit is contained in:
@@ -84,7 +84,7 @@ class FlowFromDetailTestCase(test.TestCase):
|
|||||||
with mock.patch('oslo_utils.importutils.import_class',
|
with mock.patch('oslo_utils.importutils.import_class',
|
||||||
return_value=lambda: 'RESULT') as mock_import:
|
return_value=lambda: 'RESULT') as mock_import:
|
||||||
result = taskflow.engines.flow_from_detail(flow_detail)
|
result = taskflow.engines.flow_from_detail(flow_detail)
|
||||||
mock_import.assert_called_onec_with(name)
|
mock_import.assert_called_once_with(name)
|
||||||
self.assertEqual(result, 'RESULT')
|
self.assertEqual(result, 'RESULT')
|
||||||
|
|
||||||
def test_factory_with_arg(self):
|
def test_factory_with_arg(self):
|
||||||
@@ -95,7 +95,7 @@ class FlowFromDetailTestCase(test.TestCase):
|
|||||||
with mock.patch('oslo_utils.importutils.import_class',
|
with mock.patch('oslo_utils.importutils.import_class',
|
||||||
return_value=lambda x: 'RESULT %s' % x) as mock_import:
|
return_value=lambda x: 'RESULT %s' % x) as mock_import:
|
||||||
result = taskflow.engines.flow_from_detail(flow_detail)
|
result = taskflow.engines.flow_from_detail(flow_detail)
|
||||||
mock_import.assert_called_onec_with(name)
|
mock_import.assert_called_once_with(name)
|
||||||
self.assertEqual(result, 'RESULT foo')
|
self.assertEqual(result, 'RESULT foo')
|
||||||
|
|
||||||
|
|
||||||
|
@@ -274,7 +274,7 @@ class TaskTest(test.TestCase):
|
|||||||
a_task = ProgressTask()
|
a_task = ProgressTask()
|
||||||
a_task.notifier.register(task.EVENT_UPDATE_PROGRESS, progress_callback)
|
a_task.notifier.register(task.EVENT_UPDATE_PROGRESS, progress_callback)
|
||||||
a_task.execute([0.5])
|
a_task.execute([0.5])
|
||||||
mocked_warn.assert_called_once()
|
self.assertEqual(1, mocked_warn.call_count)
|
||||||
|
|
||||||
def test_register_handler_is_none(self):
|
def test_register_handler_is_none(self):
|
||||||
a_task = MyTask()
|
a_task = MyTask()
|
||||||
|
Reference in New Issue
Block a user