def test_create_from_volume_and_delete_volume(self): mock_service = self.mock_cinder.return_value vol_size = 1 scenario = volumes.CreateFromVolumeAndDeleteVolume(self._get_context()) scenario.run(vol_size) mock_service.create_volume.assert_called_once_with(1, source_volid="uuid") mock_service.delete_volume.assert_called_once_with( mock_service.create_volume.return_value)
def test_create_from_volume_and_delete_volume(self): fake_volume = mock.MagicMock() vol_size = 1 scenario = volumes.CreateFromVolumeAndDeleteVolume(self._get_context()) scenario._create_volume = mock.MagicMock(return_value=fake_volume) scenario._delete_volume = mock.MagicMock() scenario.run(vol_size) scenario._create_volume.assert_called_once_with(1, source_volid="uuid") scenario._delete_volume.assert_called_once_with(fake_volume)