summaryrefslogtreecommitdiff
path: root/nova/tests/unit/api/openstack/compute/test_volumes.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/tests/unit/api/openstack/compute/test_volumes.py')
-rw-r--r--nova/tests/unit/api/openstack/compute/test_volumes.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/nova/tests/unit/api/openstack/compute/test_volumes.py b/nova/tests/unit/api/openstack/compute/test_volumes.py
index 42745aa100..0097f74ded 100644
--- a/nova/tests/unit/api/openstack/compute/test_volumes.py
+++ b/nova/tests/unit/api/openstack/compute/test_volumes.py
@@ -721,9 +721,17 @@ class VolumeAttachTestsV21(test.NoDBTestCase):
status_int = result.status_int
self.assertEqual(202, status_int)
- def test_swap_volume_no_attachment(self):
+ def test_swap_volume_with_nonexistent_uri(self):
self.assertRaises(exc.HTTPNotFound, self._test_swap,
- self.attachments, FAKE_UUID_C)
+ self.attachments, uuid=FAKE_UUID_C)
+
+ @mock.patch.object(cinder.API, 'get')
+ def test_swap_volume_with_nonexistent_dest_in_body(self, mock_update):
+ mock_update.side_effect = [
+ None, exception.VolumeNotFound(volume_id=FAKE_UUID_C)]
+ body = {'volumeAttachment': {'volumeId': FAKE_UUID_C}}
+ self.assertRaises(exc.HTTPBadRequest, self._test_swap,
+ self.attachments, body=body)
def test_swap_volume_without_volumeId(self):
body = {'volumeAttachment': {'device': '/dev/fake'}}