Merge "Test to check container synchronization"
diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
index bd339b2..955068f 100644
--- a/tempest/services/compute/json/flavors_client.py
+++ b/tempest/services/compute/json/flavors_client.py
@@ -87,3 +87,22 @@
             if flavor['id'] == id:
                 return False
         return True
+
+    def set_flavor_extra_spec(self, flavor_id, specs):
+        """Sets extra Specs to the mentioned flavor."""
+        post_body = json.dumps({'extra_specs': specs})
+        resp, body = self.post('flavors/%s/os-extra_specs' % flavor_id,
+                               post_body, self.headers)
+        body = json.loads(body)
+        return resp, body['extra_specs']
+
+    def get_flavor_extra_spec(self, flavor_id):
+        """Gets extra Specs details of the mentioned flavor."""
+        resp, body = self.get('flavors/%s/os-extra_specs' % flavor_id)
+        body = json.loads(body)
+        return resp, body['extra_specs']
+
+    def unset_flavor_extra_spec(self, flavor_id, key):
+        """Unsets extra Specs from the mentioned flavor."""
+        return self.delete('flavors/%s/os-extra_specs/%s' % (str(flavor_id),
+                           key))
diff --git a/tempest/services/compute/xml/flavors_client.py b/tempest/services/compute/xml/flavors_client.py
index c011fe4..ece362b 100644
--- a/tempest/services/compute/xml/flavors_client.py
+++ b/tempest/services/compute/xml/flavors_client.py
@@ -125,3 +125,25 @@
             if flavor['id'] == id:
                 return False
         return True
+
+    def set_flavor_extra_spec(self, flavor_id, specs):
+        """Sets extra Specs to the mentioned flavor."""
+        extra_specs = Element("extra_specs")
+        for key in specs.keys():
+            extra_specs.add_attr(key, specs[key])
+        resp, body = self.post('flavors/%s/os-extra_specs' % flavor_id,
+                               str(Document(extra_specs)), self.headers)
+        body = xml_to_json(etree.fromstring(body))
+        return resp, body
+
+    def get_flavor_extra_spec(self, flavor_id):
+        """Gets extra Specs of the mentioned flavor."""
+        resp, body = self.get('flavors/%s/os-extra_specs' % flavor_id,
+                              self.headers)
+        body = xml_to_json(etree.fromstring(body))
+        return resp, body
+
+    def unset_flavor_extra_spec(self, flavor_id, key):
+        """Unsets an extra spec based on the mentioned flavor and key."""
+        return self.delete('flavors/%s/os-extra_specs/%s' % (str(flavor_id),
+                           key))
diff --git a/tempest/testboto.py b/tempest/testboto.py
index 09ac950..29ac3ca 100644
--- a/tempest/testboto.py
+++ b/tempest/testboto.py
@@ -26,6 +26,7 @@
 from boto.s3.bucket import Bucket
 from boto.s3.key import Key
 import nose
+import testresources
 import unittest2 as unittest
 
 from tempest.exceptions import TearDownException
@@ -122,8 +123,12 @@
     return string + ")"
 
 
-class BotoTestCase(unittest.TestCase):
+class BotoTestCase(unittest.TestCase,
+                   testresources.ResourcedTestCase):
     """Recommended to use as base class for boto related test."""
+
+    resources = [('boto_init', tempest.tests.boto.generic_setup_package())]
+
     @classmethod
     def setUpClass(cls):
         # The trash contains cleanup functions and paramaters in tuples
diff --git a/tempest/tests/boto/__init__.py b/tempest/tests/boto/__init__.py
index ec51b18..6d5149e 100644
--- a/tempest/tests/boto/__init__.py
+++ b/tempest/tests/boto/__init__.py
@@ -32,7 +32,7 @@
 EC2_CAN_CONNECT_ERROR = "Unknown Error"
 
 
-def setup_package():
+def generic_setup_package():
     global A_I_IMAGES_READY
     global S3_CAN_CONNECT_ERROR
     global EC2_CAN_CONNECT_ERROR
diff --git a/tempest/tests/boto/test_ec2_volumes.py b/tempest/tests/boto/test_ec2_volumes.py
index 7898926..ee7fa3f 100644
--- a/tempest/tests/boto/test_ec2_volumes.py
+++ b/tempest/tests/boto/test_ec2_volumes.py
@@ -62,7 +62,7 @@
         self.cancelResourceCleanUp(cuk)
 
     @attr(type='smoke')
-    def test_create_volme_from_snapshot(self):
+    def test_create_volume_from_snapshot(self):
         # EC2 Create volume from snapshot
         volume = self.client.create_volume(1, self.zone)
         self.addResourceCleanUp(self.client.delete_volume, volume.id)
diff --git a/tempest/tests/compute/__init__.py b/tempest/tests/compute/__init__.py
index 190cb5f..a00ec77 100644
--- a/tempest/tests/compute/__init__.py
+++ b/tempest/tests/compute/__init__.py
@@ -37,7 +37,7 @@
 
 
 # All compute tests -- single setup function
-def setup_package():
+def generic_setup_package():
     LOG.debug("Entering tempest.tests.compute.setup_package")
 
     global MULTI_USER, DISK_CONFIG_ENABLED, FLAVOR_EXTRA_DATA_ENABLED
diff --git a/tempest/tests/compute/admin/test_flavors_extra_specs.py b/tempest/tests/compute/admin/test_flavors_extra_specs.py
new file mode 100644
index 0000000..2645153
--- /dev/null
+++ b/tempest/tests/compute/admin/test_flavors_extra_specs.py
@@ -0,0 +1,158 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+
+# Copyright 2012 OpenStack, LLC
+# 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.
+
+import nose
+from nose.plugins.attrib import attr
+
+from tempest import exceptions
+from tempest.tests import compute
+from tempest.tests.compute import base
+import unittest2 as unittest
+
+
+class FlavorsExtraSpecsTestBase(object):
+
+    """
+    Tests Flavor Extra Spec API extension.
+    SET, UNSET Flavor Extra specs require admin privileges.
+    GET Flavor Extra specs can be performed even by without admin privileges.
+    """
+
+    @classmethod
+    def setUpClass(self, cls):
+        if not compute.FLAVOR_EXTRA_DATA_ENABLED:
+            msg = "FlavorExtraData extension not enabled."
+            raise nose.SkipTest(msg)
+
+        cls.client = cls.os.flavors_client
+        flavor_name = 'test_flavor2'
+        ram = 512
+        vcpus = 1
+        disk = 10
+        ephemeral = 10
+        cls.new_flavor_id = 12345
+        swap = 1024
+        rxtx = 1
+        #Create a flavor so as to set/get/unset extra specs
+        resp, cls.flavor = cls.client.create_flavor(flavor_name,
+                                                    ram, vcpus,
+                                                    disk,
+                                                    cls.new_flavor_id,
+                                                    ephemeral=ephemeral,
+                                                    swap=swap, rxtx=rxtx)
+
+    @classmethod
+    def tearDownClass(self, cls):
+        resp, body = cls.client.delete_flavor(cls.flavor['id'])
+
+    def test_flavor_set_get_unset_keys(self):
+        #Test to SET, GET UNSET flavor extra spec as a user
+        #with admin privileges.
+        #Assigning extra specs values that are to be set
+        specs = {"key1": "value1", "key2": "value2"}
+        #SET extra specs to the flavor created in setUp
+        set_resp, set_body = \
+            self.client.set_flavor_extra_spec(self.flavor['id'], specs)
+        self.assertEqual(set_resp.status, 200)
+        self.assertEqual(set_body, specs)
+        #GET extra specs and verify
+        get_resp, get_body = \
+            self.client.get_flavor_extra_spec(self.flavor['id'])
+        self.assertEqual(get_resp.status, 200)
+        self.assertEqual(get_body, specs)
+        #UNSET extra specs that were set in this test
+        unset_resp, _ = \
+            self.client.unset_flavor_extra_spec(self.flavor['id'], "key1")
+        self.assertEqual(unset_resp.status, 200)
+
+    @unittest.skip('Until bug 1094142 is resolved.')
+    def test_flavor_non_admin_set_get_unset_keys(self):
+        #Test to SET, GET UNSET flavor extra spec as a user
+        #with out admin privileges.
+        self.nonadmin_client = self.flavors_client
+        #Assigning extra specs values that are to be set
+        specs = {"key1": "value1", "key2": "value2"}
+        msg = None
+
+        #Verify if able to SET flavor extraspec with non-admin user
+        try:
+            set_resp, set_body = \
+                self.nonadmin_client.set_flavor_extra_spec(
+                    self.flavor['id'], specs)
+        except exceptions.Unauthorized:
+            pass
+        else:
+            msg = "Flavor extra specs is being SET"
+            msg += " by unauthorized non-admin user.\n"
+        #SET flavor extra specs with admin user
+        #so as to check GET/UNSET flavor extra specs with non-admin
+        set_resp, set_body =\
+            self.client.set_flavor_extra_spec(self.flavor['id'], specs)
+        #Verify if able to GET flavor extraspec with non-admin user
+        try:
+            get_resp, get_body = \
+                self.nonadmin_client.get_flavor_extra_spec('')
+            self.assertEqual(get_resp.status, 200)
+        except Exception as e:
+            msg += "Got an exception when GET Flavor extra specs"
+            msg += " by non-admin user. Exception is: %s\n" % e
+        #Verify if able to UNSET flavor extraspec with non-admin user
+        try:
+            unset_resp, _ = \
+                self.nonadmin_client.unset_flavor_extra_spec(self.flavor['id'],
+                                                             "key1")
+        except exceptions.Unauthorized:
+            pass
+        else:
+            msg += "Flavor extra specs is being UNSET"
+            msg += " by unauthorized non-admin user.\n"
+        #Verification to check if actions failed.
+        #msg variable  would contain the message according to the failures.
+        if msg is not None:
+            self.fail(msg)
+
+
+class FlavorsExtraSpecsTestXML(base.BaseComputeAdminTestXML,
+                               base.BaseComputeTestXML,
+                               FlavorsExtraSpecsTestBase):
+
+    @classmethod
+    def setUpClass(cls):
+        super(FlavorsExtraSpecsTestXML, cls).setUpClass()
+        base.BaseComputeTestXML.setUpClass()
+        FlavorsExtraSpecsTestBase.setUpClass(cls)
+
+    @classmethod
+    def tearDownClass(cls):
+        FlavorsExtraSpecsTestBase.tearDownClass(cls)
+        super(FlavorsExtraSpecsTestXML, cls).tearDownClass()
+
+
+class FlavorsExtraSpecsTestJSON(base.BaseComputeAdminTestJSON,
+                                base.BaseComputeTestJSON,
+                                FlavorsExtraSpecsTestBase):
+
+    @classmethod
+    def setUpClass(cls):
+        super(FlavorsExtraSpecsTestJSON, cls).setUpClass()
+        base.BaseComputeTestJSON.setUpClass()
+        FlavorsExtraSpecsTestBase.setUpClass(cls)
+
+    @classmethod
+    def tearDownClass(cls):
+        FlavorsExtraSpecsTestBase.tearDownClass(cls)
+        super(FlavorsExtraSpecsTestJSON, cls).tearDownClass()
diff --git a/tempest/tests/compute/base.py b/tempest/tests/compute/base.py
index ae7c5ab..3f3b3e8 100644
--- a/tempest/tests/compute/base.py
+++ b/tempest/tests/compute/base.py
@@ -19,12 +19,14 @@
 import time
 
 import nose
+import testresources
 import unittest2 as unittest
 
 from tempest import clients
 from tempest.common.utils.data_utils import rand_name
 from tempest import config
 from tempest import exceptions
+from tempest.tests import compute
 
 __all__ = ['BaseComputeTest', 'BaseComputeTestJSON', 'BaseComputeTestXML',
            'BaseComputeAdminTestJSON', 'BaseComputeAdminTestXML']
@@ -32,10 +34,13 @@
 LOG = logging.getLogger(__name__)
 
 
-class BaseCompTest(unittest.TestCase):
+class BaseCompTest(unittest.TestCase,
+                   testresources.ResourcedTestCase):
 
     """Base test case class for all Compute API tests."""
 
+    resources = [('compute_init', compute.generic_setup_package())]
+
     @classmethod
     def setUpClass(cls):
         cls.config = config.TempestConfig()
diff --git a/tempest/tests/compute/flavors/test_flavors.py b/tempest/tests/compute/flavors/test_flavors.py
index 53cad65..298984f 100644
--- a/tempest/tests/compute/flavors/test_flavors.py
+++ b/tempest/tests/compute/flavors/test_flavors.py
@@ -104,7 +104,7 @@
         flavors = sorted(flavors, key=lambda k: k['ram'])
         flavor_id = flavors[0]['id']
 
-        params = {'minRam': flavors[1]['ram']}
+        params = {'minRam': flavors[0]['ram'] + 1}
         resp, flavors = self.client.list_flavors_with_detail(params)
         self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
 
@@ -126,7 +126,7 @@
         flavors = sorted(flavors, key=lambda k: k['ram'])
         flavor_id = flavors[0]['id']
 
-        params = {'minRam': flavors[1]['ram']}
+        params = {'minRam': flavors[0]['ram'] + 1}
         resp, flavors = self.client.list_flavors(params)
         self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
 
diff --git a/tempest/tests/network/test_network_basic_ops.py b/tempest/tests/network/test_network_basic_ops.py
index 1d88759..3c99f77 100644
--- a/tempest/tests/network/test_network_basic_ops.py
+++ b/tempest/tests/network/test_network_basic_ops.py
@@ -195,6 +195,8 @@
         cls.keypairs = {}
         cls.security_groups = {}
         cls.networks = []
+        cls.subnets = []
+        cls.routers = []
         cls.servers = []
         cls.floating_ips = {}
 
@@ -301,6 +303,18 @@
         self.set_resource(name, network)
         return network
 
+    def _list_networks(self):
+        nets = self.network_client.list_networks()
+        return nets['networks']
+
+    def _list_subnets(self):
+        subnets = self.network_client.list_subnets()
+        return subnets['subnets']
+
+    def _list_routers(self):
+        routers = self.network_client.list_routers()
+        return routers['routers']
+
     def _create_subnet(self, network):
         """
         Create a subnet for the given network within the cidr block
@@ -406,8 +420,43 @@
         subnet = self._create_subnet(network)
         subnet.add_to_router(router.id)
         self.networks.append(network)
+        self.subnets.append(subnet)
+        self.routers.append(router)
 
-    def test_004_create_servers(self):
+    def test_004_check_networks(self):
+        #Checks that we see the newly created network/subnet/router via
+        #checking the result of list_[networks,routers,subnets]
+        seen_nets = self._list_networks()
+        seen_names = [n['name'] for n in seen_nets]
+        seen_ids = [n['id'] for n in seen_nets]
+        for mynet in self.networks:
+            assert mynet.name in seen_names, \
+            "Did not see expected network with name %s" % mynet.name
+            assert mynet.id in seen_ids, \
+            "Did not see expected network with id %s" % mynet.id
+        seen_subnets = self._list_subnets()
+        seen_net_ids = [n['network_id'] for n in seen_subnets]
+        seen_subnet_ids = [n['id'] for n in seen_subnets]
+        for mynet in self.networks:
+            assert mynet.id in seen_net_ids, \
+            "Did not see subnet belonging to network %s/%s" % \
+            (mynet.name, mynet.id)
+        for mysubnet in self.subnets:
+            assert mysubnet.id in seen_subnet_ids, \
+            "Did not see expected subnet with id %s" % \
+            mysubnet.id
+        seen_routers = self._list_routers()
+        seen_router_ids = [n['id'] for n in seen_routers]
+        seen_router_names = [n['name'] for n in seen_routers]
+        for myrouter in self.routers:
+            assert myrouter.name in seen_router_names, \
+            "Did not see expected router with name %s" % \
+            myrouter.name
+            assert myrouter.id in seen_router_ids, \
+            "Did not see expected router with id %s" % \
+            myrouter.id
+
+    def test_005_create_servers(self):
         if not (self.keypairs or self.security_groups or self.networks):
             raise nose.SkipTest('Necessary resources have not been defined')
         for i, network in enumerate(self.networks):
@@ -419,7 +468,7 @@
                                          name, keypair_name, security_groups)
             self.servers.append(server)
 
-    def test_005_check_tenant_network_connectivity(self):
+    def test_006_check_tenant_network_connectivity(self):
         if not self.config.network.tenant_networks_reachable:
             msg = 'Tenant networks not configured to be reachable.'
             raise nose.SkipTest(msg)
@@ -432,7 +481,7 @@
                                     "Timed out waiting for %s's ip to become "
                                     "reachable" % server.name)
 
-    def test_006_assign_floating_ips(self):
+    def test_007_assign_floating_ips(self):
         public_network_id = self.config.network.public_network_id
         if not public_network_id:
             raise nose.SkipTest('Public network not configured')
@@ -443,7 +492,7 @@
             self.floating_ips.setdefault(server, [])
             self.floating_ips[server].append(floating_ip)
 
-    def test_007_check_public_network_connectivity(self):
+    def test_008_check_public_network_connectivity(self):
         if not self.floating_ips:
             raise nose.SkipTest('No floating ips have been allocated.')
         for server, floating_ips in self.floating_ips.iteritems():
diff --git a/tempest/tests/object_storage/test_object_services.py b/tempest/tests/object_storage/test_object_services.py
index 2733c38..a65401c 100644
--- a/tempest/tests/object_storage/test_object_services.py
+++ b/tempest/tests/object_storage/test_object_services.py
@@ -38,22 +38,20 @@
         # Randomly creating user
         cls.data.setup_test_user()
 
-        resp, body = \
-            cls.token_client.auth(cls.data.test_user,
-                                  cls.data.test_password,
-                                  cls.data.test_tenant)
-        cls.new_token = \
-            cls.token_client.get_token(cls.data.test_user,
-                                       cls.data.test_password,
-                                       cls.data.test_tenant)
+        resp, body = cls.token_client.auth(cls.data.test_user,
+                                           cls.data.test_password,
+                                           cls.data.test_tenant)
+        cls.new_token = cls.token_client.get_token(cls.data.test_user,
+                                                   cls.data.test_password,
+                                                   cls.data.test_tenant)
 
         cls.custom_headers = {'X-Auth-Token': cls.new_token}
 
     @classmethod
     def tearDownClass(cls):
         #Get list of all object in the container
-        objlist = \
-            cls.container_client.list_all_container_objects(cls.container_name)
+        objlist = cls.container_client.list_all_container_objects(
+            cls.container_name)
 
         #Attempt to delete every object in the container
         for obj in objlist:
@@ -112,16 +110,15 @@
         meta_value = rand_name(name='MetaValue-')
         orig_metadata = {meta_key: meta_value}
 
-        resp, _ = \
-            self.object_client.update_object_metadata(self.container_name,
-                                                      object_name,
-                                                      orig_metadata)
+        resp, _ = self.object_client.update_object_metadata(
+            self.container_name, object_name,
+            orig_metadata)
         self.assertEqual(resp['status'], '202')
 
         #Get Object Metadata
-        resp, resp_metadata = \
-            self.object_client.list_object_metadata(self.container_name,
-                                                    object_name)
+        resp, resp_metadata = self.object_client.list_object_metadata(
+            self.container_name, object_name)
+
         self.assertEqual(resp['status'], '200')
         actual_meta_key = 'x-object-meta-' + meta_key
         self.assertTrue(actual_meta_key in resp)
@@ -248,10 +245,9 @@
         meta_value = rand_name(name='MetaValue-')
         orig_metadata = {meta_key: meta_value}
 
-        resp, _ = \
-            self.object_client.update_object_metadata(src_container_name,
-                                                      object_name,
-                                                      orig_metadata)
+        resp, _ = self.object_client.update_object_metadata(src_container_name,
+                                                            object_name,
+                                                            orig_metadata)
         self.assertEqual(resp['status'], '202')
 
         try:
@@ -293,10 +289,9 @@
             resp_meta = None
             # Update Container Metadata to make public readable
             cont_headers = {'X-Container-Read': '.r:*,.rlistings'}
-            resp_meta, body = \
-                self.container_client.update_container_metadata(
-                    self.container_name, metadata=cont_headers,
-                    metadata_prefix='')
+            resp_meta, body = self.container_client.update_container_metadata(
+                self.container_name, metadata=cont_headers,
+                metadata_prefix='')
             self.assertEqual(resp_meta['status'], '204')
 
             # Create Object
@@ -308,29 +303,26 @@
             self.assertEqual(resp['status'], '201')
 
             # List container metadata
-            resp_meta, _ = \
-                self.container_client.list_container_metadata(
-                    self.container_name)
+            resp_meta, _ = self.container_client.list_container_metadata(
+                self.container_name)
             self.assertEqual(resp_meta['status'], '204')
             self.assertIn('x-container-read', resp_meta)
             self.assertEqual(resp_meta['x-container-read'], '.r:*,.rlistings')
 
             # Trying to Get Object with empty Headers as it is public readable
-            resp, body = \
-                self.custom_object_client.get_object(self.container_name,
-                                                     object_name, metadata={})
+            resp, body = self.custom_object_client.get_object(
+                self.container_name, object_name,
+                metadata={})
             self.assertEqual(body, data)
         finally:
             if resp_meta['status'] == '204':
                 # Delete updated container metadata, to revert back.
-                resp, body = \
-                    self.container_client.delete_container_metadata(
-                        self.container_name, metadata=cont_headers,
-                        metadata_prefix='')
+                resp, body = self.container_client.delete_container_metadata(
+                    self.container_name, metadata=cont_headers,
+                    metadata_prefix='')
 
-                resp, _ = \
-                    self.container_client.list_container_metadata(
-                        self.container_name)
+                resp, _ = self.container_client.list_container_metadata(
+                    self.container_name)
                 self.assertEqual(resp['status'], '204')
                 self.assertIn('x-container-read', resp)
                 self.assertEqual(resp['x-container-read'], 'x')
@@ -344,10 +336,9 @@
         try:
             resp_meta = None
             cont_headers = {'X-Container-Read': '.r:*,.rlistings'}
-            resp_meta, body = \
-                self.container_client.update_container_metadata(
-                    self.container_name, metadata=cont_headers,
-                    metadata_prefix='')
+            resp_meta, body = self.container_client.update_container_metadata(
+                self.container_name, metadata=cont_headers,
+                metadata_prefix='')
             self.assertEqual(resp_meta['status'], '204')
             # Create Object
             object_name = rand_name(name='Object')
@@ -358,9 +349,8 @@
             self.assertEqual(resp['status'], '201')
 
             # List container metadata
-            resp, _ = \
-                self.container_client.list_container_metadata(
-                    self.container_name)
+            resp, _ = self.container_client.list_container_metadata(
+                self.container_name)
             self.assertEqual(resp['status'], '204')
             self.assertIn('x-container-read', resp)
             self.assertEqual(resp['x-container-read'], '.r:*,.rlistings')
@@ -370,9 +360,9 @@
             headers = {'X-Auth-Token': token}
 
             # Trying to create object with Alternate user creds
-            resp, body = \
-                self.custom_object_client.get_object(
-                    self.container_name, object_name, metadata=headers)
+            resp, body = self.custom_object_client.get_object(
+                self.container_name, object_name,
+                metadata=headers)
             self.assertEqual(body, data)
 
         except Exception as e:
@@ -382,14 +372,12 @@
         finally:
             if resp_meta['status'] == '204':
                 # Delete updated container metadata, to revert back.
-                resp, body = \
-                    self.container_client.delete_container_metadata(
-                        self.container_name, metadata=cont_headers,
-                        metadata_prefix='')
+                resp, body = self.container_client.delete_container_metadata(
+                    self.container_name, metadata=cont_headers,
+                    metadata_prefix='')
 
-                resp, _ = \
-                    self.container_client.list_container_metadata(
-                        self.container_name)
+                resp, _ = self.container_client.list_container_metadata(
+                    self.container_name)
                 self.assertEqual(resp['status'], '204')
                 self.assertIn('x-container-read', resp)
                 self.assertEqual(resp['x-container-read'], 'x')
@@ -403,15 +391,13 @@
             resp_meta = None
             # Update Container Metadata to make public readable
             cont_headers = {'X-Container-Write': '-*'}
-            resp_meta, body = \
-                self.container_client.update_container_metadata(
-                    self.container_name, metadata=cont_headers,
-                    metadata_prefix='')
+            resp_meta, body = self.container_client.update_container_metadata(
+                self.container_name, metadata=cont_headers,
+                metadata_prefix='')
             self.assertEqual(resp_meta['status'], '204')
             # List container metadata
-            resp, _ = \
-                self.container_client.list_container_metadata(
-                    self.container_name)
+            resp, _ = self.container_client.list_container_metadata(
+                self.container_name)
 
             self.assertEqual(resp['status'], '204')
             self.assertIn('x-container-write', resp)
@@ -425,10 +411,9 @@
                        'Accept': 'application/json'}
 
             #Trying to Create object without using creds
-            resp, body = \
-                self.custom_object_client.create_object(self.container_name,
-                                                        object_name, data,
-                                                        metadata=headers)
+            resp, body = self.custom_object_client.create_object(
+                self.container_name, object_name,
+                data, metadata=headers)
             self.assertEqual(resp['status'], '201')
 
         except Exception as e:
@@ -438,14 +423,12 @@
         finally:
             if resp_meta['status'] == '204':
                 # Delete updated container metadata, to revert back.
-                resp, body = \
-                    self.container_client.delete_container_metadata(
-                        self.container_name, metadata=cont_headers,
-                        metadata_prefix='')
+                resp, body = self.container_client.delete_container_metadata(
+                    self.container_name, metadata=cont_headers,
+                    metadata_prefix='')
 
-                resp, _ = \
-                    self.container_client.list_container_metadata(
-                        self.container_name)
+                resp, _ = self.container_client.list_container_metadata(
+                    self.container_name)
                 self.assertEqual(resp['status'], '204')
                 self.assertIn('x-container-write', resp)
                 self.assertEqual(resp['x-container-write'], 'x')
@@ -460,15 +443,13 @@
             resp_meta = None
             # Update Container Metadata to make public readable
             cont_headers = {'X-Container-Write': '-*'}
-            resp_meta, body = \
-                self.container_client.update_container_metadata(
-                    self.container_name, metadata=cont_headers,
-                    metadata_prefix='')
+            resp_meta, body = self.container_client.update_container_metadata(
+                self.container_name, metadata=cont_headers,
+                metadata_prefix='')
             self.assertEqual(resp_meta['status'], '204')
             # List container metadata
-            resp, _ = \
-                self.container_client.list_container_metadata(
-                    self.container_name)
+            resp, _ = self.container_client.list_container_metadata(
+                self.container_name)
 
             self.assertEqual(resp['status'], '204')
             self.assertIn('x-container-write', resp)
@@ -485,9 +466,9 @@
             object_name = rand_name(name='Object')
             data = arbitrary_string(size=len(object_name),
                                     base_text=object_name)
-            resp, body = \
-                self.custom_object_client.create_object(
-                    self.container_name, object_name, data, metadata=headers)
+            resp, body = self.custom_object_client.create_object(
+                self.container_name, object_name,
+                data, metadata=headers)
             self.assertEqual(resp['status'], '201')
 
         except Exception as e:
@@ -497,14 +478,12 @@
         finally:
             if resp_meta['status'] == '204':
                 # Delete updated container metadata, to revert back.
-                resp, body = \
-                    self.container_client.delete_container_metadata(
-                        self.container_name, metadata=cont_headers,
-                        metadata_prefix='')
+                resp, body = self.container_client.delete_container_metadata(
+                    self.container_name, metadata=cont_headers,
+                    metadata_prefix='')
 
-                resp, _ = \
-                    self.container_client.list_container_metadata(
-                        self.container_name)
+                resp, _ = self.container_client.list_container_metadata(
+                    self.container_name)
                 self.assertEqual(resp['status'], '204')
                 self.assertIn('x-container-write', resp)
                 self.assertEqual(resp['x-container-write'], 'x')
@@ -583,9 +562,9 @@
         data = arbitrary_string(size=len(object_name) * 5,
                                 base_text=object_name)
 
-        resp, body = \
-            self.object_client.create_object(self.container_name,
-                                             object_name, data)
+        resp, body = self.object_client.create_object(
+            self.container_name, object_name,
+            data)
         self.assertEqual(resp['status'], '201')
 
         # Trying to Get Object with non authorized user token
@@ -602,9 +581,9 @@
         data = arbitrary_string(size=len(object_name) * 5,
                                 base_text=object_name)
 
-        resp, body = \
-            self.object_client.create_object(self.container_name,
-                                             object_name, data)
+        resp, body = self.object_client.create_object(
+            self.container_name, object_name,
+            data)
         self.assertEqual(resp['status'], '201')
 
         # Trying to Delete Object with non authorized user token
@@ -624,8 +603,8 @@
             flag = False
             key = 'Meta'
             metadata = {'Temp-URL-Key': key}
-            resp, _ = \
-                self.account_client.create_account_metadata(metadata=metadata)
+            resp, _ = self.account_client.create_account_metadata(
+                metadata=metadata)
             self.assertEqual(resp['status'], '204')
             flag = True
 
@@ -643,17 +622,16 @@
             expires = int(time() + 10)
 
             #Trying to GET object using temp URL with in expiry time
-            _, body = \
-                self.object_client.get_object_using_temp_url(
-                    self.container_name, object_name, expires, key)
+            _, body = self.object_client.get_object_using_temp_url(
+                self.container_name, object_name,
+                expires, key)
 
             self.assertEqual(body, data)
 
         finally:
             if flag:
-                resp, _ = \
-                    self.account_client.delete_account_metadata(
-                        metadata=metadata)
+                resp, _ = self.account_client.delete_account_metadata(
+                    metadata=metadata)
                 resp, _ = self.account_client.list_account_metadata()
                 self.assertNotIn('x-account-meta-temp-url-key', resp)
 
@@ -670,26 +648,24 @@
                                          object_name, data)
         #Uploading 10 segments
         for i in range(segments):
-            resp, _ = \
-                self.object_client.create_object_segments(self.container_name,
-                                                          object_name, i, data)
+            resp, _ = self.object_client.create_object_segments(
+                self.container_name, object_name,
+                i, data)
         # Creating a Manifest File (Metadata Update)
 
         metadata = {'X-Object-Manifest': '%s/%s/'
                     % (self.container_name, object_name)}
-        resp, _ = \
-            self.object_client.update_object_metadata(self.container_name,
-                                                      object_name, metadata,
-                                                      metadata_prefix='')
-        resp, _ = \
-            self.object_client.list_object_metadata(self.container_name,
-                                                    object_name)
+        resp, _ = self.object_client.update_object_metadata(
+            self.container_name, object_name,
+            metadata, metadata_prefix='')
+        resp, _ = self.object_client.list_object_metadata(
+            self.container_name, object_name)
         self.assertIn('x-object-manifest', resp)
         self.assertEqual(resp['x-object-manifest'],
                          '%s/%s/' % (self.container_name, object_name))
 
         #Downloading the object
-        resp, body = \
-            self.object_client.get_object(self.container_name, object_name)
+        resp, body = self.object_client.get_object(
+            self.container_name, object_name)
 
         self.assertEqual(data * segments, body)
diff --git a/tools/pip-requires b/tools/pip-requires
index 061eff6..fcf1690 100644
--- a/tools/pip-requires
+++ b/tools/pip-requires
@@ -10,3 +10,4 @@
 python-keystoneclient>=0.2.0
 python-novaclient>=2.10.0
 python-quantumclient>=2.1
+testresources