Merge ""is_resource_deleted" fails to verify delete"
diff --git a/doc/source/microversion_testing.rst b/doc/source/microversion_testing.rst
index 63ec04b..fc05b12 100644
--- a/doc/source/microversion_testing.rst
+++ b/doc/source/microversion_testing.rst
@@ -205,3 +205,7 @@
  * `2.2`_
 
  .. _2.2: http://docs.openstack.org/developer/nova/api_microversion_history.html#id2
+
+ * `2.10`_
+
+ .. _2.10: http://docs.openstack.org/developer/nova/api_microversion_history.html#id9
diff --git a/openstack-common.conf b/openstack-common.conf
deleted file mode 100644
index acb1437..0000000
--- a/openstack-common.conf
+++ /dev/null
@@ -1,9 +0,0 @@
-[DEFAULT]
-
-# The list of modules to copy from openstack-common
-module=install_venv_common
-module=with_venv
-module=install_venv
-
-# The base module to hold the copy of openstack.common
-base=tempest
diff --git a/requirements.txt b/requirements.txt
index 7c426e6..3913f8f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,7 +4,6 @@
 pbr>=1.6 # Apache-2.0
 cliff!=1.16.0,!=1.17.0,>=1.15.0 # Apache-2.0
 anyjson>=0.3.3 # BSD
-httplib2>=0.7.5 # MIT
 jsonschema!=2.5.0,<3.0.0,>=2.0.0 # MIT
 testtools>=1.4.0 # MIT
 paramiko>=1.16.0 # LGPL
@@ -25,3 +24,4 @@
 stevedore>=1.5.0 # Apache-2.0
 PrettyTable<0.8,>=0.7 # BSD
 os-testr>=0.4.1 # Apache-2.0
+urllib3>=1.8.3 # MIT
diff --git a/run_tempest.sh b/run_tempest.sh
index 8c8f25f..af01734 100755
--- a/run_tempest.sh
+++ b/run_tempest.sh
@@ -103,22 +103,25 @@
   fi
   if [ $update -eq 1 ]; then
       echo "Updating virtualenv..."
-      python tools/install_venv.py $installvenvopts
+      virtualenv $installvenvopts $venv
+      $venv/bin/pip install -U -r requirements.txt
   fi
   if [ -e ${venv} ]; then
     wrapper="${with_venv}"
   else
     if [ $always_venv -eq 1 ]; then
       # Automatically install the virtualenv
-      python tools/install_venv.py $installvenvopts
+      virtualenv $installvenvopts $venv
       wrapper="${with_venv}"
+      ${wrapper} pip install -U -r requirements.txt
     else
       echo -e "No virtual environment found...create one? (Y/n) \c"
       read use_ve
       if [ "x$use_ve" = "xY" -o "x$use_ve" = "x" -o "x$use_ve" = "xy" ]; then
         # Install the virtualenv and run the test suite in it
-        python tools/install_venv.py $installvenvopts
+        virtualenv $installvenvopts $venv
         wrapper=${with_venv}
+        ${wrapper} pip install -U -r requirements.txt
       fi
     fi
   fi
diff --git a/run_tests.sh b/run_tests.sh
index 908056f..22314b6 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -114,22 +114,25 @@
   fi
   if [ $update -eq 1 ]; then
       echo "Updating virtualenv..."
-      python tools/install_venv.py $installvenvopts
+      virtualenv $installvenvopts $venv
+      $venv/bin/pip install -U -r requirements.txt -r test-requirements.txt
   fi
   if [ -e ${venv} ]; then
     wrapper="${with_venv}"
   else
     if [ $always_venv -eq 1 ]; then
       # Automatically install the virtualenv
-      python tools/install_venv.py $installvenvopts
+      virtualenv $installvenvopts $venv
       wrapper="${with_venv}"
+      ${wrapper} pip install -U -r requirements.txt -r test-requirements.txt
     else
       echo -e "No virtual environment found...create one? (Y/n) \c"
       read use_ve
       if [ "x$use_ve" = "xY" -o "x$use_ve" = "x" -o "x$use_ve" = "xy" ]; then
         # Install the virtualenv and run the test suite in it
-        python tools/install_venv.py $installvenvopts
+        virtualenv $installvenvopts $venv
         wrapper=${with_venv}
+        ${wrapper} pip install -U -r requirements.txt -r test-requirements.txt
       fi
     fi
   fi
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index b6f9da7..a5fb25c 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -397,7 +397,7 @@
         self.assertEmpty(body['subnets'], "Public subnets visible")
 
 
-class BulkNetworkOpsTestJSON(base.BaseNetworkTest):
+class BulkNetworkOpsTest(base.BaseNetworkTest):
     """Tests the following operations in the Neutron API:
 
         bulk network creation
@@ -520,11 +520,11 @@
             self.assertIn(n['id'], ports_list)
 
 
-class BulkNetworkOpsIpV6TestJSON(BulkNetworkOpsTestJSON):
+class BulkNetworkOpsIpV6Test(BulkNetworkOpsTest):
     _ip_version = 6
 
 
-class NetworksIpV6TestJSON(NetworksTest):
+class NetworksIpV6Test(NetworksTest):
     _ip_version = 6
 
     @test.idempotent_id('e41a4888-65a6-418c-a095-f7c2ef4ad59a')
@@ -576,7 +576,7 @@
                               'Subnet are not in the same network')
 
 
-class NetworksIpV6TestAttrs(NetworksIpV6TestJSON):
+class NetworksIpV6TestAttrs(NetworksIpV6Test):
 
     @classmethod
     def skip_checks(cls):
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 9c67579..e52216f 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -17,6 +17,7 @@
 from tempest.common.utils import data_utils
 from tempest.common import waiters
 from tempest import config
+from tempest.lib import exceptions
 from tempest import test
 import testtools
 
@@ -34,7 +35,6 @@
     @classmethod
     def resource_setup(cls):
         super(VolumesV2ActionsTest, cls).resource_setup()
-
         # Create a test shared instance
         srv_name = data_utils.rand_name(cls.__name__ + '-Instance')
         cls.server = cls.create_server(
@@ -61,10 +61,10 @@
     @test.services('compute')
     def test_attach_detach_volume_to_instance(self):
         # Volume is attached and detached successfully from an instance
-        mountpoint = '/dev/vdc'
         self.client.attach_volume(self.volume['id'],
                                   instance_uuid=self.server['id'],
-                                  mountpoint=mountpoint)
+                                  mountpoint='/dev/%s' %
+                                             CONF.compute.volume_device_name)
         waiters.wait_for_volume_status(self.client,
                                        self.volume['id'], 'in-use')
         self.client.detach_volume(self.volume['id'])
@@ -90,10 +90,10 @@
     @test.services('compute')
     def test_get_volume_attachment(self):
         # Verify that a volume's attachment information is retrieved
-        mountpoint = '/dev/vdc'
         self.client.attach_volume(self.volume['id'],
                                   instance_uuid=self.server['id'],
-                                  mountpoint=mountpoint)
+                                  mountpoint='/dev/%s' %
+                                             CONF.compute.volume_device_name)
         waiters.wait_for_volume_status(self.client,
                                        self.volume['id'], 'in-use')
         # NOTE(gfidente): added in reverse order because functions will be
@@ -105,7 +105,9 @@
         volume = self.client.show_volume(self.volume['id'])['volume']
         self.assertIn('attachments', volume)
         attachment = self.client.get_attachment_from_volume(volume)
-        self.assertEqual(mountpoint, attachment['device'])
+        self.assertEqual('/dev/%s' %
+                         CONF.compute.volume_device_name,
+                         attachment['device'])
         self.assertEqual(self.server['id'], attachment['server_id'])
         self.assertEqual(self.volume['id'], attachment['id'])
         self.assertEqual(self.volume['id'], attachment['volume_id'])
@@ -122,11 +124,19 @@
             self.volume['id'], image_name=image_name,
             disk_format=CONF.volume.disk_format)['os-volume_upload_image']
         image_id = body["image_id"]
-        self.addCleanup(self.image_client.delete_image, image_id)
+        self.addCleanup(self._cleanup_image, image_id)
         self.image_client.wait_for_image_status(image_id, 'active')
         waiters.wait_for_volume_status(self.client,
                                        self.volume['id'], 'available')
 
+    def _cleanup_image(self, image_id):
+        # Ignores the image deletion
+        # in the case that image wasn't created in the first place
+        try:
+            self.image_client.delete_image(image_id)
+        except exceptions.NotFound:
+            pass
+
     @test.idempotent_id('92c4ef64-51b2-40c0-9f7e-4749fbaaba33')
     def test_reserve_unreserve_volume(self):
         # Mark volume as reserved.
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 347877c..866e676 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -68,10 +68,9 @@
             name=server_name,
             wait_until='ACTIVE')
         self.addCleanup(self.servers_client.delete_server, server['id'])
-        mountpoint = '/dev/%s' % CONF.compute.volume_device_name
         self.servers_client.attach_volume(
             server['id'], volumeId=self.volume_origin['id'],
-            device=mountpoint)
+            device='/dev/%s' % CONF.compute.volume_device_name)
         waiters.wait_for_volume_status(self.volumes_client,
                                        self.volume_origin['id'], 'in-use')
         self.addCleanup(waiters.wait_for_volume_status, self.volumes_client,
diff --git a/tempest/api/volume/v2/test_volumes_list.py b/tempest/api/volume/v2/test_volumes_list.py
index 6568627..bedbad4 100644
--- a/tempest/api/volume/v2/test_volumes_list.py
+++ b/tempest/api/volume/v2/test_volumes_list.py
@@ -14,6 +14,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import random
 from six.moves.urllib import parse
 
 from tempest.api.volume import base
@@ -185,3 +186,28 @@
     @test.idempotent_id('af55e775-8e4b-4feb-8719-215c43b0238c')
     def test_volume_list_pagination(self):
         self._test_pagination('volumes', ids=self.volume_id_list, detail=False)
+
+    @test.idempotent_id('46eff077-100b-427f-914e-3db2abcdb7e2')
+    def test_volume_list_with_detail_param_marker(self):
+        # Choosing a random volume from a list of volumes for 'marker'
+        # parameter
+        random_volume = random.choice(self.volume_id_list)
+
+        params = {'marker': random_volume}
+
+        # Running volume list using marker parameter
+        vol_with_marker = self.client.list_volumes(detail=True,
+                                                   params=params)['volumes']
+
+        # Fetching the index of the random volume from volume_id_list
+        index_marker = self.volume_id_list.index(random_volume)
+
+        # The expected list with marker parameter
+        verify_volume_list = self.volume_id_list[:index_marker]
+
+        failed_msg = "Failed to list volume details by marker"
+
+        # Validating the expected list is the same like the observed list
+        self.assertEqual(verify_volume_list,
+                         map(lambda x: x['id'],
+                             vol_with_marker[::-1]), failed_msg)
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index 0ba322d..f29973d 100644
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -15,7 +15,6 @@
 #    under the License.
 
 import argparse
-import httplib2
 import os
 import sys
 import traceback
@@ -29,6 +28,7 @@
 from tempest import clients
 from tempest.common import credentials_factory as credentials
 from tempest import config
+import tempest.lib.common.http
 
 
 CONF = config.CONF
@@ -91,11 +91,12 @@
     }
     client_dict[service].skip_path()
     endpoint = _get_unversioned_endpoint(client_dict[service].base_url)
-    dscv = CONF.identity.disable_ssl_certificate_validation
-    ca_certs = CONF.identity.ca_certificates_file
-    raw_http = httplib2.Http(disable_ssl_certificate_validation=dscv,
-                             ca_certs=ca_certs)
-    __, body = raw_http.request(endpoint, 'GET')
+
+    http = tempest.lib.common.http.ClosingHttp(
+        CONF.identity.disable_ssl_certificate_validation,
+        CONF.identity.ca_certificates_file)
+
+    __, body = http.request(endpoint, 'GET')
     client_dict[service].reset_path()
     try:
         body = json.loads(body)
diff --git a/tempest/hacking/checks.py b/tempest/hacking/checks.py
index d1bc141..9ebb17e 100644
--- a/tempest/hacking/checks.py
+++ b/tempest/hacking/checks.py
@@ -119,11 +119,6 @@
 
     T108
     """
-    if './tempest/api/network/' in filename:
-        # Network API tests are migrating from Tempest to Neutron repo now.
-        # So here should avoid network API tests checks.
-        return
-
     msg = "T108: hyphen should not be specified at the end of rand_name()"
     if RAND_NAME_HYPHEN_RE.match(logical_line):
         return 0, msg
diff --git a/tempest/lib/auth.py b/tempest/lib/auth.py
index 71c4f4f..a6833be 100644
--- a/tempest/lib/auth.py
+++ b/tempest/lib/auth.py
@@ -31,6 +31,39 @@
 LOG = logging.getLogger(__name__)
 
 
+def replace_version(url, new_version):
+    parts = urlparse.urlparse(url)
+    version_path = '/%s' % new_version
+    path, subs = re.subn(r'(^|/)+v\d+(?:\.\d+)?',
+                         version_path,
+                         parts.path,
+                         count=1)
+    if not subs:
+        path = '%s%s' % (parts.path.rstrip('/'), version_path)
+    url = urlparse.urlunparse((parts.scheme,
+                               parts.netloc,
+                               path,
+                               parts.params,
+                               parts.query,
+                               parts.fragment))
+    return url
+
+
+def apply_url_filters(url, filters):
+    if filters.get('api_version', None) is not None:
+        url = replace_version(url, filters['api_version'])
+    parts = urlparse.urlparse(url)
+    if filters.get('skip_path', None) is not None and parts.path != '':
+        url = urlparse.urlunparse((parts.scheme,
+                                   parts.netloc,
+                                   '/',
+                                   parts.params,
+                                   parts.query,
+                                   parts.fragment))
+
+    return url
+
+
 @six.add_metaclass(abc.ABCMeta)
 class AuthProvider(object):
     """Provide authentication"""
@@ -322,29 +355,7 @@
             raise exceptions.EndpointNotFound(
                 "service: %s, region: %s, endpoint_type: %s" %
                 (service, region, endpoint_type))
-
-        parts = urlparse.urlparse(_base_url)
-        if filters.get('api_version', None) is not None:
-            version_path = '/%s' % filters['api_version']
-            path = re.sub(r'(^|/)+v\d+(?:\.\d+)?',
-                          version_path,
-                          parts.path,
-                          count=1)
-            _base_url = urlparse.urlunparse((parts.scheme,
-                                             parts.netloc,
-                                             path or version_path,
-                                             parts.params,
-                                             parts.query,
-                                             parts.fragment))
-        if filters.get('skip_path', None) is not None and parts.path != '':
-            _base_url = urlparse.urlunparse((parts.scheme,
-                                             parts.netloc,
-                                             '/',
-                                             parts.params,
-                                             parts.query,
-                                             parts.fragment))
-
-        return _base_url
+        return apply_url_filters(_base_url, filters)
 
     def is_expired(self, auth_data):
         _, access = auth_data
@@ -455,29 +466,7 @@
         _base_url = filtered_catalog[0].get('url', None)
         if _base_url is None:
                 raise exceptions.EndpointNotFound(service)
-
-        parts = urlparse.urlparse(_base_url)
-        if filters.get('api_version', None) is not None:
-            version_path = '/%s' % filters['api_version']
-            path = re.sub(r'(^|/)+v\d+(?:\.\d+)?',
-                          version_path,
-                          parts.path,
-                          count=1)
-            _base_url = urlparse.urlunparse((parts.scheme,
-                                             parts.netloc,
-                                             path or version_path,
-                                             parts.params,
-                                             parts.query,
-                                             parts.fragment))
-        if filters.get('skip_path', None) is not None:
-            _base_url = urlparse.urlunparse((parts.scheme,
-                                             parts.netloc,
-                                             '/',
-                                             parts.params,
-                                             parts.query,
-                                             parts.fragment))
-
-        return _base_url
+        return apply_url_filters(_base_url, filters)
 
     def is_expired(self, auth_data):
         _, access = auth_data
diff --git a/tempest/lib/common/http.py b/tempest/lib/common/http.py
index b3793bc..dffc5f9 100644
--- a/tempest/lib/common/http.py
+++ b/tempest/lib/common/http.py
@@ -1,5 +1,4 @@
-# Copyright 2013 OpenStack Foundation
-# Copyright 2013 Citrix Systems, Inc.
+# Copyright 2016 OpenStack Foundation
 # All Rights Reserved.
 #
 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -14,12 +13,43 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import httplib2
+import urllib3
 
 
-class ClosingHttp(httplib2.Http):
-    def request(self, *args, **kwargs):
+class ClosingHttp(urllib3.poolmanager.PoolManager):
+    def __init__(self, disable_ssl_certificate_validation=False,
+                 ca_certs=None):
+        kwargs = {}
+
+        if disable_ssl_certificate_validation:
+            urllib3.disable_warnings()
+            kwargs['cert_reqs'] = 'CERT_NONE'
+
+        if ca_certs:
+            kwargs['cert_reqs'] = 'CERT_REQUIRED'
+            kwargs['ca_certs'] = ca_certs
+
+        super(ClosingHttp, self).__init__(**kwargs)
+
+    def request(self, url, method, *args, **kwargs):
+
+        class Response(dict):
+            def __init__(self, info):
+                for key, value in info.getheaders().items():
+                    self[key.lower()] = value
+                self.status = info.status
+                self['status'] = str(self.status)
+                self.reason = info.reason
+                self.version = info.version
+                self['content-location'] = url
+
         original_headers = kwargs.get('headers', {})
         new_headers = dict(original_headers, connection='close')
         new_kwargs = dict(kwargs, headers=new_headers)
-        return super(ClosingHttp, self).request(*args, **new_kwargs)
+
+        # Follow up to 5 redirections. Don't raise an exception if
+        # it's exceeded but return the HTTP 3XX response instead.
+        retry = urllib3.util.Retry(raise_on_redirect=False, redirect=5)
+        r = super(ClosingHttp, self).request(method, url, retries=retry,
+                                             *args, **new_kwargs)
+        return Response(r), r.data
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index d3f45c7..adc9008 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -45,6 +45,12 @@
     success - ping returns
     failure - ping_timeout reached
 
+    multi-node:
+        Multi-Node mode is enabled when CONF.compute.min_compute_nodes > 1.
+        Tests connectivity between servers on different compute nodes.
+        When enabled, test will boot each new server to different
+        compute nodes.
+
     setup:
         for primary tenant:
             1. create a network&subnet
diff --git a/tempest/tests/base.py b/tempest/tests/base.py
deleted file mode 100644
index fe9268e..0000000
--- a/tempest/tests/base.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# 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
-#    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 mock
-from oslotest import base
-from oslotest import moxstubout
-
-
-class TestCase(base.BaseTestCase):
-
-    def setUp(self):
-        super(TestCase, self).setUp()
-        mox_fixture = self.useFixture(moxstubout.MoxStubout())
-        self.mox = mox_fixture.mox
-        self.stubs = mox_fixture.stubs
-
-    def patch(self, target, **kwargs):
-        """Returns a started `mock.patch` object for the supplied target.
-
-        The caller may then call the returned patcher to create a mock object.
-
-        The caller does not need to call stop() on the returned
-        patcher object, as this method automatically adds a cleanup
-        to the test class to stop the patcher.
-
-        :param target: String module.class or module.object expression to patch
-        :param **kwargs: Passed as-is to `mock.patch`. See mock documentation
-                         for details.
-        """
-        p = mock.patch(target, **kwargs)
-        m = p.start()
-        self.addCleanup(p.stop)
-        return m
diff --git a/tempest/tests/cmd/test_javelin.py b/tempest/tests/cmd/test_javelin.py
index 2d0256a..b8c9969 100644
--- a/tempest/tests/cmd/test_javelin.py
+++ b/tempest/tests/cmd/test_javelin.py
@@ -17,7 +17,7 @@
 
 from tempest.cmd import javelin
 from tempest.lib import exceptions as lib_exc
-from tempest.tests import base
+from tempest.tests.lib import base
 
 
 class JavelinUnitTest(base.TestCase):
diff --git a/tempest/tests/cmd/test_list_plugins.py b/tempest/tests/cmd/test_list_plugins.py
index 17ddb18..782dde7 100644
--- a/tempest/tests/cmd/test_list_plugins.py
+++ b/tempest/tests/cmd/test_list_plugins.py
@@ -14,7 +14,7 @@
 
 import subprocess
 
-from tempest.tests import base
+from tempest.tests.lib import base
 
 
 class TestTempestListPlugins(base.TestCase):
diff --git a/tempest/tests/cmd/test_tempest_init.py b/tempest/tests/cmd/test_tempest_init.py
index 685a0b3..6c5326a 100644
--- a/tempest/tests/cmd/test_tempest_init.py
+++ b/tempest/tests/cmd/test_tempest_init.py
@@ -18,7 +18,7 @@
 import fixtures
 
 from tempest.cmd import init
-from tempest.tests import base
+from tempest.tests.lib import base
 
 
 class TestTempestInit(base.TestCase):
diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py
index dc0ba6f..9df07a1 100644
--- a/tempest/tests/cmd/test_verify_tempest_config.py
+++ b/tempest/tests/cmd/test_verify_tempest_config.py
@@ -19,8 +19,8 @@
 
 from tempest.cmd import verify_tempest_config
 from tempest import config
-from tempest.tests import base
 from tempest.tests import fake_config
+from tempest.tests.lib import base
 
 
 class TestGetAPIVersions(base.TestCase):
@@ -49,8 +49,9 @@
             return_value='http://fake_endpoint:5000'))
         fake_resp = {'versions': {'values': [{'id': 'v2.0'}, {'id': 'v3.0'}]}}
         fake_resp = json.dumps(fake_resp)
-        self.useFixture(mockpatch.Patch('httplib2.Http.request',
-                                        return_value=(None, fake_resp)))
+        self.useFixture(mockpatch.Patch(
+            'tempest.lib.common.http.ClosingHttp.request',
+            return_value=(None, fake_resp)))
         fake_os = mock.MagicMock()
         versions = verify_tempest_config._get_api_versions(fake_os, 'keystone')
         self.assertIn('v2.0', versions)
@@ -62,8 +63,9 @@
             return_value='http://fake_endpoint:5000'))
         fake_resp = {'versions': [{'id': 'v1.0'}, {'id': 'v2.0'}]}
         fake_resp = json.dumps(fake_resp)
-        self.useFixture(mockpatch.Patch('httplib2.Http.request',
-                                        return_value=(None, fake_resp)))
+        self.useFixture(mockpatch.Patch(
+            'tempest.lib.common.http.ClosingHttp.request',
+            return_value=(None, fake_resp)))
         fake_os = mock.MagicMock()
         versions = verify_tempest_config._get_api_versions(fake_os, 'cinder')
         self.assertIn('v1.0', versions)
@@ -75,8 +77,9 @@
             return_value='http://fake_endpoint:5000'))
         fake_resp = {'versions': [{'id': 'v2.0'}, {'id': 'v3.0'}]}
         fake_resp = json.dumps(fake_resp)
-        self.useFixture(mockpatch.Patch('httplib2.Http.request',
-                                        return_value=(None, fake_resp)))
+        self.useFixture(mockpatch.Patch(
+            'tempest.lib.common.http.ClosingHttp.request',
+            return_value=(None, fake_resp)))
         fake_os = mock.MagicMock()
         versions = verify_tempest_config._get_api_versions(fake_os, 'nova')
         self.assertIn('v2.0', versions)
@@ -95,8 +98,9 @@
         sample_body = (
             '<html><head>Sample Response</head><body>This is the sample page '
             'for the web server. Why are you requesting it?</body></html>')
-        self.useFixture(mockpatch.Patch('httplib2.Http.request',
-                                        return_value=(None, sample_body)))
+        self.useFixture(mockpatch.Patch(
+            'tempest.lib.common.http.ClosingHttp.request',
+            return_value=(None, sample_body)))
 
         # service value doesn't matter, just needs to match what
         # _get_api_versions puts in its client_dict.
@@ -122,14 +126,14 @@
                 verify_tempest_config.verify_api_versions(fake_os, 'foo', True)
                 self.assertFalse(verify_mock.called)
 
-    def test_verify_keystone_api_versions_no_v3(self):
+    @mock.patch('tempest.lib.common.http.ClosingHttp.request')
+    def test_verify_keystone_api_versions_no_v3(self, mock_request):
         self.useFixture(mockpatch.PatchObject(
             verify_tempest_config, '_get_unversioned_endpoint',
             return_value='http://fake_endpoint:5000'))
         fake_resp = {'versions': {'values': [{'id': 'v2.0'}]}}
         fake_resp = json.dumps(fake_resp)
-        self.useFixture(mockpatch.Patch('httplib2.Http.request',
-                                        return_value=(None, fake_resp)))
+        mock_request.return_value = (None, fake_resp)
         fake_os = mock.MagicMock()
         with mock.patch.object(verify_tempest_config,
                                'print_and_or_update') as print_mock:
@@ -138,14 +142,14 @@
                                            'identity-feature-enabled',
                                            False, True)
 
-    def test_verify_keystone_api_versions_no_v2(self):
+    @mock.patch('tempest.lib.common.http.ClosingHttp.request')
+    def test_verify_keystone_api_versions_no_v2(self, mock_request):
         self.useFixture(mockpatch.PatchObject(
             verify_tempest_config, '_get_unversioned_endpoint',
             return_value='http://fake_endpoint:5000'))
         fake_resp = {'versions': {'values': [{'id': 'v3.0'}]}}
         fake_resp = json.dumps(fake_resp)
-        self.useFixture(mockpatch.Patch('httplib2.Http.request',
-                                        return_value=(None, fake_resp)))
+        mock_request.return_value = (None, fake_resp)
         fake_os = mock.MagicMock()
         with mock.patch.object(verify_tempest_config,
                                'print_and_or_update') as print_mock:
@@ -154,14 +158,14 @@
                                            'identity-feature-enabled',
                                            False, True)
 
-    def test_verify_cinder_api_versions_no_v2(self):
+    @mock.patch('tempest.lib.common.http.ClosingHttp.request')
+    def test_verify_cinder_api_versions_no_v2(self, mock_request):
         self.useFixture(mockpatch.PatchObject(
             verify_tempest_config, '_get_unversioned_endpoint',
             return_value='http://fake_endpoint:5000'))
         fake_resp = {'versions': [{'id': 'v1.0'}]}
         fake_resp = json.dumps(fake_resp)
-        self.useFixture(mockpatch.Patch('httplib2.Http.request',
-                                        return_value=(None, fake_resp)))
+        mock_request.return_value = (None, fake_resp)
         fake_os = mock.MagicMock()
         with mock.patch.object(verify_tempest_config,
                                'print_and_or_update') as print_mock:
@@ -169,14 +173,14 @@
         print_mock.assert_called_once_with('api_v2', 'volume-feature-enabled',
                                            False, True)
 
-    def test_verify_cinder_api_versions_no_v1(self):
+    @mock.patch('tempest.lib.common.http.ClosingHttp.request')
+    def test_verify_cinder_api_versions_no_v1(self, mock_request):
         self.useFixture(mockpatch.PatchObject(
             verify_tempest_config, '_get_unversioned_endpoint',
             return_value='http://fake_endpoint:5000'))
         fake_resp = {'versions': [{'id': 'v2.0'}]}
         fake_resp = json.dumps(fake_resp)
-        self.useFixture(mockpatch.Patch('httplib2.Http.request',
-                                        return_value=(None, fake_resp)))
+        mock_request.return_value = (None, fake_resp)
         fake_os = mock.MagicMock()
         with mock.patch.object(verify_tempest_config,
                                'print_and_or_update') as print_mock:
diff --git a/tempest/tests/common/test_admin_available.py b/tempest/tests/common/test_admin_available.py
index 98e76b9..c803541 100644
--- a/tempest/tests/common/test_admin_available.py
+++ b/tempest/tests/common/test_admin_available.py
@@ -17,8 +17,8 @@
 
 from tempest.common import credentials_factory as credentials
 from tempest import config
-from tempest.tests import base
 from tempest.tests import fake_config
+from tempest.tests.lib import base
 
 
 class TestAdminAvailable(base.TestCase):
diff --git a/tempest/tests/common/test_alt_available.py b/tempest/tests/common/test_alt_available.py
index 48e4a3e..cb1de16 100644
--- a/tempest/tests/common/test_alt_available.py
+++ b/tempest/tests/common/test_alt_available.py
@@ -17,8 +17,8 @@
 
 from tempest.common import credentials_factory as credentials
 from tempest import config
-from tempest.tests import base
 from tempest.tests import fake_config
+from tempest.tests.lib import base
 
 
 class TestAltAvailable(base.TestCase):
diff --git a/tempest/tests/common/test_configured_creds.py b/tempest/tests/common/test_configured_creds.py
index be24595..3c104b2 100644
--- a/tempest/tests/common/test_configured_creds.py
+++ b/tempest/tests/common/test_configured_creds.py
@@ -21,9 +21,9 @@
 from tempest.lib import exceptions as lib_exc
 from tempest.lib.services.identity.v2 import token_client as v2_client
 from tempest.lib.services.identity.v3 import token_client as v3_client
-from tempest.tests import base
 from tempest.tests import fake_config
-from tempest.tests import fake_identity
+from tempest.tests.lib import base
+from tempest.tests.lib import fake_identity
 
 
 class ConfiguredV2CredentialsTests(base.TestCase):
diff --git a/tempest/tests/common/test_credentials.py b/tempest/tests/common/test_credentials.py
index 136ac02..6fc490e 100644
--- a/tempest/tests/common/test_credentials.py
+++ b/tempest/tests/common/test_credentials.py
@@ -15,8 +15,8 @@
 from tempest.common import credentials_factory as credentials
 from tempest import config
 from tempest import exceptions
-from tempest.tests import base
 from tempest.tests import fake_config
+from tempest.tests.lib import base
 
 
 class TestLegacyCredentialsProvider(base.TestCase):
diff --git a/tempest/tests/common/test_custom_matchers.py b/tempest/tests/common/test_custom_matchers.py
index 2656a47..d664961 100644
--- a/tempest/tests/common/test_custom_matchers.py
+++ b/tempest/tests/common/test_custom_matchers.py
@@ -14,7 +14,7 @@
 #    under the License.
 
 from tempest.common import custom_matchers
-from tempest.tests import base
+from tempest.tests.lib import base
 
 from testtools.tests.matchers import helpers
 
diff --git a/tempest/tests/common/test_dynamic_creds.py b/tempest/tests/common/test_dynamic_creds.py
index a49612d..e1d9023 100644
--- a/tempest/tests/common/test_dynamic_creds.py
+++ b/tempest/tests/common/test_dynamic_creds.py
@@ -31,10 +31,10 @@
 from tempest.services.identity.v2.json import users_client as \
     json_users_client
 from tempest.services.network.json import routers_client
-from tempest.tests import base
 from tempest.tests import fake_config
-from tempest.tests import fake_http
-from tempest.tests import fake_identity
+from tempest.tests.lib import base
+from tempest.tests.lib import fake_http
+from tempest.tests.lib import fake_identity
 
 
 class TestDynamicCredentialProvider(base.TestCase):
@@ -47,7 +47,6 @@
         super(TestDynamicCredentialProvider, self).setUp()
         self.useFixture(fake_config.ConfigFixture())
         self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
-        self.fake_http = fake_http.fake_httplib2(return_type=200)
         self.stubs.Set(json_token_client.TokenClient, 'raw_request',
                        fake_identity._fake_v2_response)
         cfg.CONF.set_default('operator_role', 'FakeRole',
@@ -402,7 +401,7 @@
             side_effect=side_effect)
         secgroup_list_mock.start()
 
-        return_values = (fake_http.fake_httplib({}, status=204), {})
+        return_values = fake_http.fake_http_response({}, status=204), ''
         remove_secgroup_mock = self.patch(
             'tempest.lib.services.network.security_groups_client.'
             'SecurityGroupsClient.delete', return_value=return_values)
diff --git a/tempest/tests/common/test_preprov_creds.py b/tempest/tests/common/test_preprov_creds.py
index 7af8654..36d6c3d 100644
--- a/tempest/tests/common/test_preprov_creds.py
+++ b/tempest/tests/common/test_preprov_creds.py
@@ -28,10 +28,9 @@
 from tempest.lib import auth
 from tempest.lib import exceptions as lib_exc
 from tempest.lib.services.identity.v2 import token_client
-from tempest.tests import base
 from tempest.tests import fake_config
-from tempest.tests import fake_http
-from tempest.tests import fake_identity
+from tempest.tests.lib import base
+from tempest.tests.lib import fake_identity
 
 
 class TestPreProvisionedCredentials(base.TestCase):
@@ -48,7 +47,6 @@
         super(TestPreProvisionedCredentials, self).setUp()
         self.useFixture(fake_config.ConfigFixture())
         self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
-        self.fake_http = fake_http.fake_httplib2(return_type=200)
         self.stubs.Set(token_client.TokenClient, 'raw_request',
                        fake_identity._fake_v2_response)
         self.useFixture(lockutils_fixtures.ExternalLockFixture())
diff --git a/tempest/tests/common/test_waiters.py b/tempest/tests/common/test_waiters.py
index 492bdca..e0cef62 100644
--- a/tempest/tests/common/test_waiters.py
+++ b/tempest/tests/common/test_waiters.py
@@ -19,7 +19,7 @@
 from tempest.common import waiters
 from tempest import exceptions
 from tempest.services.volume.base import base_volumes_client
-from tempest.tests import base
+from tempest.tests.lib import base
 import tempest.tests.utils as utils
 
 
diff --git a/tempest/tests/common/utils/linux/test_remote_client.py b/tempest/tests/common/utils/linux/test_remote_client.py
index 9c2b99e..22cf47a 100644
--- a/tempest/tests/common/utils/linux/test_remote_client.py
+++ b/tempest/tests/common/utils/linux/test_remote_client.py
@@ -19,8 +19,8 @@
 
 from tempest.common.utils.linux import remote_client
 from tempest import config
-from tempest.tests import base
 from tempest.tests import fake_config
+from tempest.tests.lib import base
 
 
 class TestRemoteClient(base.TestCase):
diff --git a/tempest/tests/common/utils/test_file_utils.py b/tempest/tests/common/utils/test_file_utils.py
index 937aefa..1a14592 100644
--- a/tempest/tests/common/utils/test_file_utils.py
+++ b/tempest/tests/common/utils/test_file_utils.py
@@ -16,7 +16,7 @@
 import mock
 
 from tempest.common.utils import file_utils
-from tempest.tests import base
+from tempest.tests.lib import base
 
 
 class TestFileUtils(base.TestCase):
diff --git a/tempest/tests/fake_http.py b/tempest/tests/fake_http.py
deleted file mode 100644
index d714055..0000000
--- a/tempest/tests/fake_http.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# 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
-#    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 copy
-
-import httplib2
-
-
-class fake_httplib2(object):
-
-    def __init__(self, return_type=None, *args, **kwargs):
-        self.return_type = return_type
-
-    def request(self, uri, method="GET", body=None, headers=None,
-                redirections=5, connection_type=None):
-        if not self.return_type:
-            fake_headers = httplib2.Response(headers)
-            return_obj = {
-                'uri': uri,
-                'method': method,
-                'body': body,
-                'headers': headers
-            }
-            return (fake_headers, return_obj)
-        elif isinstance(self.return_type, int):
-            body = "fake_body"
-            header_info = {
-                'content-type': 'text/plain',
-                'status': str(self.return_type),
-                'content-length': len(body)
-            }
-            resp_header = httplib2.Response(header_info)
-            return (resp_header, body)
-        else:
-            msg = "unsupported return type %s" % self.return_type
-            raise TypeError(msg)
-
-
-class fake_httplib(object):
-    def __init__(self, headers, body=None,
-                 version=1.0, status=200, reason="Ok"):
-        """Initialization of fake httplib
-
-        :param headers: dict representing HTTP response headers
-        :param body: file-like object
-        :param version: HTTP Version
-        :param status: Response status code
-        :param reason: Status code related message.
-        """
-        self.body = body
-        self.status = status
-        self.reason = reason
-        self.version = version
-        self.headers = headers
-
-    def getheaders(self):
-        return copy.deepcopy(self.headers).items()
-
-    def getheader(self, key, default):
-        return self.headers.get(key, default)
-
-    def read(self, amt):
-        return self.body.read(amt)
diff --git a/tempest/tests/fake_identity.py b/tempest/tests/fake_identity.py
deleted file mode 100644
index d0de927..0000000
--- a/tempest/tests/fake_identity.py
+++ /dev/null
@@ -1,163 +0,0 @@
-# Copyright 2014 IBM Corp.
-# 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 httplib2
-from oslo_serialization import jsonutils as json
-
-FAKE_AUTH_URL = 'http://fake_uri.com/auth'
-
-TOKEN = "fake_token"
-ALT_TOKEN = "alt_fake_token"
-
-# Fake Identity v2 constants
-COMPUTE_ENDPOINTS_V2 = {
-    "endpoints": [
-        {
-            "adminURL": "http://fake_url/v2/first_endpoint/admin",
-            "region": "NoMatchRegion",
-            "internalURL": "http://fake_url/v2/first_endpoint/internal",
-            "publicURL": "http://fake_url/v2/first_endpoint/public"
-        },
-        {
-            "adminURL": "http://fake_url/v2/second_endpoint/admin",
-            "region": "FakeRegion",
-            "internalURL": "http://fake_url/v2/second_endpoint/internal",
-            "publicURL": "http://fake_url/v2/second_endpoint/public"
-        },
-    ],
-    "type": "compute",
-    "name": "nova"
-}
-
-CATALOG_V2 = [COMPUTE_ENDPOINTS_V2, ]
-
-ALT_IDENTITY_V2_RESPONSE = {
-    "access": {
-        "token": {
-            "expires": "2020-01-01T00:00:10Z",
-            "id": ALT_TOKEN,
-            "tenant": {
-                "id": "fake_tenant_id"
-            },
-        },
-        "user": {
-            "id": "fake_user_id",
-        },
-        "serviceCatalog": CATALOG_V2,
-    },
-}
-
-IDENTITY_V2_RESPONSE = {
-    "access": {
-        "token": {
-            "expires": "2020-01-01T00:00:10Z",
-            "id": TOKEN,
-            "tenant": {
-                "id": "fake_tenant_id"
-            },
-        },
-        "user": {
-            "id": "fake_user_id",
-        },
-        "serviceCatalog": CATALOG_V2,
-    },
-}
-
-# Fake Identity V3 constants
-COMPUTE_ENDPOINTS_V3 = {
-    "endpoints": [
-        {
-            "id": "first_compute_fake_service",
-            "interface": "public",
-            "region": "NoMatchRegion",
-            "url": "http://fake_url/v3/first_endpoint/api"
-        },
-        {
-            "id": "second_fake_service",
-            "interface": "public",
-            "region": "FakeRegion",
-            "url": "http://fake_url/v3/second_endpoint/api"
-        },
-        {
-            "id": "third_fake_service",
-            "interface": "admin",
-            "region": "MiddleEarthRegion",
-            "url": "http://fake_url/v3/third_endpoint/api"
-        }
-
-    ],
-    "type": "compute",
-    "id": "fake_compute_endpoint"
-}
-
-CATALOG_V3 = [COMPUTE_ENDPOINTS_V3, ]
-
-IDENTITY_V3_RESPONSE = {
-    "token": {
-        "methods": [
-            "token",
-            "password"
-        ],
-        "expires_at": "2020-01-01T00:00:10.000123Z",
-        "project": {
-            "domain": {
-                "id": "fake_domain_id",
-                "name": "fake"
-            },
-            "id": "project_id",
-            "name": "project_name"
-        },
-        "user": {
-            "domain": {
-                "id": "fake_domain_id",
-                "name": "domain_name"
-            },
-            "id": "fake_user_id",
-            "name": "username"
-        },
-        "issued_at": "2013-05-29T16:55:21.468960Z",
-        "catalog": CATALOG_V3
-    }
-}
-
-ALT_IDENTITY_V3 = IDENTITY_V3_RESPONSE
-
-
-def _fake_v3_response(self, uri, method="GET", body=None, headers=None,
-                      redirections=5, connection_type=None):
-    fake_headers = {
-        "status": "201",
-        "x-subject-token": TOKEN
-    }
-    return (httplib2.Response(fake_headers),
-            json.dumps(IDENTITY_V3_RESPONSE))
-
-
-def _fake_v2_response(self, uri, method="GET", body=None, headers=None,
-                      redirections=5, connection_type=None):
-    return (httplib2.Response({"status": "200"}),
-            json.dumps(IDENTITY_V2_RESPONSE))
-
-
-def _fake_auth_failure_response():
-    # the response body isn't really used in this case, but lets send it anyway
-    # to have a safe check in some future change on the rest client.
-    body = {
-        "unauthorized": {
-            "message": "Unauthorized",
-            "code": "401"
-        }
-    }
-    return httplib2.Response({"status": "401"}), json.dumps(body)
diff --git a/tempest/tests/lib/fake_http.py b/tempest/tests/lib/fake_http.py
index eda202d..397c856 100644
--- a/tempest/tests/lib/fake_http.py
+++ b/tempest/tests/lib/fake_http.py
@@ -14,8 +14,6 @@
 
 import copy
 
-import httplib2
-
 
 class fake_httplib2(object):
 
@@ -25,7 +23,7 @@
     def request(self, uri, method="GET", body=None, headers=None,
                 redirections=5, connection_type=None):
         if not self.return_type:
-            fake_headers = httplib2.Response(headers)
+            fake_headers = fake_http_response(headers)
             return_obj = {
                 'uri': uri,
                 'method': method,
@@ -37,20 +35,20 @@
             body = body or "fake_body"
             header_info = {
                 'content-type': 'text/plain',
-                'status': str(self.return_type),
                 'content-length': len(body)
             }
-            resp_header = httplib2.Response(header_info)
+            resp_header = fake_http_response(header_info,
+                                             status=self.return_type)
             return (resp_header, body)
         else:
             msg = "unsupported return type %s" % self.return_type
             raise TypeError(msg)
 
 
-class fake_httplib(object):
+class fake_http_response(dict):
     def __init__(self, headers, body=None,
                  version=1.0, status=200, reason="Ok"):
-        """Fake httplib implementation
+        """Initialization of fake HTTP Response
 
         :param headers: dict representing HTTP response headers
         :param body: file-like object
@@ -60,10 +58,15 @@
         """
         self.body = body
         self.status = status
+        self['status'] = str(self.status)
         self.reason = reason
         self.version = version
         self.headers = headers
 
+        if headers:
+            for key, value in headers.items():
+                self[key.lower()] = value
+
     def getheaders(self):
         return copy.deepcopy(self.headers).items()
 
diff --git a/tempest/tests/lib/fake_identity.py b/tempest/tests/lib/fake_identity.py
index bac2676..5732065 100644
--- a/tempest/tests/lib/fake_identity.py
+++ b/tempest/tests/lib/fake_identity.py
@@ -13,9 +13,9 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import json
+from oslo_serialization import jsonutils as json
 
-import httplib2
+from tempest.tests.lib import fake_http
 
 FAKE_AUTH_URL = 'http://fake_uri.com/auth'
 
@@ -139,16 +139,15 @@
 def _fake_v3_response(self, uri, method="GET", body=None, headers=None,
                       redirections=5, connection_type=None):
     fake_headers = {
-        "status": "201",
         "x-subject-token": TOKEN
     }
-    return (httplib2.Response(fake_headers),
+    return (fake_http.fake_http_response(fake_headers, status=201),
             json.dumps(IDENTITY_V3_RESPONSE))
 
 
 def _fake_v2_response(self, uri, method="GET", body=None, headers=None,
                       redirections=5, connection_type=None):
-    return (httplib2.Response({"status": "200"}),
+    return (fake_http.fake_http_response({}, status=200),
             json.dumps(IDENTITY_V2_RESPONSE))
 
 
@@ -161,4 +160,4 @@
             "code": "401"
         }
     }
-    return httplib2.Response({"status": "401"}), json.dumps(body)
+    return fake_http.fake_http_response({}, status=401), json.dumps(body)
diff --git a/tempest/tests/lib/services/compute/base.py b/tempest/tests/lib/services/compute/base.py
index 5602044..c805de2 100644
--- a/tempest/tests/lib/services/compute/base.py
+++ b/tempest/tests/lib/services/compute/base.py
@@ -12,11 +12,11 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import httplib2
 from oslo_serialization import jsonutils as json
 from oslotest import mockpatch
 
 from tempest.tests.lib import base
+from tempest.tests.lib import fake_http
 
 
 class BaseComputeServiceTest(base.TestCase):
@@ -26,11 +26,8 @@
             json_body = json.dumps(body)
             if to_utf:
                 json_body = json_body.encode('utf-8')
-        resp_dict = {'status': status}
-        if headers:
-            resp_dict.update(headers)
-        response = (httplib2.Response(resp_dict), json_body)
-        return response
+        resp = fake_http.fake_http_response(headers, status=status), json_body
+        return resp
 
     def check_service_client_function(self, function, function2mock,
                                       body, to_utf=False, status=200,
diff --git a/tempest/tests/lib/services/compute/test_base_compute_client.py b/tempest/tests/lib/services/compute/test_base_compute_client.py
index f552ef5..49d29b3 100644
--- a/tempest/tests/lib/services/compute/test_base_compute_client.py
+++ b/tempest/tests/lib/services/compute/test_base_compute_client.py
@@ -12,14 +12,13 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import httplib2
 import mock
-from oslotest import mockpatch
 
 from tempest.lib.common import rest_client
 from tempest.lib import exceptions
 from tempest.lib.services.compute import base_compute_client
 from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib import fake_http
 from tempest.tests.lib.services.compute import base
 
 
@@ -36,28 +35,29 @@
         super(TestMicroversionHeaderCheck, self).tearDown()
         base_compute_client.COMPUTE_MICROVERSION = None
 
-    def _check_microverion_header_in_response(self, fake_response):
-        def request(*args, **kwargs):
-            return (httplib2.Response(fake_response), {})
-
-        self.useFixture(mockpatch.PatchObject(
-            rest_client.RestClient,
-            'request',
-            side_effect=request))
-
-    def test_correct_microverion_in_response(self):
-        fake_response = {self.client.api_microversion_header_name: '2.2'}
-        self._check_microverion_header_in_response(fake_response)
+    @mock.patch('tempest.lib.common.http.ClosingHttp.request')
+    def test_correct_microverion_in_response(self, mock_request):
+        response = fake_http.fake_http_response(
+            headers={self.client.api_microversion_header_name: '2.2'},
+        )
+        mock_request.return_value = response, ''
         self.client.get('fake_url')
 
-    def test_incorrect_microverion_in_response(self):
-        fake_response = {self.client.api_microversion_header_name: '2.3'}
-        self._check_microverion_header_in_response(fake_response)
+    @mock.patch('tempest.lib.common.http.ClosingHttp.request')
+    def test_incorrect_microverion_in_response(self, mock_request):
+        response = fake_http.fake_http_response(
+            headers={self.client.api_microversion_header_name: '2.3'},
+        )
+        mock_request.return_value = response, ''
         self.assertRaises(exceptions.InvalidHTTPResponseHeader,
                           self.client.get, 'fake_url')
 
-    def test_no_microverion_header_in_response(self):
-        self._check_microverion_header_in_response({})
+    @mock.patch('tempest.lib.common.http.ClosingHttp.request')
+    def test_no_microverion_header_in_response(self, mock_request):
+        response = fake_http.fake_http_response(
+            headers={},
+        )
+        mock_request.return_value = response, ''
         self.assertRaises(exceptions.InvalidHTTPResponseHeader,
                           self.client.get, 'fake_url')
 
@@ -164,7 +164,7 @@
     def test_no_microverion_header_in_raw_request(self):
         def raw_request(*args, **kwargs):
             self.assertNotIn('X-OpenStack-Nova-API-Version', kwargs['headers'])
-            return (httplib2.Response({'status': 200}), {})
+            return (fake_http.fake_http_response({}, status=200), '')
 
         with mock.patch.object(rest_client.RestClient,
                                'raw_request') as mock_get:
@@ -196,9 +196,9 @@
             self.assertIn('X-OpenStack-Nova-API-Version', kwargs['headers'])
             self.assertEqual('2.2',
                              kwargs['headers']['X-OpenStack-Nova-API-Version'])
-            return (httplib2.Response(
-                {'status': 200,
-                 self.client.api_microversion_header_name: '2.2'}), {})
+            return (fake_http.fake_http_response(
+                headers={self.client.api_microversion_header_name: '2.2'},
+                status=200), '')
 
         with mock.patch.object(rest_client.RestClient,
                                'raw_request') as mock_get:
diff --git a/tempest/tests/lib/services/compute/test_flavors_client.py b/tempest/tests/lib/services/compute/test_flavors_client.py
index 795aff7..e22b4fe 100644
--- a/tempest/tests/lib/services/compute/test_flavors_client.py
+++ b/tempest/tests/lib/services/compute/test_flavors_client.py
@@ -13,13 +13,13 @@
 #    under the License.
 
 import copy
-import httplib2
 
 from oslo_serialization import jsonutils as json
 from oslotest import mockpatch
 
 from tempest.lib.services.compute import flavors_client
 from tempest.tests.lib import fake_auth_provider
+from tempest.tests.lib import fake_http
 from tempest.tests.lib.services.compute import base
 
 
@@ -117,7 +117,7 @@
         body = json.dumps({'flavors': [TestFlavorsClient.FAKE_FLAVOR]})
         if bytes_body:
             body = body.encode('utf-8')
-        response = (httplib2.Response({'status': 200}), body)
+        response = fake_http.fake_http_response({}, status=200), body
         self.useFixture(mockpatch.Patch(
             'tempest.lib.common.rest_client.RestClient.get',
             return_value=response))
diff --git a/tempest/tests/lib/services/compute/test_server_groups_client.py b/tempest/tests/lib/services/compute/test_server_groups_client.py
index f1f2906..cb163a8 100644
--- a/tempest/tests/lib/services/compute/test_server_groups_client.py
+++ b/tempest/tests/lib/services/compute/test_server_groups_client.py
@@ -12,12 +12,11 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import httplib2
-
 from oslotest import mockpatch
 from tempest.tests.lib import fake_auth_provider
 
 from tempest.lib.services.compute import server_groups_client
+from tempest.tests.lib import fake_http
 from tempest.tests.lib.services.compute import base
 
 
@@ -50,7 +49,7 @@
         self._test_create_server_group(bytes_body=True)
 
     def test_delete_server_group(self):
-        response = (httplib2.Response({'status': 204}), None)
+        response = fake_http.fake_http_response({}, status=204), ''
         self.useFixture(mockpatch.Patch(
             'tempest.lib.common.rest_client.RestClient.delete',
             return_value=response))
diff --git a/tempest/tests/lib/services/identity/v2/test_token_client.py b/tempest/tests/lib/services/identity/v2/test_token_client.py
index dd3533a..d91ecdc 100644
--- a/tempest/tests/lib/services/identity/v2/test_token_client.py
+++ b/tempest/tests/lib/services/identity/v2/test_token_client.py
@@ -14,8 +14,7 @@
 
 import json
 
-import httplib2
-from oslotest import mockpatch
+import mock
 
 from tempest.lib.common import rest_client
 from tempest.lib import exceptions
@@ -28,7 +27,6 @@
 
     def setUp(self):
         super(TestTokenClientV2, self).setUp()
-        self.fake_200_http = fake_http.fake_httplib2(return_type=200)
 
     def test_init_without_authurl(self):
         self.assertRaises(exceptions.IdentityError,
@@ -36,10 +34,15 @@
 
     def test_auth(self):
         token_client_v2 = token_client.TokenClient('fake_url')
-        post_mock = self.useFixture(mockpatch.PatchObject(
-            token_client_v2, 'post', return_value=self.fake_200_http.request(
-                'fake_url', body={'access': {'token': 'fake_token'}})))
-        resp = token_client_v2.auth('fake_user', 'fake_pass')
+        response = fake_http.fake_http_response(
+            None, status=200,
+        )
+        body = {'access': {'token': 'fake_token'}}
+
+        with mock.patch.object(token_client_v2, 'post') as post_mock:
+            post_mock.return_value = response, body
+            resp = token_client_v2.auth('fake_user', 'fake_pass')
+
         self.assertIsInstance(resp, rest_client.ResponseBody)
         req_dict = json.dumps({
             'auth': {
@@ -49,15 +52,21 @@
                 },
             }
         }, sort_keys=True)
-        post_mock.mock.assert_called_once_with('fake_url/tokens',
-                                               body=req_dict)
+        post_mock.assert_called_once_with('fake_url/tokens',
+                                          body=req_dict)
 
     def test_auth_with_tenant(self):
         token_client_v2 = token_client.TokenClient('fake_url')
-        post_mock = self.useFixture(mockpatch.PatchObject(
-            token_client_v2, 'post', return_value=self.fake_200_http.request(
-                'fake_url', body={'access': {'token': 'fake_token'}})))
-        resp = token_client_v2.auth('fake_user', 'fake_pass', 'fake_tenant')
+        response = fake_http.fake_http_response(
+            None, status=200,
+        )
+        body = {'access': {'token': 'fake_token'}}
+
+        with mock.patch.object(token_client_v2, 'post') as post_mock:
+            post_mock.return_value = response, body
+            resp = token_client_v2.auth('fake_user', 'fake_pass',
+                                        'fake_tenant')
+
         self.assertIsInstance(resp, rest_client.ResponseBody)
         req_dict = json.dumps({
             'auth': {
@@ -68,25 +77,31 @@
                 },
             }
         }, sort_keys=True)
-        post_mock.mock.assert_called_once_with('fake_url/tokens',
-                                               body=req_dict)
+        post_mock.assert_called_once_with('fake_url/tokens',
+                                          body=req_dict)
 
     def test_request_with_str_body(self):
         token_client_v2 = token_client.TokenClient('fake_url')
-        self.useFixture(mockpatch.PatchObject(
-            token_client_v2, 'raw_request', return_value=(
-                httplib2.Response({'status': '200'}),
-                str('{"access": {"token": "fake_token"}}'))))
-        resp, body = token_client_v2.request('GET', 'fake_uri')
-        self.assertIsInstance(resp, httplib2.Response)
+        response = fake_http.fake_http_response(
+            None, status=200,
+        )
+        body = str('{"access": {"token": "fake_token"}}')
+
+        with mock.patch.object(token_client_v2, 'raw_request') as mock_raw_r:
+            mock_raw_r.return_value = response, body
+            resp, body = token_client_v2.request('GET', 'fake_uri')
         self.assertIsInstance(body, dict)
 
     def test_request_with_bytes_body(self):
         token_client_v2 = token_client.TokenClient('fake_url')
-        self.useFixture(mockpatch.PatchObject(
-            token_client_v2, 'raw_request', return_value=(
-                httplib2.Response({'status': '200'}),
-                bytes(b'{"access": {"token": "fake_token"}}'))))
-        resp, body = token_client_v2.request('GET', 'fake_uri')
-        self.assertIsInstance(resp, httplib2.Response)
+
+        response = fake_http.fake_http_response(
+            None, status=200,
+        )
+        body = b'{"access": {"token": "fake_token"}}'
+
+        with mock.patch.object(token_client_v2, 'raw_request') as mock_raw_r:
+            mock_raw_r.return_value = response, body
+            resp, body = token_client_v2.request('GET', 'fake_uri')
+
         self.assertIsInstance(body, dict)
diff --git a/tempest/tests/lib/services/identity/v3/test_token_client.py b/tempest/tests/lib/services/identity/v3/test_token_client.py
index bb4dae3..52b8e01 100644
--- a/tempest/tests/lib/services/identity/v3/test_token_client.py
+++ b/tempest/tests/lib/services/identity/v3/test_token_client.py
@@ -14,8 +14,7 @@
 
 import json
 
-import httplib2
-from oslotest import mockpatch
+import mock
 
 from tempest.lib.common import rest_client
 from tempest.lib import exceptions
@@ -24,11 +23,10 @@
 from tempest.tests.lib import fake_http
 
 
-class TestTokenClientV2(base.TestCase):
+class TestTokenClientV3(base.TestCase):
 
     def setUp(self):
-        super(TestTokenClientV2, self).setUp()
-        self.fake_201_http = fake_http.fake_httplib2(return_type=201)
+        super(TestTokenClientV3, self).setUp()
 
     def test_init_without_authurl(self):
         self.assertRaises(exceptions.IdentityError,
@@ -36,10 +34,16 @@
 
     def test_auth(self):
         token_client_v3 = token_client.V3TokenClient('fake_url')
-        post_mock = self.useFixture(mockpatch.PatchObject(
-            token_client_v3, 'post', return_value=self.fake_201_http.request(
-                'fake_url', body={'access': {'token': 'fake_token'}})))
-        resp = token_client_v3.auth(username='fake_user', password='fake_pass')
+        response = fake_http.fake_http_response(
+            None, status=201,
+        )
+        body = {'access': {'token': 'fake_token'}}
+
+        with mock.patch.object(token_client_v3, 'post') as post_mock:
+            post_mock.return_value = response, body
+            resp = token_client_v3.auth(username='fake_user',
+                                        password='fake_pass')
+
         self.assertIsInstance(resp, rest_client.ResponseBody)
         req_dict = json.dumps({
             'auth': {
@@ -54,19 +58,24 @@
                 },
             }
         }, sort_keys=True)
-        post_mock.mock.assert_called_once_with('fake_url/auth/tokens',
-                                               body=req_dict)
+        post_mock.assert_called_once_with('fake_url/auth/tokens',
+                                          body=req_dict)
 
     def test_auth_with_project_id_and_domain_id(self):
         token_client_v3 = token_client.V3TokenClient('fake_url')
-        post_mock = self.useFixture(mockpatch.PatchObject(
-            token_client_v3, 'post', return_value=self.fake_201_http.request(
-                'fake_url', body={'access': {'token': 'fake_token'}})))
-        resp = token_client_v3.auth(
-            username='fake_user', password='fake_pass',
-            project_id='fcac2a055a294e4c82d0a9c21c620eb4',
-            user_domain_id='14f4a9a99973404d8c20ba1d2af163ff',
-            project_domain_id='291f63ae9ac54ee292ca09e5f72d9676')
+        response = fake_http.fake_http_response(
+            None, status=201,
+        )
+        body = {'access': {'token': 'fake_token'}}
+
+        with mock.patch.object(token_client_v3, 'post') as post_mock:
+            post_mock.return_value = response, body
+            resp = token_client_v3.auth(
+                username='fake_user', password='fake_pass',
+                project_id='fcac2a055a294e4c82d0a9c21c620eb4',
+                user_domain_id='14f4a9a99973404d8c20ba1d2af163ff',
+                project_domain_id='291f63ae9ac54ee292ca09e5f72d9676')
+
         self.assertIsInstance(resp, rest_client.ResponseBody)
         req_dict = json.dumps({
             'auth': {
@@ -92,16 +101,22 @@
                 }
             }
         }, sort_keys=True)
-        post_mock.mock.assert_called_once_with('fake_url/auth/tokens',
-                                               body=req_dict)
+        post_mock.assert_called_once_with('fake_url/auth/tokens',
+                                          body=req_dict)
 
     def test_auth_with_tenant(self):
-        token_client_v2 = token_client.V3TokenClient('fake_url')
-        post_mock = self.useFixture(mockpatch.PatchObject(
-            token_client_v2, 'post', return_value=self.fake_201_http.request(
-                'fake_url', body={'access': {'token': 'fake_token'}})))
-        resp = token_client_v2.auth(username='fake_user', password='fake_pass',
-                                    project_name='fake_tenant')
+        token_client_v3 = token_client.V3TokenClient('fake_url')
+        response = fake_http.fake_http_response(
+            None, status=201,
+        )
+        body = {'access': {'token': 'fake_token'}}
+
+        with mock.patch.object(token_client_v3, 'post') as post_mock:
+            post_mock.return_value = response, body
+            resp = token_client_v3.auth(username='fake_user',
+                                        password='fake_pass',
+                                        project_name='fake_tenant')
+
         self.assertIsInstance(resp, rest_client.ResponseBody)
         req_dict = json.dumps({
             'auth': {
@@ -121,25 +136,32 @@
             }
         }, sort_keys=True)
 
-        post_mock.mock.assert_called_once_with('fake_url/auth/tokens',
-                                               body=req_dict)
+        post_mock.assert_called_once_with('fake_url/auth/tokens',
+                                          body=req_dict)
 
     def test_request_with_str_body(self):
         token_client_v3 = token_client.V3TokenClient('fake_url')
-        self.useFixture(mockpatch.PatchObject(
-            token_client_v3, 'raw_request', return_value=(
-                httplib2.Response({"status": "200"}),
-                str('{"access": {"token": "fake_token"}}'))))
-        resp, body = token_client_v3.request('GET', 'fake_uri')
-        self.assertIsInstance(resp, httplib2.Response)
+        response = fake_http.fake_http_response(
+            None, status=200,
+        )
+        body = str('{"access": {"token": "fake_token"}}')
+
+        with mock.patch.object(token_client_v3, 'raw_request') as mock_raw_r:
+            mock_raw_r.return_value = response, body
+            resp, body = token_client_v3.request('GET', 'fake_uri')
+
         self.assertIsInstance(body, dict)
 
     def test_request_with_bytes_body(self):
         token_client_v3 = token_client.V3TokenClient('fake_url')
-        self.useFixture(mockpatch.PatchObject(
-            token_client_v3, 'raw_request', return_value=(
-                httplib2.Response({"status": "200"}),
-                bytes(b'{"access": {"token": "fake_token"}}'))))
-        resp, body = token_client_v3.request('GET', 'fake_uri')
-        self.assertIsInstance(resp, httplib2.Response)
+
+        response = fake_http.fake_http_response(
+            None, status=200,
+        )
+        body = b'{"access": {"token": "fake_token"}}'
+
+        with mock.patch.object(token_client_v3, 'raw_request') as mock_raw_r:
+            mock_raw_r.return_value = response, body
+            resp, body = token_client_v3.request('GET', 'fake_uri')
+
         self.assertIsInstance(body, dict)
diff --git a/tempest/tests/lib/test_auth.py b/tempest/tests/lib/test_auth.py
index 55f0c4e..5502c01 100644
--- a/tempest/tests/lib/test_auth.py
+++ b/tempest/tests/lib/test_auth.py
@@ -24,7 +24,6 @@
 from tempest.lib.services.identity.v3 import token_client as v3_client
 from tempest.tests.lib import base
 from tempest.tests.lib import fake_credentials
-from tempest.tests.lib import fake_http
 from tempest.tests.lib import fake_identity
 
 
@@ -42,7 +41,6 @@
 
     def setUp(self):
         super(BaseAuthTestsSetUp, self).setUp()
-        self.fake_http = fake_http.fake_httplib2(return_type=200)
         self.stubs.Set(auth, 'get_credentials', fake_get_credentials)
         self.auth_provider = self._auth(self.credentials,
                                         fake_identity.FAKE_AUTH_URL)
@@ -570,3 +568,65 @@
         attrs = {'tenant_name': 'tenant', 'project_name': 'project'}
         self.assertRaises(
             exceptions.InvalidCredentials, auth.KeystoneV3Credentials, **attrs)
+
+
+class TestReplaceVersion(base.TestCase):
+    def test_version_no_trailing_path(self):
+        self.assertEqual(
+            'http://localhost:35357/v2.0',
+            auth.replace_version('http://localhost:35357/v3', 'v2.0'))
+
+    def test_version_no_trailing_path_solidus(self):
+        self.assertEqual(
+            'http://localhost:35357/v2.0/',
+            auth.replace_version('http://localhost:35357/v3/', 'v2.0'))
+
+    def test_version_trailing_path(self):
+        self.assertEqual(
+            'http://localhost:35357/v2.0/uuid',
+            auth.replace_version('http://localhost:35357/v3/uuid', 'v2.0'))
+
+    def test_version_trailing_path_solidus(self):
+        self.assertEqual(
+            'http://localhost:35357/v2.0/uuid/',
+            auth.replace_version('http://localhost:35357/v3/uuid/', 'v2.0'))
+
+    def test_no_version_base(self):
+        self.assertEqual(
+            'http://localhost:35357/v2.0',
+            auth.replace_version('http://localhost:35357', 'v2.0'))
+
+    def test_no_version_base_solidus(self):
+        self.assertEqual(
+            'http://localhost:35357/v2.0',
+            auth.replace_version('http://localhost:35357/', 'v2.0'))
+
+    def test_no_version_path(self):
+        self.assertEqual(
+            'http://localhost/identity/v2.0',
+            auth.replace_version('http://localhost/identity', 'v2.0'))
+
+    def test_no_version_path_solidus(self):
+        self.assertEqual(
+            'http://localhost/identity/v2.0',
+            auth.replace_version('http://localhost/identity/', 'v2.0'))
+
+    def test_path_version(self):
+        self.assertEqual(
+            'http://localhost/identity/v2.0',
+            auth.replace_version('http://localhost/identity/v3', 'v2.0'))
+
+    def test_path_version_solidus(self):
+        self.assertEqual(
+            'http://localhost/identity/v2.0/',
+            auth.replace_version('http://localhost/identity/v3/', 'v2.0'))
+
+    def test_path_version_trailing_path(self):
+        self.assertEqual(
+            'http://localhost/identity/v2.0/uuid',
+            auth.replace_version('http://localhost/identity/v3/uuid', 'v2.0'))
+
+    def test_path_version_trailing_path_solidus(self):
+        self.assertEqual(
+            'http://localhost/identity/v2.0/uuid/',
+            auth.replace_version('http://localhost/identity/v3/uuid/', 'v2.0'))
diff --git a/tempest/tests/lib/test_rest_client.py b/tempest/tests/lib/test_rest_client.py
index 87af455..90651b0 100644
--- a/tempest/tests/lib/test_rest_client.py
+++ b/tempest/tests/lib/test_rest_client.py
@@ -15,11 +15,11 @@
 import copy
 import json
 
-import httplib2
 import jsonschema
 from oslotest import mockpatch
 import six
 
+from tempest.lib.common import http
 from tempest.lib.common import rest_client
 from tempest.lib import exceptions
 from tempest.tests.lib import base
@@ -37,7 +37,9 @@
         self.fake_auth_provider = fake_auth_provider.FakeAuthProvider()
         self.rest_client = rest_client.RestClient(
             self.fake_auth_provider, None, None)
-        self.stubs.Set(httplib2.Http, 'request', self.fake_http.request)
+        self.stubs.Set(http.ClosingHttp, 'request',
+                       self.fake_http.request)
+
         self.useFixture(mockpatch.PatchObject(self.rest_client,
                                               '_log_request'))
 
@@ -292,7 +294,9 @@
         if absolute_limit is False:
             resp_dict.update({'retry-after': 120})
             resp_body.update({'overLimit': {'message': 'fake_message'}})
-        resp = httplib2.Response(resp_dict)
+        resp = fake_http.fake_http_response(headers=resp_dict,
+                                            status=int(r_code),
+                                            body=json.dumps(resp_body))
         data = {
             "method": "fake_method",
             "url": "fake_url",
diff --git a/tempest/tests/negative/test_negative_auto_test.py b/tempest/tests/negative/test_negative_auto_test.py
index 7a127cd..c666bd3 100644
--- a/tempest/tests/negative/test_negative_auto_test.py
+++ b/tempest/tests/negative/test_negative_auto_test.py
@@ -15,8 +15,8 @@
 
 from tempest import config
 import tempest.test as test
-from tempest.tests import base
 from tempest.tests import fake_config
+from tempest.tests.lib import base
 
 
 class TestNegativeAutoTest(base.TestCase):
diff --git a/tempest/tests/negative/test_negative_generators.py b/tempest/tests/negative/test_negative_generators.py
index 78fd80d..e0d7f42 100644
--- a/tempest/tests/negative/test_negative_generators.py
+++ b/tempest/tests/negative/test_negative_generators.py
@@ -22,7 +22,7 @@
 from tempest.common.generator import base_generator
 from tempest.common.generator import negative_generator
 from tempest.common.generator import valid_generator
-from tempest.tests import base
+from tempest.tests.lib import base
 
 
 class TestNegativeBasicGenerator(base.TestCase):
diff --git a/tempest/tests/stress/test_stress.py b/tempest/tests/stress/test_stress.py
index dfe0291..a35b4d7 100644
--- a/tempest/tests/stress/test_stress.py
+++ b/tempest/tests/stress/test_stress.py
@@ -18,7 +18,7 @@
 
 from oslo_log import log as logging
 from tempest.lib import exceptions
-from tempest.tests import base
+from tempest.tests.lib import base
 
 LOG = logging.getLogger(__name__)
 
diff --git a/tempest/tests/test_base_test.py b/tempest/tests/test_base_test.py
index dc355b4..9ffb7a1 100644
--- a/tempest/tests/test_base_test.py
+++ b/tempest/tests/test_base_test.py
@@ -19,8 +19,8 @@
 from tempest.common import fixed_network
 from tempest import config
 from tempest import test
-from tempest.tests import base
 from tempest.tests import fake_config
+from tempest.tests.lib import base
 
 
 class TestBaseTestCase(base.TestCase):
diff --git a/tempest/tests/test_decorators.py b/tempest/tests/test_decorators.py
index da5e2d7..4c9a3b7 100644
--- a/tempest/tests/test_decorators.py
+++ b/tempest/tests/test_decorators.py
@@ -22,8 +22,8 @@
 from tempest import config
 from tempest import exceptions
 from tempest import test
-from tempest.tests import base
 from tempest.tests import fake_config
+from tempest.tests.lib import base
 
 
 class BaseDecoratorsTest(base.TestCase):
diff --git a/tempest/tests/test_glance_http.py b/tempest/tests/test_glance_http.py
index f6076ca..fdbc2d2 100644
--- a/tempest/tests/test_glance_http.py
+++ b/tempest/tests/test_glance_http.py
@@ -22,20 +22,15 @@
 
 from tempest.common import glance_http
 from tempest import exceptions
-from tempest.tests import base
 from tempest.tests import fake_auth_provider
-from tempest.tests import fake_http
+from tempest.tests.lib import base
+from tempest.tests.lib import fake_http
 
 
 class TestGlanceHTTPClient(base.TestCase):
 
     def setUp(self):
         super(TestGlanceHTTPClient, self).setUp()
-        self.fake_http = fake_http.fake_httplib2(return_type=200)
-        # NOTE(maurosr): using http here implies that we will be using httplib
-        # directly. With https glance_client would use an httpS version, but
-        # the real backend would still be httplib anyway and since we mock it
-        # that there is no reason to care.
         self.endpoint = 'http://fake_url.com'
         self.fake_auth = fake_auth_provider.FakeAuthProvider()
 
@@ -44,12 +39,12 @@
         self.useFixture(mockpatch.PatchObject(
             httplib.HTTPConnection,
             'request',
-            side_effect=self.fake_http.request(self.endpoint)[1]))
+            side_effect=b'fake_body'))
         self.client = glance_http.HTTPClient(self.fake_auth, {})
 
     def _set_response_fixture(self, header, status, resp_body):
-        resp = fake_http.fake_httplib(header, status=status,
-                                      body=six.StringIO(resp_body))
+        resp = fake_http.fake_http_response(header, status=status,
+                                            body=six.StringIO(resp_body))
         self.useFixture(mockpatch.PatchObject(httplib.HTTPConnection,
                         'getresponse', return_value=resp))
         return resp
@@ -223,7 +218,7 @@
 class TestResponseBodyIterator(base.TestCase):
 
     def test_iter_default_chunk_size_64k(self):
-        resp = fake_http.fake_httplib({}, six.StringIO(
+        resp = fake_http.fake_http_response({}, six.StringIO(
             'X' * (glance_http.CHUNKSIZE + 1)))
         iterator = glance_http.ResponseBodyIterator(resp)
         chunks = list(iterator)
diff --git a/tempest/tests/test_hacking.py b/tempest/tests/test_hacking.py
index aba2aab..6b3aa0d 100644
--- a/tempest/tests/test_hacking.py
+++ b/tempest/tests/test_hacking.py
@@ -13,7 +13,7 @@
 #    under the License.
 
 from tempest.hacking import checks
-from tempest.tests import base
+from tempest.tests.lib import base
 
 
 class HackingTestCase(base.TestCase):
diff --git a/tempest/tests/test_list_tests.py b/tempest/tests/test_list_tests.py
index 38d4c5c..69527b1 100644
--- a/tempest/tests/test_list_tests.py
+++ b/tempest/tests/test_list_tests.py
@@ -17,7 +17,7 @@
 import six
 import subprocess
 
-from tempest.tests import base
+from tempest.tests.lib import base
 
 
 class TestTestList(base.TestCase):
diff --git a/tempest/tests/test_microversions.py b/tempest/tests/test_microversions.py
index cef7975..1ac1232 100644
--- a/tempest/tests/test_microversions.py
+++ b/tempest/tests/test_microversions.py
@@ -18,8 +18,8 @@
 from tempest.api.compute import base as compute_base
 from tempest import config
 from tempest.lib import exceptions
-from tempest.tests import base
 from tempest.tests import fake_config
+from tempest.tests.lib import base
 
 
 class VersionTestNoneTolatest(compute_base.BaseV2ComputeTest):
diff --git a/tempest/tests/test_negative_rest_client.py b/tempest/tests/test_negative_rest_client.py
index ce95739..a1b5f0e 100644
--- a/tempest/tests/test_negative_rest_client.py
+++ b/tempest/tests/test_negative_rest_client.py
@@ -15,15 +15,14 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import httplib2
+import mock
 from oslotest import mockpatch
 
 from tempest.common import negative_rest_client
 from tempest import config
-from tempest.tests import base
 from tempest.tests import fake_auth_provider
 from tempest.tests import fake_config
-from tempest.tests import fake_http
+from tempest.tests.lib import base
 
 
 class TestNegativeRestClient(base.TestCase):
@@ -31,59 +30,69 @@
     url = 'fake_endpoint'
 
     def setUp(self):
-        self.fake_http = fake_http.fake_httplib2()
         super(TestNegativeRestClient, self).setUp()
         self.useFixture(fake_config.ConfigFixture())
         self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
-        self.stubs.Set(httplib2.Http, 'request', self.fake_http.request)
         self.negative_rest_client = negative_rest_client.NegativeRestClient(
             fake_auth_provider.FakeAuthProvider(), None)
         self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
                                               '_log_request'))
 
-    def test_post(self):
+    @mock.patch('tempest.lib.common.rest_client.RestClient.post',
+                return_value=(mock.Mock(), mock.Mock()))
+    def test_post(self, mock_post):
         __, return_dict = self.negative_rest_client.send_request('POST',
                                                                  self.url,
                                                                  [], {})
-        self.assertEqual('POST', return_dict['method'])
+        mock_post.assert_called_once_with(self.url, {})
 
-    def test_get(self):
+    @mock.patch('tempest.lib.common.rest_client.RestClient.get',
+                return_value=(mock.Mock(), mock.Mock()))
+    def test_get(self, mock_get):
         __, return_dict = self.negative_rest_client.send_request('GET',
                                                                  self.url,
                                                                  [])
-        self.assertEqual('GET', return_dict['method'])
+        mock_get.assert_called_once_with(self.url)
 
-    def test_delete(self):
+    @mock.patch('tempest.lib.common.rest_client.RestClient.delete',
+                return_value=(mock.Mock(), mock.Mock()))
+    def test_delete(self, mock_delete):
         __, return_dict = self.negative_rest_client.send_request('DELETE',
                                                                  self.url,
                                                                  [])
-        self.assertEqual('DELETE', return_dict['method'])
+        mock_delete.assert_called_once_with(self.url)
 
-    def test_patch(self):
+    @mock.patch('tempest.lib.common.rest_client.RestClient.patch',
+                return_value=(mock.Mock(), mock.Mock()))
+    def test_patch(self, mock_patch):
         __, return_dict = self.negative_rest_client.send_request('PATCH',
                                                                  self.url,
                                                                  [], {})
-        self.assertEqual('PATCH', return_dict['method'])
+        mock_patch.assert_called_once_with(self.url, {})
 
-    def test_put(self):
+    @mock.patch('tempest.lib.common.rest_client.RestClient.put',
+                return_value=(mock.Mock(), mock.Mock()))
+    def test_put(self, mock_put):
         __, return_dict = self.negative_rest_client.send_request('PUT',
                                                                  self.url,
                                                                  [], {})
-        self.assertEqual('PUT', return_dict['method'])
+        mock_put.assert_called_once_with(self.url, {})
 
-    def test_head(self):
-        self.useFixture(mockpatch.PatchObject(self.negative_rest_client,
-                                              'response_checker'))
+    @mock.patch('tempest.lib.common.rest_client.RestClient.head',
+                return_value=(mock.Mock(), mock.Mock()))
+    def test_head(self, mock_head):
         __, return_dict = self.negative_rest_client.send_request('HEAD',
                                                                  self.url,
                                                                  [])
-        self.assertEqual('HEAD', return_dict['method'])
+        mock_head.assert_called_once_with(self.url)
 
-    def test_copy(self):
+    @mock.patch('tempest.lib.common.rest_client.RestClient.copy',
+                return_value=(mock.Mock(), mock.Mock()))
+    def test_copy(self, mock_copy):
         __, return_dict = self.negative_rest_client.send_request('COPY',
                                                                  self.url,
                                                                  [])
-        self.assertEqual('COPY', return_dict['method'])
+        mock_copy.assert_called_once_with(self.url)
 
     def test_other(self):
         self.assertRaises(AssertionError,
diff --git a/tempest/tests/test_tempest_plugin.py b/tempest/tests/test_tempest_plugin.py
index c07e98c..f66dfc8 100644
--- a/tempest/tests/test_tempest_plugin.py
+++ b/tempest/tests/test_tempest_plugin.py
@@ -14,8 +14,8 @@
 #    under the License.
 
 from tempest.test_discover import plugins
-from tempest.tests import base
 from tempest.tests import fake_tempest_plugin as fake_plugin
+from tempest.tests.lib import base
 
 
 class TestPluginDiscovery(base.TestCase):
diff --git a/tempest/tests/test_wrappers.py b/tempest/tests/test_wrappers.py
index a4ef699..edb9061 100644
--- a/tempest/tests/test_wrappers.py
+++ b/tempest/tests/test_wrappers.py
@@ -19,7 +19,7 @@
 
 import six
 
-from tempest.tests import base
+from tempest.tests.lib import base
 
 DEVNULL = open(os.devnull, 'wb')
 
diff --git a/tools/install_venv.py b/tools/install_venv.py
deleted file mode 100644
index d6d9c8e..0000000
--- a/tools/install_venv.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright 2010 United States Government as represented by the
-# Administrator of the National Aeronautics and Space Administration.
-# All Rights Reserved.
-#
-# Copyright 2010 OpenStack Foundation
-# 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
-#    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 os
-import sys
-
-import install_venv_common as install_venv  # noqa
-
-
-def print_help(venv, root):
-    help = """
-    OpenStack development environment setup is complete.
-
-    OpenStack development uses virtualenv to track and manage Python
-    dependencies while in development and testing.
-
-    To activate the OpenStack virtualenv for the extent of your current shell
-    session you can run:
-
-    $ source %s/bin/activate
-
-    Or, if you prefer, you can run commands in the virtualenv on a case by case
-    basis by running:
-
-    $ %s/tools/with_venv.sh <your command>
-
-    Also, make test will automatically use the virtualenv.
-    """
-    print(help % (venv, root))
-
-
-def main(argv):
-    root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
-
-    if os.environ.get('TOOLS_PATH'):
-        root = os.environ['TOOLS_PATH']
-    venv = os.path.join(root, '.venv')
-    if os.environ.get('VENV'):
-        venv = os.environ['VENV']
-
-    pip_requires = os.path.join(root, 'requirements.txt')
-    test_requires = os.path.join(root, 'test-requirements.txt')
-    py_version = "python%s.%s" % (sys.version_info[0], sys.version_info[1])
-    project = 'Tempest'
-    install = install_venv.InstallVenv(root, venv, pip_requires, test_requires,
-                                       py_version, project)
-    options = install.parse_args(argv)
-    install.check_python_version()
-    install.check_dependencies()
-    install.create_virtualenv(no_site_packages=options.no_site_packages)
-    install.install_dependencies()
-    print_help(venv, root)
-
-if __name__ == '__main__':
-    main(sys.argv)
diff --git a/tools/install_venv_common.py b/tools/install_venv_common.py
deleted file mode 100644
index e279159..0000000
--- a/tools/install_venv_common.py
+++ /dev/null
@@ -1,172 +0,0 @@
-# Copyright 2013 OpenStack Foundation
-# 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
-#    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.
-
-"""Provides methods needed by installation script for OpenStack development
-virtual environments.
-
-Since this script is used to bootstrap a virtualenv from the system's Python
-environment, it should be kept strictly compatible with Python 2.6.
-
-Synced in from openstack-common
-"""
-
-from __future__ import print_function
-
-import optparse
-import os
-import subprocess
-import sys
-
-
-class InstallVenv(object):
-
-    def __init__(self, root, venv, requirements,
-                 test_requirements, py_version,
-                 project):
-        self.root = root
-        self.venv = venv
-        self.requirements = requirements
-        self.test_requirements = test_requirements
-        self.py_version = py_version
-        self.project = project
-
-    def die(self, message, *args):
-        print(message % args, file=sys.stderr)
-        sys.exit(1)
-
-    def check_python_version(self):
-        if sys.version_info < (2, 6):
-            self.die("Need Python Version >= 2.6")
-
-    def run_command_with_code(self, cmd, redirect_output=True,
-                              check_exit_code=True):
-        """Runs a command in an out-of-process shell.
-
-        Returns the output of that command. Working directory is self.root.
-        """
-        if redirect_output:
-            stdout = subprocess.PIPE
-        else:
-            stdout = None
-
-        proc = subprocess.Popen(cmd, cwd=self.root, stdout=stdout)
-        output = proc.communicate()[0]
-        if check_exit_code and proc.returncode != 0:
-            self.die('Command "%s" failed.\n%s', ' '.join(cmd), output)
-        return (output, proc.returncode)
-
-    def run_command(self, cmd, redirect_output=True, check_exit_code=True):
-        return self.run_command_with_code(cmd, redirect_output,
-                                          check_exit_code)[0]
-
-    def get_distro(self):
-        if (os.path.exists('/etc/fedora-release') or
-                os.path.exists('/etc/redhat-release')):
-            return Fedora(
-                self.root, self.venv, self.requirements,
-                self.test_requirements, self.py_version, self.project)
-        else:
-            return Distro(
-                self.root, self.venv, self.requirements,
-                self.test_requirements, self.py_version, self.project)
-
-    def check_dependencies(self):
-        self.get_distro().install_virtualenv()
-
-    def create_virtualenv(self, no_site_packages=True):
-        """Creates the virtual environment and installs PIP.
-
-        Creates the virtual environment and installs PIP only into the
-        virtual environment.
-        """
-        if not os.path.isdir(self.venv):
-            print('Creating venv...', end=' ')
-            if no_site_packages:
-                self.run_command(['virtualenv', '-q', '--no-site-packages',
-                                 self.venv])
-            else:
-                self.run_command(['virtualenv', '-q', self.venv])
-            print('done.')
-        else:
-            print("venv already exists...")
-            pass
-
-    def pip_install(self, *args):
-        self.run_command(['tools/with_venv.sh',
-                         'pip', 'install', '--upgrade'] + list(args),
-                         redirect_output=False)
-
-    def install_dependencies(self):
-        print('Installing dependencies with pip (this can take a while)...')
-
-        # First things first, make sure our venv has the latest pip and
-        # setuptools and pbr
-        self.pip_install('pip>=1.4')
-        self.pip_install('setuptools')
-        self.pip_install('pbr')
-
-        self.pip_install('-r', self.requirements, '-r', self.test_requirements)
-
-    def parse_args(self, argv):
-        """Parses command-line arguments."""
-        parser = optparse.OptionParser()
-        parser.add_option('-n', '--no-site-packages',
-                          action='store_true',
-                          help="Do not inherit packages from global Python "
-                               "install.")
-        return parser.parse_args(argv[1:])[0]
-
-
-class Distro(InstallVenv):
-
-    def check_cmd(self, cmd):
-        return bool(self.run_command(['which', cmd],
-                    check_exit_code=False).strip())
-
-    def install_virtualenv(self):
-        if self.check_cmd('virtualenv'):
-            return
-
-        if self.check_cmd('easy_install'):
-            print('Installing virtualenv via easy_install...', end=' ')
-            if self.run_command(['easy_install', 'virtualenv']):
-                print('Succeeded')
-                return
-            else:
-                print('Failed')
-
-        self.die('ERROR: virtualenv not found.\n\n%s development'
-                 ' requires virtualenv, please install it using your'
-                 ' favorite package management tool' % self.project)
-
-
-class Fedora(Distro):
-    """This covers all Fedora-based distributions.
-
-    Includes: Fedora, RHEL, CentOS, Scientific Linux
-    """
-
-    def check_pkg(self, pkg):
-        return self.run_command_with_code(['rpm', '-q', pkg],
-                                          check_exit_code=False)[1] == 0
-
-    def install_virtualenv(self):
-        if self.check_cmd('virtualenv'):
-            return
-
-        if not self.check_pkg('python-virtualenv'):
-            self.die("Please install 'python-virtualenv'.")
-
-        super(Fedora, self).install_virtualenv()