Merge "Remove smoke.py and clean up base test classes"
diff --git a/tempest/common/rest_client.py b/tempest/common/rest_client.py
index 02b5c9b..366e467 100644
--- a/tempest/common/rest_client.py
+++ b/tempest/common/rest_client.py
@@ -135,12 +135,14 @@
 
         headers = {'Content-Type': 'application/json'}
         body = json.dumps(creds)
-        resp, body = self.http_obj.request(auth_url, 'POST',
-                                           headers=headers, body=body)
+        self._log_request('POST', auth_url, headers, body)
+        resp, resp_body = self.http_obj.request(auth_url, 'POST',
+                                                headers=headers, body=body)
+        self._log_response(resp, resp_body)
 
         if resp.status == 200:
             try:
-                auth_data = json.loads(body)['access']
+                auth_data = json.loads(resp_body)['access']
                 token = auth_data['token']['id']
             except Exception, e:
                 print "Failed to obtain token for user: %s" % e
@@ -155,7 +157,6 @@
                             mgmt_url = _ep[self.endpoint_url]
                     if not mgmt_url:
                         mgmt_url = ep['endpoints'][0][self.endpoint_url]
-                    tenant_id = auth_data['token']['tenant']['id']
                     break
 
             if mgmt_url is None:
@@ -166,6 +167,8 @@
         elif resp.status == 401:
             raise exceptions.AuthenticationFailure(user=user,
                                                    password=password)
+        raise exceptions.IdentityError('Unexpected status code {0}'.format(
+            resp.status))
 
     def post(self, url, body, headers):
         return self.request('POST', url, headers, body)
@@ -230,7 +233,7 @@
 
     def response_checker(self, method, url, headers, body, resp, resp_body):
         if (resp.status in set((204, 205, 304)) or resp.status < 200 or
-            method.upper() == 'HEAD') and resp_body:
+                method.upper() == 'HEAD') and resp_body:
             raise exceptions.ResponseWithNonEmptyBody(status=resp.status)
         #NOTE(afazekas):
         # If the HTTP Status Code is 205
@@ -388,7 +391,7 @@
 
     def is_absolute_limit(self, resp, resp_body):
         if (not isinstance(resp_body, collections.Mapping) or
-            'retry-after' not in resp):
+                'retry-after' not in resp):
             return True
         over_limit = resp_body.get('overLimit', None)
         if not over_limit:
@@ -422,6 +425,6 @@
 
     def is_absolute_limit(self, resp, resp_body):
         if (not isinstance(resp_body, collections.Mapping) or
-            'retry-after' not in resp):
+                'retry-after' not in resp):
             return True
         return 'exceed' in resp_body.get('message', 'blabla')
diff --git a/tempest/tests/compute/test_live_block_migration.py b/tempest/tests/compute/test_live_block_migration.py
index e5a7d5b..e438098 100644
--- a/tempest/tests/compute/test_live_block_migration.py
+++ b/tempest/tests/compute/test_live_block_migration.py
@@ -28,6 +28,7 @@
 
 @attr(category='live-migration')
 class LiveBlockMigrationTestJSON(base.BaseComputeAdminTest):
+    _host_key = 'OS-EXT-SRV-ATTR:host'
     _interface = 'json'
 
     live_migration_available = (
@@ -58,7 +59,7 @@
         return body
 
     def _get_host_for_server(self, server_id):
-        return self._get_server_details(server_id)['OS-EXT-SRV-ATTR:host']
+        return self._get_server_details(server_id)[self._host_key]
 
     def _migrate_server_to(self, server_id, dest_host):
         _resp, body = self.admin_servers_client.live_migrate_server(
@@ -129,4 +130,6 @@
 
 
 class LiveBlockMigrationTestXML(LiveBlockMigrationTestJSON):
+    _host_key = (
+        '{http://docs.openstack.org/compute/ext/extended_status/api/v1.1}host')
     _interface = 'xml'
diff --git a/tempest/tests/network/test_network_basic_ops.py b/tempest/tests/network/test_network_basic_ops.py
index a38a5c0..3afe8e3 100644
--- a/tempest/tests/network/test_network_basic_ops.py
+++ b/tempest/tests/network/test_network_basic_ops.py
@@ -17,11 +17,10 @@
 #    under the License.
 
 from tempest.common.utils.data_utils import rand_name
-from tempest.tests.network.common import DeletableRouter
-from tempest.tests.network.common import TestNetworkSmokeCommon
+import tempest.tests.network.common as net_common
 
 
-class TestNetworkBasicOps(TestNetworkSmokeCommon):
+class TestNetworkBasicOps(net_common.TestNetworkSmokeCommon):
 
     """
     This smoke test suite assumes that Nova has been configured to
@@ -124,7 +123,7 @@
         network_id = self.config.network.public_network_id
         if router_id:
             result = self.network_client.show_router(router_id)
-            return AttributeDict(**result['router'])
+            return net_common.AttributeDict(**result['router'])
         elif network_id:
             router = self._create_router(tenant_id)
             router.add_gateway(network_id)
@@ -143,8 +142,8 @@
             ),
         )
         result = self.network_client.create_router(body=body)
-        router = DeletableRouter(client=self.network_client,
-                                 **result['router'])
+        router = net_common.DeletableRouter(client=self.network_client,
+                                            **result['router'])
         self.assertEqual(router.name, name)
         self.set_resource(name, router)
         return router