summaryrefslogtreecommitdiffstats
path: root/nova/tests
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-01-02 19:50:18 +0000
committerGerrit Code Review <review@openstack.org>2013-01-02 19:50:18 +0000
commitfdcf843a4885b69fdaffe60437b462a1ea44ae5b (patch)
treec59e4c602d882817bd3f8437c54c395b86f59068 /nova/tests
parentc66755f0edfe803653e5e278dc078a7a7e82b6e4 (diff)
parent2b619e271624eb84947a9a9596745d06efe81b08 (diff)
Merge "Adds os-volume_attachments 'volume_id' validation"
Diffstat (limited to 'nova/tests')
-rw-r--r--nova/tests/api/openstack/compute/contrib/test_volumes.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/nova/tests/api/openstack/compute/contrib/test_volumes.py b/nova/tests/api/openstack/compute/contrib/test_volumes.py
index e8a315edd..3119f55e8 100644
--- a/nova/tests/api/openstack/compute/contrib/test_volumes.py
+++ b/nova/tests/api/openstack/compute/contrib/test_volumes.py
@@ -289,6 +289,27 @@ class VolumeAttachTests(test.TestCase):
self.assertEqual(result['volumeAttachment']['id'],
'00000000-aaaa-aaaa-aaaa-000000000000')
+ def test_attach_volume_bad_id(self):
+ self.stubs.Set(compute_api.API,
+ 'attach_volume',
+ fake_attach_volume)
+ attachments = volumes.VolumeAttachmentController()
+
+ body = {
+ 'volumeAttachment': {
+ 'device': None,
+ 'volumeId': 'TESTVOLUME',
+ }
+ }
+
+ req = fakes.HTTPRequest.blank('/v2/fake/os-volumes/attach')
+ req.method = 'POST'
+ req.content_type = 'application/json'
+ req.body = jsonutils.dumps(body)
+
+ self.assertRaises(webob.exc.HTTPBadRequest, attachments.create,
+ req, FAKE_UUID, body)
+
class VolumeSerializerTest(test.TestCase):
def _verify_volume_attachment(self, attach, tree):