aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/tests/unit/test_cmd/commands/test_env.py
diff options
context:
space:
mode:
authorEmma Foley <emma.l.foley@intel.com>2018-03-05 17:41:33 +0000
committerEmma Foley <emma.l.foley@intel.com>2018-03-05 17:41:33 +0000
commit3478059d4397c5ee3a1d1e4707c5883afd0974a8 (patch)
tree2c2d5c68c3f2a6232ab0b71e00e07184ded9926f /yardstick/tests/unit/test_cmd/commands/test_env.py
parent8400c1895c49cb0c7802692f75d820fb5b8b7dc4 (diff)
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' <list_of_files> Change-Id: I4f26e0c736bf33e0b2413c8e8c33dbdb91f090e2 JIRA: YARDSTICK-865 Signed-off-by: Emma Foley <emma.l.foley@intel.com>
Diffstat (limited to 'yardstick/tests/unit/test_cmd/commands/test_env.py')
-rw-r--r--yardstick/tests/unit/test_cmd/commands/test_env.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/yardstick/tests/unit/test_cmd/commands/test_env.py b/yardstick/tests/unit/test_cmd/commands/test_env.py
index 1156b6642..57dacbcd3 100644
--- a/yardstick/tests/unit/test_cmd/commands/test_env.py
+++ b/yardstick/tests/unit/test_cmd/commands/test_env.py
@@ -21,30 +21,30 @@ class EnvCommandTestCase(unittest.TestCase):
def test_do_influxdb(self, check_status_mock, start_async_task_mock):
env = EnvCommand()
env.do_influxdb({})
- self.assertTrue(start_async_task_mock.called)
- self.assertTrue(check_status_mock.called)
+ start_async_task_mock.assert_called_once()
+ check_status_mock.assert_called_once()
@mock.patch('yardstick.cmd.commands.env.EnvCommand._start_async_task')
@mock.patch('yardstick.cmd.commands.env.EnvCommand._check_status')
def test_do_grafana(self, check_status_mock, start_async_task_mock):
env = EnvCommand()
env.do_grafana({})
- self.assertTrue(start_async_task_mock.called)
- self.assertTrue(check_status_mock.called)
+ start_async_task_mock.assert_called_once()
+ check_status_mock.assert_called_once()
@mock.patch('yardstick.cmd.commands.env.EnvCommand._start_async_task')
@mock.patch('yardstick.cmd.commands.env.EnvCommand._check_status')
def test_do_prepare(self, check_status_mock, start_async_task_mock):
env = EnvCommand()
env.do_prepare({})
- self.assertTrue(start_async_task_mock.called)
- self.assertTrue(check_status_mock.called)
+ start_async_task_mock.assert_called_once()
+ check_status_mock.assert_called_once()
@mock.patch('yardstick.cmd.commands.env.HttpClient.post')
def test_start_async_task(self, post_mock):
data = {'action': 'create_grafana'}
EnvCommand()._start_async_task(data)
- self.assertTrue(post_mock.called)
+ post_mock.assert_called_once()
@mock.patch('yardstick.cmd.commands.env.HttpClient.get')
@mock.patch('yardstick.cmd.commands.env.EnvCommand._print_status')