move nova v3 delete image tests into glance testing
There is no image api in nova v3 api. so move the tests
that just test glance into glance testing from nova v3
testing. The rest tests in compute.v3.image.test_images
just are the tests related to nova, like creating image
from a server. Also move the negative tests in test_image
to a separate file.
Partially implements blueprint nova-v3-api-tests
Change-Id: I42c0f08434de4a51d41f2fafd95cfaf72a9dd6da
diff --git a/tempest/api/compute/v3/images/test_images.py b/tempest/api/compute/v3/images/test_images.py
index f3dfeec..b127be2 100644
--- a/tempest/api/compute/v3/images/test_images.py
+++ b/tempest/api/compute/v3/images/test_images.py
@@ -123,43 +123,6 @@
self.servers_client.create_image,
test_uuid, snapshot_name)
- @attr(type=['negative', 'gate'])
- def test_delete_image_with_invalid_image_id(self):
- # An image should not be deleted with invalid image id
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
- '!@$%^&*()')
-
- @attr(type=['negative', 'gate'])
- def test_delete_non_existent_image(self):
- # Return an error while trying to delete a non-existent image
-
- non_existent_image_id = '11a22b9-12a9-5555-cc11-00ab112223fa'
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
- non_existent_image_id)
-
- @attr(type=['negative', 'gate'])
- def test_delete_image_blank_id(self):
- # Return an error while trying to delete an image with blank Id
- self.assertRaises(exceptions.NotFound, self.client.delete_image, '')
-
- @attr(type=['negative', 'gate'])
- def test_delete_image_non_hex_string_id(self):
- # Return an error while trying to delete an image with non hex id
- image_id = '11a22b9-120q-5555-cc11-00ab112223gj'
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
- image_id)
-
- @attr(type=['negative', 'gate'])
- def test_delete_image_negative_image_id(self):
- # Return an error while trying to delete an image with negative id
- self.assertRaises(exceptions.NotFound, self.client.delete_image, -1)
-
- @attr(type=['negative', 'gate'])
- def test_delete_image_id_is_over_35_character_limit(self):
- # Return an error while trying to delete image with id over limit
- self.assertRaises(exceptions.NotFound, self.client.delete_image,
- '11a22b9-12a9-5555-cc11-00ab112223fa-3fac')
-
class ImagesV3TestXML(ImagesV3TestJSON):
_interface = 'xml'
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index 90ffeae..558e2ec 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -18,7 +18,6 @@
import cStringIO as StringIO
from tempest.api.image import base
-from tempest import exceptions
from tempest.test import attr
@@ -26,17 +25,6 @@
"""Here we test the registration and creation of images."""
@attr(type='gate')
- def test_register_with_invalid_container_format(self):
- # Negative tests for invalid data supplied to POST /images
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
- 'test', 'wrong', 'vhd')
-
- @attr(type='gate')
- def test_register_with_invalid_disk_format(self):
- self.assertRaises(exceptions.BadRequest, self.client.create_image,
- 'test', 'bare', 'wrong')
-
- @attr(type='gate')
def test_register_then_upload(self):
# Register, then upload an image
properties = {'prop1': 'val1'}
@@ -108,6 +96,8 @@
self.assertEqual(40, body.get('min_ram'))
for key, val in properties.items():
self.assertEqual(val, body.get('properties')[key])
+ resp, body = self.client.delete_image(body['id'])
+ self.assertEqual('200', resp['status'])
class ListImagesTest(base.BaseV1ImageTest):
diff --git a/tempest/api/image/v1/test_images_negative.py b/tempest/api/image/v1/test_images_negative.py
new file mode 100644
index 0000000..1bcf120
--- /dev/null
+++ b/tempest/api/image/v1/test_images_negative.py
@@ -0,0 +1,72 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2013 IBM Corp.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.image import base
+from tempest import exceptions
+from tempest.test import attr
+
+
+class CreateDeleteImagesNegativeTest(base.BaseV1ImageTest):
+ """Here are negative tests for the deletion and creation of images."""
+
+ @attr(type=['negative', 'gate'])
+ def test_register_with_invalid_container_format(self):
+ # Negative tests for invalid data supplied to POST /images
+ self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ 'test', 'wrong', 'vhd')
+
+ @attr(type=['negative', 'gate'])
+ def test_register_with_invalid_disk_format(self):
+ self.assertRaises(exceptions.BadRequest, self.client.create_image,
+ 'test', 'bare', 'wrong')
+
+ @attr(type=['negative', 'gate'])
+ def test_delete_image_with_invalid_image_id(self):
+ # An image should not be deleted with invalid image id
+ self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ '!@$%^&*()')
+
+ @attr(type=['negative', 'gate'])
+ def test_delete_non_existent_image(self):
+ # Return an error while trying to delete a non-existent image
+
+ non_existent_image_id = '11a22b9-12a9-5555-cc11-00ab112223fa'
+ self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ non_existent_image_id)
+
+ @attr(type=['negative', 'gate'])
+ def test_delete_image_blank_id(self):
+ # Return an error while trying to delete an image with blank Id
+ self.assertRaises(exceptions.NotFound, self.client.delete_image, '')
+
+ @attr(type=['negative', 'gate'])
+ def test_delete_image_non_hex_string_id(self):
+ # Return an error while trying to delete an image with non hex id
+ image_id = '11a22b9-120q-5555-cc11-00ab112223gj'
+ self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ image_id)
+
+ @attr(type=['negative', 'gate'])
+ def test_delete_image_negative_image_id(self):
+ # Return an error while trying to delete an image with negative id
+ self.assertRaises(exceptions.NotFound, self.client.delete_image, -1)
+
+ @attr(type=['negative', 'gate'])
+ def test_delete_image_id_is_over_35_character_limit(self):
+ # Return an error while trying to delete image with id over limit
+ self.assertRaises(exceptions.NotFound, self.client.delete_image,
+ '11a22b9-12a9-5555-cc11-00ab112223fa-3fac')