summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-01-26 14:55:03 +0000
committerGerrit Code Review <review@openstack.org>2016-01-26 14:55:03 +0000
commitef27fd2d10765d48e2911e380342fc73690ce829 (patch)
tree691fad879102a82dfb847f78b1979e40a5d3bd5a
parent92d6a26bb658a775fb2a23a7f8913a245531e33d (diff)
parent4725111e18a6b10e702c7ccd9cdfc1f6936fc19c (diff)
downloadtempest-lib-ef27fd2d10765d48e2911e380342fc73690ce829.tar.gz
Merge "Raise IdentityError if auth_url doesn't exist"
-rw-r--r--tempest_lib/services/identity/v2/token_client.py3
-rw-r--r--tempest_lib/services/identity/v3/token_client.py3
-rw-r--r--tempest_lib/tests/services/identity/v2/test_token_client.py5
-rw-r--r--tempest_lib/tests/services/identity/v3/test_token_client.py5
4 files changed, 16 insertions, 0 deletions
diff --git a/tempest_lib/services/identity/v2/token_client.py b/tempest_lib/services/identity/v2/token_client.py
index 621f8b3..10c437c 100644
--- a/tempest_lib/services/identity/v2/token_client.py
+++ b/tempest_lib/services/identity/v2/token_client.py
@@ -28,6 +28,9 @@ class TokenClient(rest_client.RestClient):
None, None, None, disable_ssl_certificate_validation=dscv,
ca_certs=ca_certs, trace_requests=trace_requests)
+ if auth_url is None:
+ raise exceptions.IdentityError("Couldn't determine auth_url")
+
# Normalize URI to ensure /tokens is in it.
if 'tokens' not in auth_url:
auth_url = auth_url.rstrip('/') + '/tokens'
diff --git a/tempest_lib/services/identity/v3/token_client.py b/tempest_lib/services/identity/v3/token_client.py
index 5fb64d3..504b165 100644
--- a/tempest_lib/services/identity/v3/token_client.py
+++ b/tempest_lib/services/identity/v3/token_client.py
@@ -28,6 +28,9 @@ class V3TokenClient(rest_client.RestClient):
None, None, None, disable_ssl_certificate_validation=dscv,
ca_certs=ca_certs, trace_requests=trace_requests)
+ if auth_url is None:
+ raise exceptions.IdentityError("Couldn't determine auth_url")
+
if 'auth/tokens' not in auth_url:
auth_url = auth_url.rstrip('/') + '/auth/tokens'
diff --git a/tempest_lib/tests/services/identity/v2/test_token_client.py b/tempest_lib/tests/services/identity/v2/test_token_client.py
index cc309c7..f75bef8 100644
--- a/tempest_lib/tests/services/identity/v2/test_token_client.py
+++ b/tempest_lib/tests/services/identity/v2/test_token_client.py
@@ -18,6 +18,7 @@ import httplib2
from oslotest import mockpatch
from tempest_lib.common import rest_client
+from tempest_lib import exceptions
from tempest_lib.services.identity.v2 import token_client
from tempest_lib.tests import base
from tempest_lib.tests import fake_http
@@ -29,6 +30,10 @@ class TestTokenClientV2(base.TestCase):
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,
+ token_client.TokenClient, None)
+
def test_auth(self):
token_client_v2 = token_client.TokenClient('fake_url')
post_mock = self.useFixture(mockpatch.PatchObject(
diff --git a/tempest_lib/tests/services/identity/v3/test_token_client.py b/tempest_lib/tests/services/identity/v3/test_token_client.py
index 4ff3109..ed82b87 100644
--- a/tempest_lib/tests/services/identity/v3/test_token_client.py
+++ b/tempest_lib/tests/services/identity/v3/test_token_client.py
@@ -18,6 +18,7 @@ import httplib2
from oslotest import mockpatch
from tempest_lib.common import rest_client
+from tempest_lib import exceptions
from tempest_lib.services.identity.v3 import token_client
from tempest_lib.tests import base
from tempest_lib.tests import fake_http
@@ -29,6 +30,10 @@ class TestTokenClientV2(base.TestCase):
super(TestTokenClientV2, self).setUp()
self.fake_201_http = fake_http.fake_httplib2(return_type=201)
+ def test_init_without_authurl(self):
+ self.assertRaises(exceptions.IdentityError,
+ token_client.V3TokenClient, None)
+
def test_auth(self):
token_client_v3 = token_client.V3TokenClient('fake_url')
post_mock = self.useFixture(mockpatch.PatchObject(