Merge "Tests: Fix invalid assert_called_once calls in driver tests"

This commit is contained in:
Zuul 2023-01-21 01:23:22 +00:00 committed by Gerrit Code Review
commit 4b8e596e7b
3 changed files with 6 additions and 7 deletions

View File

@ -913,8 +913,9 @@ class DellSCSanISCSIDriverTestCase(test.TestCase):
data = self.driver.initialize_connection(volume, connector)
self.assertEqual('iscsi', data['driver_volume_type'])
# verify find_volume has been called and that is has been called twice
mock_find_volume.called_once_with(fake.VOLUME_ID, provider_id)
mock_get_volume.called_once_with(provider_id)
mock_find_volume.assert_called_once_with(fake.VOLUME_ID, provider_id,
False)
mock_get_volume.assert_called_once_with(provider_id)
props = self.ISCSI_PROPERTIES.copy()
expected = {'data': props,
'driver_volume_type': 'iscsi'}

View File

@ -388,7 +388,7 @@ class QuobyteDriverTestCase(test.TestCase):
mock_execute.assert_has_calls(
[mount_call], any_order=False)
mock_validate.called_once_with(self.TEST_MNT_POINT)
mock_validate.assert_called_once_with(self.TEST_MNT_POINT)
def test_mount_quobyte_already_mounted_detected_seen_in_proc_mount(self):
with mock.patch('cinder.volume.drivers.quobyte.QuobyteDriver'

View File

@ -744,9 +744,6 @@ class RemoteFsSnapDriverTestCase(test.TestCase):
'volume_type_id': src_vref.volume_type_id,
'encryption_key_id': None,
}
snap_args_deletion = snap_args_creation.copy()
snap_args_deletion["status"] = fields.SnapshotStatus.DELETED
snap_args_deletion["deleted"] = True
mock_obj_snap.return_value = mock.Mock()
mock_obj_snap.return_value.create = mock.Mock()
@ -771,7 +768,8 @@ class RemoteFsSnapDriverTestCase(test.TestCase):
mock_copy_volume_from_snapshot.assert_called_once_with(
mock_obj_snap.return_value, volume_ref, volume['size'],
src_encryption_key_id=None, new_encryption_key_id=None)
mock_delete_snapshot.called_once_with(snap_args_deletion)
mock_delete_snapshot.assert_called_once_with(
mock_obj_snap.return_value)
else:
self.assertFalse(mock_create_snapshot.called)