Remove imports of http module
http module will be moved to tempest-lib, and it will be used only
for rest-client module as an internal module.
This patch replaces imports of http module for doing the above.
Change-Id: I8e440b91fee8aa4c7284a49603f9ad99c221182d
diff --git a/tempest/tests/common/test_accounts.py b/tempest/tests/common/test_accounts.py
index cf7ce65..0800b47 100644
--- a/tempest/tests/common/test_accounts.py
+++ b/tempest/tests/common/test_accounts.py
@@ -22,9 +22,9 @@
from tempest import auth
from tempest.common import accounts
-from tempest.common import http
from tempest import config
from tempest import exceptions
+from tempest.services.identity.json import identity_client
from tempest.tests import base
from tempest.tests import fake_config
from tempest.tests import fake_identity
@@ -68,7 +68,7 @@
return hash_list
def test_get_hash(self):
- self.stubs.Set(http.ClosingHttp, 'request',
+ self.stubs.Set(identity_client.TokenClientJSON, 'raw_request',
fake_identity._fake_v2_response)
test_account_class = accounts.Accounts('test_name')
hash_list = self._get_hash_list(self.test_accounts)
diff --git a/tempest/tests/test_auth.py b/tempest/tests/test_auth.py
index 6a2e335..fc05198 100644
--- a/tempest/tests/test_auth.py
+++ b/tempest/tests/test_auth.py
@@ -19,9 +19,10 @@
from oslotest import mockpatch
from tempest import auth
-from tempest.common import http
from tempest import config
from tempest import exceptions
+from tempest.services.identity.json import identity_client as v2_client
+from tempest.services.identity.v3.json import identity_client as v3_client
from tempest.tests import base
from tempest.tests import fake_auth_provider
from tempest.tests import fake_config
@@ -45,7 +46,6 @@
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(http.ClosingHttp, 'request', self.fake_http.request)
self.stubs.Set(auth, 'get_credentials',
fake_auth_provider.get_credentials)
self.stubs.Set(auth, 'get_default_credentials',
@@ -125,7 +125,7 @@
def setUp(self):
super(TestKeystoneV2AuthProvider, self).setUp()
- self.stubs.Set(http.ClosingHttp, 'request',
+ self.stubs.Set(v2_client.TokenClientJSON, 'raw_request',
fake_identity._fake_v2_response)
self.target_url = 'test_api'
@@ -346,7 +346,7 @@
def setUp(self):
super(TestKeystoneV3AuthProvider, self).setUp()
- self.stubs.Set(http.ClosingHttp, 'request',
+ self.stubs.Set(v3_client.V3TokenClientJSON, 'raw_request',
fake_identity._fake_v3_response)
def _get_fake_alt_identity(self):
diff --git a/tempest/tests/test_credentials.py b/tempest/tests/test_credentials.py
index aa3df36..1abb941 100644
--- a/tempest/tests/test_credentials.py
+++ b/tempest/tests/test_credentials.py
@@ -18,10 +18,11 @@
from oslo.config import cfg
from tempest import auth
-from tempest.common import http
from tempest.common import tempest_fixtures as fixtures
from tempest import config
from tempest import exceptions
+from tempest.services.identity.json import identity_client as v2_client
+from tempest.services.identity.v3.json import identity_client as v3_client
from tempest.tests import base
from tempest.tests import fake_config
from tempest.tests import fake_identity
@@ -76,10 +77,12 @@
identity_response = fake_identity._fake_v2_response
credentials_class = auth.KeystoneV2Credentials
+ tokenclient_class = v2_client.TokenClientJSON
def setUp(self):
super(KeystoneV2CredentialsTests, self).setUp()
- self.stubs.Set(http.ClosingHttp, 'request', self.identity_response)
+ self.stubs.Set(self.tokenclient_class, 'raw_request',
+ self.identity_response)
def _verify_credentials(self, credentials_class, filled=True,
creds_dict=None):
@@ -185,6 +188,7 @@
credentials_class = auth.KeystoneV3Credentials
identity_response = fake_identity._fake_v3_response
+ tokenclient_class = v3_client.V3TokenClientJSON
def setUp(self):
super(KeystoneV3CredentialsTests, self).setUp()
diff --git a/tempest/tests/test_tenant_isolation.py b/tempest/tests/test_tenant_isolation.py
index 994b4a2..d058fd9 100644
--- a/tempest/tests/test_tenant_isolation.py
+++ b/tempest/tests/test_tenant_isolation.py
@@ -15,7 +15,6 @@
import mock
from oslo.config import cfg
-from tempest.common import http
from tempest.common import isolated_creds
from tempest.common import rest_client
from tempest import config
@@ -36,7 +35,7 @@
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(http.ClosingHttp, 'request',
+ self.stubs.Set(json_iden_client.TokenClientJSON, 'raw_request',
fake_identity._fake_v2_response)
cfg.CONF.set_default('operator_role', 'FakeRole',
group='object-storage')