def test_create_and_list_volume(self): scenario = volumes.CreateAndListVolume(self.context) scenario._create_volume = mock.MagicMock() scenario._list_volumes = mock.MagicMock() scenario.run(1, True, fakearg="f") scenario._create_volume.assert_called_once_with(1, fakearg="f") scenario._list_volumes.assert_called_once_with(True)
def test_create_and_list_volume(self): mock_service = self.mock_cinder.return_value scenario = volumes.CreateAndListVolume(self._get_context()) scenario.run(1, True, fakearg="f") mock_service.create_volume.assert_called_once_with(1, fakearg="f") mock_service.list_volumes.assert_called_once_with(True)
def test_create_volume_from_image_and_list(self): fake_volume = mock.MagicMock() scenario = volumes.CreateAndListVolume(self.context) scenario._create_volume = mock.MagicMock(return_value=fake_volume) scenario._list_volumes = mock.MagicMock() scenario.run(1, True, "fake_image") scenario._create_volume.assert_called_once_with(1, imageRef="fake_image") scenario._list_volumes.assert_called_once_with(True)