remove some unused code in nova image tests

this removes some unused alt_client and images_id in the nova image
tests.

Change-Id: Ied9f098be9bbbc845ad07a40bfedf2dab9b9eceb
diff --git a/tempest/api/compute/images/test_images.py b/tempest/api/compute/images/test_images.py
index 4cc36c9..8964dcf 100644
--- a/tempest/api/compute/images/test_images.py
+++ b/tempest/api/compute/images/test_images.py
@@ -13,11 +13,10 @@
 #    under the License.
 
 from tempest.api.compute import base
-from tempest import clients
 from tempest.common.utils import data_utils
 from tempest import config
 from tempest import exceptions
-from tempest.test import attr
+from tempest import test
 
 CONF = config.CONF
 
@@ -36,18 +35,6 @@
 
         cls.image_ids = []
 
-        if cls.multi_user:
-            if CONF.compute.allow_tenant_isolation:
-                creds = cls.isolated_creds.get_alt_creds()
-                username, tenant_name, password = creds
-                cls.alt_manager = clients.Manager(username=username,
-                                                  password=password,
-                                                  tenant_name=tenant_name)
-            else:
-                # Use the alt_XXX credentials in the config file
-                cls.alt_manager = clients.AltManager()
-            cls.alt_client = cls.alt_manager.images_client
-
     def tearDown(self):
         """Terminate test instances created after a test is executed."""
         for image_id in self.image_ids:
@@ -62,7 +49,7 @@
         self.image_ids.append(image_id)
         return resp, body
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_from_deleted_server(self):
         # An image should not be created if the server instance is removed
         resp, server = self.create_test_server(wait_until='ACTIVE')
@@ -77,7 +64,7 @@
                           self.__create_image__,
                           server['id'], name, meta)
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_from_invalid_server(self):
         # An image should not be created with invalid server id
         # Create a new image with invalid server id
@@ -88,7 +75,7 @@
         self.assertRaises(exceptions.NotFound, self.__create_image__,
                           '!@#$%^&*()', name, meta)
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_from_stopped_server(self):
         resp, server = self.create_test_server(wait_until='ACTIVE')
         self.servers_client.stop(server['id'])
@@ -103,7 +90,7 @@
         self.addCleanup(self.client.delete_image, image['id'])
         self.assertEqual(snapshot_name, image['name'])
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_delete_saving_image(self):
         snapshot_name = data_utils.rand_name('test-snap-')
         resp, server = self.create_test_server(wait_until='ACTIVE')
@@ -114,7 +101,7 @@
         resp, body = self.client.delete_image(image['id'])
         self.assertEqual('204', resp['status'])
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_specify_uuid_35_characters_or_less(self):
         # Return an error if Image ID passed is 35 characters or less
         snapshot_name = data_utils.rand_name('test-snap-')
@@ -122,7 +109,7 @@
         self.assertRaises(exceptions.NotFound, self.client.create_image,
                           test_uuid, snapshot_name)
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_specify_uuid_37_characters_or_more(self):
         # Return an error if Image ID passed is 37 characters or more
         snapshot_name = data_utils.rand_name('test-snap-')
@@ -130,13 +117,13 @@
         self.assertRaises(exceptions.NotFound, self.client.create_image,
                           test_uuid, snapshot_name)
 
-    @attr(type=['negative', 'gate'])
+    @test.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'])
+    @test.attr(type=['negative', 'gate'])
     def test_delete_non_existent_image(self):
         # Return an error while trying to delete a non-existent image
 
@@ -144,24 +131,24 @@
         self.assertRaises(exceptions.NotFound, self.client.delete_image,
                           non_existent_image_id)
 
-    @attr(type=['negative', 'gate'])
+    @test.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'])
+    @test.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'])
+    @test.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'])
+    @test.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,
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index 8d60623..7d5593d 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -16,11 +16,10 @@
 import testtools
 
 from tempest.api.compute import base
-from tempest import clients
 from tempest.common.utils import data_utils
 from tempest import config
 from tempest.openstack.common import log as logging
-from tempest.test import attr
+from tempest import test
 
 CONF = config.CONF
 LOG = logging.getLogger(__name__)
@@ -29,13 +28,6 @@
 class ImagesOneServerTestJSON(base.BaseV2ComputeTest):
     _interface = 'json'
 
-    def tearDown(self):
-        """Terminate test instances created after a test is executed."""
-        for image_id in self.image_ids:
-            self.client.delete_image(image_id)
-            self.image_ids.remove(image_id)
-        super(ImagesOneServerTestJSON, self).tearDown()
-
     def setUp(self):
         # NOTE(afazekas): Normally we use the same server with all test cases,
         # but if it has an issue, we build a new one
@@ -66,27 +58,13 @@
             cls.tearDownClass()
             raise
 
-        cls.image_ids = []
-
-        if cls.multi_user:
-            if CONF.compute.allow_tenant_isolation:
-                creds = cls.isolated_creds.get_alt_creds()
-                username, tenant_name, password = creds
-                cls.alt_manager = clients.Manager(username=username,
-                                                  password=password,
-                                                  tenant_name=tenant_name)
-            else:
-                # Use the alt_XXX credentials in the config file
-                cls.alt_manager = clients.AltManager()
-            cls.alt_client = cls.alt_manager.images_client
-
     def _get_default_flavor_disk_size(self, flavor_id):
         resp, flavor = self.flavors_client.get_flavor_details(flavor_id)
         return flavor['disk']
 
     @testtools.skipUnless(CONF.compute_feature_enabled.create_image,
                           'Environment unable to create images.')
-    @attr(type='smoke')
+    @test.attr(type='smoke')
     def test_create_delete_image(self):
 
         # Create a new image
@@ -117,7 +95,7 @@
         self.assertEqual('204', resp['status'])
         self.client.wait_for_resource_deletion(image_id)
 
-    @attr(type=['gate'])
+    @test.attr(type=['gate'])
     def test_create_image_specify_multibyte_character_image_name(self):
         if self.__class__._interface == "xml":
             # NOTE(sdague): not entirely accurage, but we'd need a ton of work
diff --git a/tempest/api/compute/images/test_images_oneserver_negative.py b/tempest/api/compute/images/test_images_oneserver_negative.py
index c96c4a4..82955d8 100644
--- a/tempest/api/compute/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/images/test_images_oneserver_negative.py
@@ -15,13 +15,11 @@
 #    under the License.
 
 from tempest.api.compute import base
-from tempest import clients
 from tempest.common.utils import data_utils
 from tempest import config
 from tempest import exceptions
 from tempest.openstack.common import log as logging
-from tempest.test import attr
-from tempest.test import skip_because
+from tempest import test
 
 CONF = config.CONF
 
@@ -73,20 +71,8 @@
 
         cls.image_ids = []
 
-        if cls.multi_user:
-            if CONF.compute.allow_tenant_isolation:
-                creds = cls.isolated_creds.get_alt_creds()
-                username, tenant_name, password = creds
-                cls.alt_manager = clients.Manager(username=username,
-                                                  password=password,
-                                                  tenant_name=tenant_name)
-            else:
-                # Use the alt_XXX credentials in the config file
-                cls.alt_manager = clients.AltManager()
-            cls.alt_client = cls.alt_manager.images_client
-
-    @skip_because(bug="1006725")
-    @attr(type=['negative', 'gate'])
+    @test.skip_because(bug="1006725")
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_specify_multibyte_character_image_name(self):
         if self.__class__._interface == "xml":
             raise self.skipException("Not testable in XML")
@@ -98,7 +84,7 @@
                           self.client.create_image, self.server_id,
                           invalid_name)
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_specify_invalid_metadata(self):
         # Return an error when creating image with invalid metadata
         snapshot_name = data_utils.rand_name('test-snap-')
@@ -106,7 +92,7 @@
         self.assertRaises(exceptions.BadRequest, self.client.create_image,
                           self.server_id, snapshot_name, meta)
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_specify_metadata_over_limits(self):
         # Return an error when creating image with meta data over 256 chars
         snapshot_name = data_utils.rand_name('test-snap-')
@@ -114,7 +100,7 @@
         self.assertRaises(exceptions.BadRequest, self.client.create_image,
                           self.server_id, snapshot_name, meta)
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_second_image_when_first_image_is_being_saved(self):
         # Disallow creating another image when first image is being saved
 
@@ -132,7 +118,7 @@
         self.assertRaises(exceptions.Conflict, self.client.create_image,
                           self.server_id, alt_snapshot_name)
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_specify_name_over_256_chars(self):
         # Return an error if snapshot name over 256 characters is passed
 
@@ -140,7 +126,7 @@
         self.assertRaises(exceptions.BadRequest, self.client.create_image,
                           self.server_id, snapshot_name)
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_delete_image_that_is_not_yet_active(self):
         # Return an error while trying to delete an image what is creating
 
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index 6cbf18d..9cff3a8 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -16,7 +16,7 @@
 from tempest.api.compute import base
 from tempest import config
 from tempest.openstack.common import log as logging
-from tempest.test import attr
+from tempest import test
 
 CONF = config.CONF
 
@@ -33,7 +33,6 @@
             skip_msg = ("%s skipped as glance is not available" % cls.__name__)
             raise cls.skipException(skip_msg)
         cls.client = cls.images_client
-        cls.image_ids = []
 
         try:
             resp, cls.server1 = cls.create_test_server()
@@ -63,7 +62,7 @@
             cls.tearDownClass()
             raise
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_filter_by_status(self):
         # The list of images should contain only images with the
         # provided status
@@ -74,7 +73,7 @@
         self.assertTrue(any([i for i in images if i['id'] == self.image2_id]))
         self.assertTrue(any([i for i in images if i['id'] == self.image3_id]))
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_filter_by_name(self):
         # List of all images should contain the expected images filtered
         # by name
@@ -85,7 +84,7 @@
         self.assertFalse(any([i for i in images if i['id'] == self.image2_id]))
         self.assertFalse(any([i for i in images if i['id'] == self.image3_id]))
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_filter_by_server_id(self):
         # The images should contain images filtered by server id
         params = {'server': self.server1['id']}
@@ -97,7 +96,7 @@
         self.assertTrue(any([i for i in images if i['id'] == self.image2_id]))
         self.assertFalse(any([i for i in images if i['id'] == self.image3_id]))
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_filter_by_server_ref(self):
         # The list of servers should be filtered by server ref
         server_links = self.server2['links']
@@ -114,7 +113,7 @@
             self.assertTrue(any([i for i in images
                                  if i['id'] == self.image3_id]))
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_filter_by_type(self):
         # The list of servers should be filtered by image type
         params = {'type': 'snapshot'}
@@ -125,7 +124,7 @@
         self.assertTrue(any([i for i in images if i['id'] == self.image3_id]))
         self.assertFalse(any([i for i in images if i['id'] == self.image_ref]))
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_limit_results(self):
         # Verify only the expected number of results are returned
         params = {'limit': '1'}
@@ -134,7 +133,7 @@
         # ref: Question #224349
         self.assertEqual(1, len([x for x in images if 'id' in x]))
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_filter_by_changes_since(self):
         # Verify only updated images are returned in the detailed list
 
@@ -145,7 +144,7 @@
         found = any([i for i in images if i['id'] == self.image3_id])
         self.assertTrue(found)
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_with_detail_filter_by_status(self):
         # Detailed list of all images should only contain images
         # with the provided status
@@ -156,7 +155,7 @@
         self.assertTrue(any([i for i in images if i['id'] == self.image2_id]))
         self.assertTrue(any([i for i in images if i['id'] == self.image3_id]))
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_with_detail_filter_by_name(self):
         # Detailed list of all images should contain the expected
         # images filtered by name
@@ -167,7 +166,7 @@
         self.assertFalse(any([i for i in images if i['id'] == self.image2_id]))
         self.assertFalse(any([i for i in images if i['id'] == self.image3_id]))
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_with_detail_limit_results(self):
         # Verify only the expected number of results (with full details)
         # are returned
@@ -175,7 +174,7 @@
         resp, images = self.client.list_images_with_detail(params)
         self.assertEqual(1, len(images))
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_with_detail_filter_by_server_ref(self):
         # Detailed list of servers should be filtered by server ref
         server_links = self.server2['links']
@@ -192,7 +191,7 @@
             self.assertTrue(any([i for i in images
                                  if i['id'] == self.image3_id]))
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_with_detail_filter_by_type(self):
         # The detailed list of servers should be filtered by image type
         params = {'type': 'snapshot'}
@@ -204,7 +203,7 @@
         self.assertTrue(any([i for i in images if i['id'] == self.image3_id]))
         self.assertFalse(any([i for i in images if i['id'] == self.image_ref]))
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_list_images_with_detail_filter_by_changes_since(self):
         # Verify an update image is returned
 
diff --git a/tempest/api/compute/v3/images/test_images.py b/tempest/api/compute/v3/images/test_images.py
index bbb84fb..b045630 100644
--- a/tempest/api/compute/v3/images/test_images.py
+++ b/tempest/api/compute/v3/images/test_images.py
@@ -13,11 +13,10 @@
 #    under the License.
 
 from tempest.api.compute import base
-from tempest import clients
 from tempest.common.utils import data_utils
 from tempest import config
 from tempest import exceptions
-from tempest.test import attr
+from tempest import test
 
 CONF = config.CONF
 
@@ -34,18 +33,6 @@
         cls.client = cls.images_client
         cls.servers_client = cls.servers_client
 
-        if cls.multi_user:
-            if CONF.compute.allow_tenant_isolation:
-                creds = cls.isolated_creds.get_alt_creds()
-                username, tenant_name, password = creds
-                cls.alt_manager = clients.Manager(username=username,
-                                                  password=password,
-                                                  tenant_name=tenant_name)
-            else:
-                # Use the alt_XXX credentials in the config file
-                cls.alt_manager = clients.AltManager()
-            cls.alt_client = cls.alt_manager.images_client
-
     def __create_image__(self, server_id, name, meta=None):
         resp, body = self.servers_client.create_image(server_id, name, meta)
         image_id = data_utils.parse_image_id(resp['location'])
@@ -53,7 +40,7 @@
         self.client.wait_for_image_status(image_id, 'ACTIVE')
         return resp, body
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_from_deleted_server(self):
         # An image should not be created if the server instance is removed
         resp, server = self.create_test_server(wait_until='ACTIVE')
@@ -68,7 +55,7 @@
                           self.__create_image__,
                           server['id'], name, meta)
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_from_invalid_server(self):
         # An image should not be created with invalid server id
         # Create a new image with invalid server id
@@ -79,7 +66,7 @@
         self.assertRaises(exceptions.NotFound, self.__create_image__,
                           '!@#$%^&*()', name, meta)
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_from_stopped_server(self):
         resp, server = self.create_test_server(wait_until='ACTIVE')
         self.servers_client.stop(server['id'])
@@ -93,7 +80,7 @@
         self.addCleanup(self.client.delete_image, image['id'])
         self.assertEqual(snapshot_name, image['name'])
 
-    @attr(type='gate')
+    @test.attr(type='gate')
     def test_delete_queued_image(self):
         snapshot_name = data_utils.rand_name('test-snap-')
         resp, server = self.create_test_server(wait_until='ACTIVE')
@@ -104,7 +91,7 @@
         resp, body = self.client.delete_image(image['id'])
         self.assertEqual('200', resp['status'])
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_specify_uuid_35_characters_or_less(self):
         # Return an error if Image ID passed is 35 characters or less
         snapshot_name = data_utils.rand_name('test-snap-')
@@ -113,7 +100,7 @@
                           self.servers_client.create_image,
                           test_uuid, snapshot_name)
 
-    @attr(type=['negative', 'gate'])
+    @test.attr(type=['negative', 'gate'])
     def test_create_image_specify_uuid_37_characters_or_more(self):
         # Return an error if Image ID passed is 37 characters or more
         snapshot_name = data_utils.rand_name('test-snap-')
diff --git a/tempest/api/compute/v3/images/test_images_oneserver.py b/tempest/api/compute/v3/images/test_images_oneserver.py
index cd40948..1ded4e4 100644
--- a/tempest/api/compute/v3/images/test_images_oneserver.py
+++ b/tempest/api/compute/v3/images/test_images_oneserver.py
@@ -16,7 +16,6 @@
 import testtools
 
 from tempest.api.compute import base
-from tempest import clients
 from tempest.common.utils import data_utils
 from tempest import config
 from tempest.openstack.common import log as logging
@@ -29,13 +28,6 @@
 class ImagesOneServerV3Test(base.BaseV3ComputeTest):
     _interface = 'json'
 
-    def tearDown(self):
-        """Terminate test instances created after a test is executed."""
-        for image_id in self.image_ids:
-            self.client.delete_image(image_id)
-            self.image_ids.remove(image_id)
-        super(ImagesOneServerV3Test, self).tearDown()
-
     def setUp(self):
         # NOTE(afazekas): Normally we use the same server with all test cases,
         # but if it has an issue, we build a new one
@@ -66,20 +58,6 @@
             cls.tearDownClass()
             raise
 
-        cls.image_ids = []
-
-        if cls.multi_user:
-            if CONF.compute.allow_tenant_isolation:
-                creds = cls.isolated_creds.get_alt_creds()
-                username, tenant_name, password = creds
-                cls.alt_manager = clients.Manager(username=username,
-                                                  password=password,
-                                                  tenant_name=tenant_name)
-            else:
-                # Use the alt_XXX credentials in the config file
-                cls.alt_manager = clients.AltManager()
-            cls.alt_client = cls.alt_manager.images_client
-
     def _get_default_flavor_disk_size(self, flavor_id):
         resp, flavor = self.flavors_client.get_flavor_details(flavor_id)
         return flavor['disk']
diff --git a/tempest/api/compute/v3/images/test_images_oneserver_negative.py b/tempest/api/compute/v3/images/test_images_oneserver_negative.py
index f2f2375..8d2517e 100644
--- a/tempest/api/compute/v3/images/test_images_oneserver_negative.py
+++ b/tempest/api/compute/v3/images/test_images_oneserver_negative.py
@@ -15,7 +15,6 @@
 #    under the License.
 
 from tempest.api.compute import base
-from tempest import clients
 from tempest.common.utils import data_utils
 from tempest import config
 from tempest import exceptions
@@ -72,18 +71,6 @@
 
         cls.image_ids = []
 
-        if cls.multi_user:
-            if CONF.compute.allow_tenant_isolation:
-                creds = cls.isolated_creds.get_alt_creds()
-                username, tenant_name, password = creds
-                cls.alt_manager = clients.Manager(username=username,
-                                                  password=password,
-                                                  tenant_name=tenant_name)
-            else:
-                # Use the alt_XXX credentials in the config file
-                cls.alt_manager = clients.AltManager()
-            cls.alt_client = cls.alt_manager.images_client
-
     @test.skip_because(bug="1006725")
     @test.attr(type=['negative', 'gate'])
     def test_create_image_specify_multibyte_character_image_name(self):