def test_create_and_delete_snapshot(self, mock_sleep_between): mock_service = self.mock_cinder.return_value scenario = volumes.CreateAndDeleteSnapshot(self._get_context()) scenario.run(False, 10, 20, fakearg="f") mock_service.create_snapshot.assert_called_once_with("uuid", force=False, fakearg="f") mock_sleep_between.assert_called_once_with(10, 20) mock_service.delete_snapshot.assert_called_once_with( mock_service.create_snapshot.return_value)
def test_create_and_delete_snapshot(self): fake_snapshot = mock.MagicMock() scenario = volumes.CreateAndDeleteSnapshot(self._get_context()) scenario._create_snapshot = mock.MagicMock(return_value=fake_snapshot) scenario.sleep_between = mock.MagicMock() scenario._delete_snapshot = mock.MagicMock() scenario.run(False, 10, 20, fakearg="f") scenario._create_snapshot.assert_called_once_with("uuid", force=False, fakearg="f") scenario.sleep_between.assert_called_once_with(10, 20) scenario._delete_snapshot.assert_called_once_with(fake_snapshot)