Fix wrong assertion methods

Replace 'called_once_with' with 'assert_called_once_with'.

Change-Id: I18b55da0d1f142818e7ea14f6eebcc0f0f0cd23f
Closes-Bug: 1989280
Signed-off-by: Takashi Natsume <takanattie@gmail.com>
This commit is contained in:
Takashi Natsume 2022-09-12 20:54:06 +09:00
parent 655fcc41b3
commit e7b1426e31
3 changed files with 13 additions and 13 deletions

View File

@ -702,8 +702,8 @@ class ISCSIConnectorTestCase(test_connector.ConnectorTestCase):
force=False, ignore_errors=False,
device_info=mock.sentinel.device_info)
get_dev_path_mock.called_once_with(self.CON_PROPS,
mock.sentinel.device_info)
get_dev_path_mock.assert_called_once_with(self.CON_PROPS,
mock.sentinel.device_info)
con_devs_mock.assert_called_once_with(self.CON_PROPS,
mock.sentinel.ips_iqns_luns,
False)

View File

@ -1430,10 +1430,10 @@ class NVMeOFConnectorTestCase(test_connector.ConnectorTestCase):
mock_find_dev.assert_called_once_with()
portal = target.portals[-1]
mock_cli.called_once_with(['connect', '-a', portal.address,
'-s', portal.port, '-t', portal.transport,
'-n', target.nqn, '-Q', '128', '-l', '-1',
'-q', 'host_nqn'])
mock_cli.assert_called_once_with([
'connect', '-a', portal.address, '-s', portal.port, '-t',
portal.transport, '-n', target.nqn, '-Q', '128', '-l', '-1',
'-q', 'host_nqn'])
@mock.patch.object(nvmeof.NVMeOFConnector, '_do_multipath',
mock.Mock(return_value=True))
@ -1497,9 +1497,9 @@ class NVMeOFConnectorTestCase(test_connector.ConnectorTestCase):
mock_find_dev.assert_called_once_with()
portal = target.portals[-1]
mock_cli.called_once_with(['connect', '-a', portal.address,
'-s', portal.port, '-t', portal.transport,
'-n', target.nqn, '-Q', '128', '-l', '-1'])
mock_cli.assert_called_once_with([
'connect', '-a', portal.address, '-s', portal.port, '-t',
portal.transport, '-n', target.nqn, '-Q', '128', '-l', '-1'])
self.assertEqual(1, mock_log.call_count)
@mock.patch.object(nvmeof.NVMeOFConnector, 'stop_and_assemble_raid')

View File

@ -358,8 +358,8 @@ class RBDConnectorTestCase(test_base_rbd.RBDConnectorTestMixin,
rbd_connector.disconnect_volume(conn, None)
# Assert that only showmapped is called when no mappings are found
mock_execute.called_once_with(*show_cmd, root_helper=None,
run_as_root=True)
mock_execute.assert_called_once_with(*show_cmd, root_helper=None,
run_as_root=True)
@mock.patch.object(priv_rootwrap, 'execute', return_value=None)
def test_disconnect_local_volume_no_mappings(self, mock_execute):
@ -374,8 +374,8 @@ class RBDConnectorTestCase(test_base_rbd.RBDConnectorTestMixin,
rbd_connector.disconnect_volume(conn, None)
# Assert that only showmapped is called when no mappings are found
mock_execute.called_once_with(*show_cmd, root_helper=None,
run_as_root=True)
mock_execute.assert_called_once_with(*show_cmd, root_helper=None,
run_as_root=True)
@mock.patch('oslo_utils.fileutils.delete_if_exists')
@mock.patch.object(rbd.RBDConnector, '_get_rbd_handle')