diff --git a/keystoneauth1/discover.py b/keystoneauth1/discover.py index 15faeec9..c09e0018 100644 --- a/keystoneauth1/discover.py +++ b/keystoneauth1/discover.py @@ -115,12 +115,12 @@ def normalize_version_number(version): def _normalize_version_args(version, min_version, max_version): if version and (min_version or max_version): - raise TypeError( + raise ValueError( "version is mutually exclusive with min_version and" " max_version") if min_version == 'latest' and max_version not in ( None, 'latest'): - raise TypeError( + raise ValueError( "min_version is 'latest' and max_version is {max_version}" " but is only allowed to be 'latest' or None".format( max_version=max_version)) @@ -872,7 +872,8 @@ class EndpointData(object): :param bool allow_version_hack: Whether or not to allow version hacks to be applied. (defaults to True) - :returns: A potential unversioned url + :returns: A url that has been transformed by the regex hacks that + match the service_type. """ return _VERSION_HACKS.get_discover_hack(self.service_type, self.url) diff --git a/keystoneauth1/tests/unit/identity/test_identity_common.py b/keystoneauth1/tests/unit/identity/test_identity_common.py index 9c18a33b..fd08e53e 100644 --- a/keystoneauth1/tests/unit/identity/test_identity_common.py +++ b/keystoneauth1/tests/unit/identity/test_identity_common.py @@ -279,9 +279,6 @@ class CommonIdentityTests(object): resps = [{'json': self.TEST_DISCOVERY}, {'status_code': 500}] self.requests_mock.get(self.TEST_COMPUTE_ADMIN, resps) - body = 'SUCCESS' - self.stub_url('GET', ['path'], text=body) - # now either of the two sessions I use, it should not cause a second # request to the discovery url. Calling discovery directly should also # not cause an additional request. @@ -561,9 +558,6 @@ class CommonIdentityTests(object): resps = [{'json': disc}, {'status_code': 500}] self.requests_mock.get(self.TEST_COMPUTE_ADMIN, resps) - body = 'SUCCESS' - self.stub_url('GET', ['path'], text=body) - a = self.create_auth_plugin() s = session.Session(auth=a) @@ -620,9 +614,6 @@ class CommonIdentityTests(object): href=self.TEST_VOLUME.versions['v2'].discovery.public, id='v2.0', status='SUPPORTED') - body = 'SUCCESS' - self.stub_url('GET', ['path'], text=body) - a = self.create_auth_plugin() s = session.Session(auth=a) @@ -690,9 +681,6 @@ class CommonIdentityTests(object): href=self.TEST_VOLUME.versions['v2'].discovery.public, id='v2.0', status='SUPPORTED') - body = 'SUCCESS' - self.stub_url('GET', ['path'], text=body) - a = self.create_auth_plugin() s = session.Session(auth=a) @@ -754,10 +742,6 @@ class CommonIdentityTests(object): expired_token = self.get_auth_data(expires=expires) expired_auth_ref = access.create(body=expired_token) - body = 'SUCCESS' - self.stub_url('GET', ['path'], - base_url=self.TEST_COMPUTE_ADMIN, text=body) - a = self.create_auth_plugin(**kwargs) a.auth_ref = expired_auth_ref return a @@ -1269,7 +1253,7 @@ class CatalogHackTests(utils.TestCase): max_version='latest') self.assertEqual(self.V3_URL, endpoint) - self.assertRaises(TypeError, sess.get_endpoint, + self.assertRaises(ValueError, sess.get_endpoint, service_type=self.IDENTITY, min_version='latest', max_version='3.0') @@ -1355,7 +1339,7 @@ class CatalogHackTests(utils.TestCase): self.assertEqual(self.V3_URL, endpoint) v2_m, common_m = stub_urls() - self.assertRaises(TypeError, sess.get_endpoint, + self.assertRaises(ValueError, sess.get_endpoint, service_type=self.IDENTITY, version=3, min_version='2')