Adds delete api test to glance

This change adds api test for v2/images/​{image_id}
also moves to negative tests in test_images to test_images_negative
​

Change-Id: Id231ff3325a6a9a1a3eab67fafb2658832170f0c
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 133bae0..6408c15 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -1,8 +1,8 @@
 # vim: tabstop=4 shiftwidth=4 softtabstop=4
 
 # Copyright 2013 OpenStack Foundation
+# Copyright 2013 IBM Corp
 # All Rights Reserved.
-# Copyright 2013 IBM Corp.
 #
 #    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
@@ -21,28 +21,16 @@
 
 from tempest.api.image import base
 from tempest.common.utils import data_utils
-from tempest import exceptions
 from tempest.test import attr
 
 
-class CreateRegisterImagesTest(base.BaseV2ImageTest):
+class BasicOperationsImagesTest(base.BaseV2ImageTest):
 
     """
-    Here we test the registration and creation of images
+    Here we test the basic operations 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_upload_get_image_file(self):
 
         """
@@ -83,6 +71,28 @@
         self.assertEqual(200, resp.status)
         self.assertEqual(file_content, body)
 
+    @attr(type='gate')
+    def test_delete_image(self):
+        # Deletes a image by image_id
+
+        # Create image
+        image_name = data_utils.rand_name('image')
+        resp, body = self.client.create_image(name=image_name,
+                                              container_format='bare',
+                                              disk_format='raw',
+                                              visibility='public')
+        self.assertEqual(201, resp.status)
+        image_id = body['id']
+
+        # Delete Image
+        self.client.delete_image(image_id)
+        self.client.wait_for_resource_deletion(image_id)
+
+        # Verifying deletion
+        resp, images = self.client.image_list()
+        self.assertEqual(resp.status, 200)
+        self.assertNotIn(image_id, images)
+
 
 class ListImagesTest(base.BaseV2ImageTest):
 
diff --git a/tempest/api/image/v2/test_images_negative.py b/tempest/api/image/v2/test_images_negative.py
index 5bdaa99..1cd6f29 100644
--- a/tempest/api/image/v2/test_images_negative.py
+++ b/tempest/api/image/v2/test_images_negative.py
@@ -82,3 +82,14 @@
         image_id = ""
         self.assertRaises(exceptions.NotFound, self.client.delete_image,
                           image_id)
+
+    @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')