From 3478059d4397c5ee3a1d1e4707c5883afd0974a8 Mon Sep 17 00:00:00 2001 From: Emma Foley Date: Mon, 5 Mar 2018 17:41:33 +0000 Subject: assertTrue(mock.called) -> mock.assert_called When checking whether a mocked method has been called, mock.assert_called or mock.assert_called_once should be used, and not unittest.assertTrue(mock.called) This change does this update. It can be verified with: grep -irn "self.assertTrue(.*called)" --exclude-dir=.tox And the replacement was done with: sed -i 's/self.assertTrue(\(.*\).called)/\1.assert_called_once()/g' Change-Id: I4f26e0c736bf33e0b2413c8e8c33dbdb91f090e2 JIRA: YARDSTICK-865 Signed-off-by: Emma Foley --- yardstick/tests/unit/benchmark/contexts/test_heat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'yardstick/tests/unit/benchmark/contexts/test_heat.py') diff --git a/yardstick/tests/unit/benchmark/contexts/test_heat.py b/yardstick/tests/unit/benchmark/contexts/test_heat.py index f48d6f32c..479db8ad1 100644 --- a/yardstick/tests/unit/benchmark/contexts/test_heat.py +++ b/yardstick/tests/unit/benchmark/contexts/test_heat.py @@ -365,7 +365,7 @@ class HeatContextTestCase(unittest.TestCase): self.test_context.key_filename = 'foo/bar/foobar' self.test_context.undeploy() mock_delete_key.assert_called() - self.assertTrue(mock_template.delete.called) + mock_template.delete.assert_called_once() @mock.patch('yardstick.benchmark.contexts.heat.HeatTemplate') def test_undeploy_no_teardown(self, mock_template): -- cgit 1.2.3-korg