Fix bad Mock calls to assert_called_once()

To actually check if a call was made, we should use
assert_called_once_with. assert_called_once is just a auto-spec'd
method and hence does not really check anything.

Change-Id: I64f902d3165d58e13c876d0184bf1d1ae4f81bae
This commit is contained in:
ChangBo Guo(gcb) 2014-05-16 10:43:18 +08:00
parent 6239eb863a
commit 3ee46a8e32

@ -448,7 +448,7 @@ class IPMIToolDriverTestCase(db_base.DbTestCase):
with task_manager.acquire(self.context,
[self.node['uuid']]) as task:
task.driver.power.validate(task, task.node)
exec_mock.assert_called_once()
exec_mock.assert_called_once_with(mock.ANY, "mc guid")
@mock.patch.object(ipmi, '_exec_ipmitool')
def test_validate_fail(self, exec_mock):
@ -458,7 +458,7 @@ class IPMIToolDriverTestCase(db_base.DbTestCase):
self.assertRaises(exception.InvalidParameterValue,
task.driver.power.validate, task,
task.node)
exec_mock.assert_called_once()
exec_mock.assert_called_once_with(mock.ANY, "mc guid")
@mock.patch.object(console_utils, 'start_shellinabox_console',
autospec=True)