Fixes Bug 992215-Some new tests to be added to test_images.py and test_authorization.py

Change-Id: Ib290bcbc338c68ce3063d17791293378defa7eeb
diff --git a/tempest/tests/test_authorization.py b/tempest/tests/test_authorization.py
index 44000a5..147f488 100644
--- a/tempest/tests/test_authorization.py
+++ b/tempest/tests/test_authorization.py
@@ -207,3 +207,17 @@
     def test_delete_keypair_of_other_account_fails(self):
         """A DELETE request for another user's keypair should fail"""
         self.other_keypairs_client.delete_keypair(self.keypairname)
+
+    @raises(exceptions.NotFound)
+    @attr(type='negative')
+    @utils.skip_unless_attr('multi_user', 'Second user not configured')
+    def test_get_image_for_other_account_fails(self):
+        """A GET request for an image on another user's account should fail"""
+        self.other_images_client.get_image(self.image['id'])
+
+    @raises(exceptions.NotFound)
+    @attr(type='negative')
+    @utils.skip_unless_attr('multi_user', 'Second user not configured')
+    def test_delete_image_for_other_account_fails(self):
+        """A DELETE request for another user's image should fail"""
+        self.other_images_client.delete_image(self.image['id'])
diff --git a/tempest/tests/test_images.py b/tempest/tests/test_images.py
index 33020d6..65fd4be 100644
--- a/tempest/tests/test_images.py
+++ b/tempest/tests/test_images.py
@@ -6,6 +6,7 @@
 import tempest.config
 from tempest import openstack
 from tempest.common.utils import data_utils
+from tempest import exceptions
 
 
 class ImagesTest(BaseComputeTest):
@@ -79,3 +80,38 @@
             self.client.wait_for_image_status(image_id, 'ACTIVE')
             self.client.delete_image(image_id)
             self.fail("Should not create snapshot from deleted instance!")
+
+    @attr(type='negative')
+    def test_create_image_from_invalid_server(self):
+        """An image should not be created with invalid server id"""
+        try:
+            # Create a new image with invalid server id
+            name = rand_name('image')
+            meta = {'image_type': 'test'}
+            resp = {}
+            resp['status'] = None
+            resp, body = self.client.create_image('!@#$%^&*()', name, meta)
+
+        except exceptions.NotFound:
+            pass
+
+        finally:
+            if (resp['status'] != None):
+                image_id = data_utils.parse_image_id(resp['location'])
+                resp, _ = self.client.delete_image(image_id)
+                self.fail("An image should not be created"
+                            " with invalid server id")
+
+    @attr(type='negative')
+    def test_delete_image_with_invalid_image_id(self):
+        """An image should not be deleted with invalid image id"""
+        try:
+            # Delete an image with invalid image id
+            resp, _ = self.client.delete_image('!@$%^&*()')
+
+        except exceptions.NotFound:
+            pass
+
+        else:
+            self.fail("DELETE image request should rasie NotFound exception"
+                        "when requested with invalid image")