diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-10-14 14:10:27 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-10-14 14:10:27 +0000 |
| commit | 3c8f1276a2f874f3fcaf7db08761d79bd013cf28 (patch) | |
| tree | 2f62081bef16cf57fa965434725198e703670b62 /keystoneclient/tests | |
| parent | 090e2c8e2839cea0528a494d0017643c64d53f03 (diff) | |
| parent | 5b91fedd650613f7ba480039fca7df83c1ff6bed (diff) | |
| download | python-keystoneclient-3c8f1276a2f874f3fcaf7db08761d79bd013cf28.tar.gz | |
Merge "Use exceptions from Keystoneauth"
Diffstat (limited to 'keystoneclient/tests')
| -rw-r--r-- | keystoneclient/tests/unit/test_utils.py | 14 | ||||
| -rw-r--r-- | keystoneclient/tests/unit/v2_0/test_tenants.py | 2 | ||||
| -rw-r--r-- | keystoneclient/tests/unit/v2_0/test_tokens.py | 2 | ||||
| -rw-r--r-- | keystoneclient/tests/unit/v3/test_federation.py | 2 | ||||
| -rw-r--r-- | keystoneclient/tests/unit/v3/test_projects.py | 10 | ||||
| -rw-r--r-- | keystoneclient/tests/unit/v3/test_tokens.py | 2 |
6 files changed, 18 insertions, 14 deletions
diff --git a/keystoneclient/tests/unit/test_utils.py b/keystoneclient/tests/unit/test_utils.py index da51e7f..0144331 100644 --- a/keystoneclient/tests/unit/test_utils.py +++ b/keystoneclient/tests/unit/test_utils.py @@ -10,11 +10,13 @@ # License for the specific language governing permissions and limitations # under the License. +from keystoneauth1 import exceptions as ksa_exceptions import six import testresources from testtools import matchers -from keystoneclient import exceptions + +from keystoneclient import exceptions as ksc_exceptions from keystoneclient.tests.unit import client_fixtures from keystoneclient.tests.unit import utils as test_utils from keystoneclient import utils @@ -39,16 +41,16 @@ class FakeManager(object): try: return self.resources[str(resource_id)] except KeyError: - raise exceptions.NotFound(resource_id) + raise ksa_exceptions.NotFound(resource_id) def find(self, name=None): if name == '9999': # NOTE(morganfainberg): special case that raises NoUniqueMatch. - raise exceptions.NoUniqueMatch() + raise ksc_exceptions.NoUniqueMatch() for resource_id, resource in self.resources.items(): if resource['name'] == str(name): return resource - raise exceptions.NotFound(name) + raise ksa_exceptions.NotFound(name) class FindResourceTestCase(test_utils.TestCase): @@ -58,7 +60,7 @@ class FindResourceTestCase(test_utils.TestCase): self.manager = FakeManager() def test_find_none(self): - self.assertRaises(exceptions.CommandError, + self.assertRaises(ksc_exceptions.CommandError, utils.find_resource, self.manager, 'asdf') @@ -90,7 +92,7 @@ class FindResourceTestCase(test_utils.TestCase): self.assertEqual(output, self.manager.resources['5678']) def test_find_no_unique_match(self): - self.assertRaises(exceptions.CommandError, + self.assertRaises(ksc_exceptions.CommandError, utils.find_resource, self.manager, 9999) diff --git a/keystoneclient/tests/unit/v2_0/test_tenants.py b/keystoneclient/tests/unit/v2_0/test_tenants.py index 0187d57..5e78aa3 100644 --- a/keystoneclient/tests/unit/v2_0/test_tenants.py +++ b/keystoneclient/tests/unit/v2_0/test_tenants.py @@ -12,9 +12,9 @@ import uuid +from keystoneauth1 import exceptions from keystoneauth1 import fixture -from keystoneclient import exceptions from keystoneclient.tests.unit.v2_0 import utils from keystoneclient.v2_0 import client from keystoneclient.v2_0 import tenants diff --git a/keystoneclient/tests/unit/v2_0/test_tokens.py b/keystoneclient/tests/unit/v2_0/test_tokens.py index 2b6823f..58df7c2 100644 --- a/keystoneclient/tests/unit/v2_0/test_tokens.py +++ b/keystoneclient/tests/unit/v2_0/test_tokens.py @@ -12,10 +12,10 @@ import uuid +from keystoneauth1 import exceptions from keystoneauth1 import fixture from keystoneclient import access -from keystoneclient import exceptions from keystoneclient.tests.unit.v2_0 import utils from keystoneclient.v2_0 import client from keystoneclient.v2_0 import tokens diff --git a/keystoneclient/tests/unit/v3/test_federation.py b/keystoneclient/tests/unit/v3/test_federation.py index ceefae7..a760ed7 100644 --- a/keystoneclient/tests/unit/v3/test_federation.py +++ b/keystoneclient/tests/unit/v3/test_federation.py @@ -13,6 +13,7 @@ import copy import uuid +from keystoneauth1 import exceptions from keystoneauth1 import fixture from keystoneauth1.identity import v3 from keystoneauth1 import session @@ -21,7 +22,6 @@ import six from testtools import matchers from keystoneclient import access -from keystoneclient import exceptions from keystoneclient.tests.unit.v3 import utils from keystoneclient.v3 import client from keystoneclient.v3.contrib.federation import base diff --git a/keystoneclient/tests/unit/v3/test_projects.py b/keystoneclient/tests/unit/v3/test_projects.py index 8bd6fd5..48477ed 100644 --- a/keystoneclient/tests/unit/v3/test_projects.py +++ b/keystoneclient/tests/unit/v3/test_projects.py @@ -12,7 +12,9 @@ import uuid -from keystoneclient import exceptions +from keystoneauth1 import exceptions as ksa_exceptions + +from keystoneclient import exceptions as ksc_exceptions from keystoneclient.tests.unit.v3 import utils from keystoneclient.v3 import projects @@ -284,7 +286,7 @@ class ProjectTests(utils.ClientTestCase, utils.CrudTests): def test_get_with_invalid_parameters_combination(self): # subtree_as_list and subtree_as_ids can not be included at the # same time in the call. - self.assertRaises(exceptions.ValidationError, + self.assertRaises(ksc_exceptions.ValidationError, self.manager.get, project=uuid.uuid4().hex, subtree_as_list=True, @@ -292,7 +294,7 @@ class ProjectTests(utils.ClientTestCase, utils.CrudTests): # parents_as_list and parents_as_ids can not be included at the # same time in the call. - self.assertRaises(exceptions.ValidationError, + self.assertRaises(ksc_exceptions.ValidationError, self.manager.get, project=uuid.uuid4().hex, parents_as_list=True, @@ -308,5 +310,5 @@ class ProjectTests(utils.ClientTestCase, utils.CrudTests): # NOTE(rodrigods): this is the expected behaviour of the Identity # server, a different implementation might not fail this request. - self.assertRaises(exceptions.Forbidden, self.manager.update, + self.assertRaises(ksa_exceptions.Forbidden, self.manager.update, ref['id'], **utils.parameterize(req_ref)) diff --git a/keystoneclient/tests/unit/v3/test_tokens.py b/keystoneclient/tests/unit/v3/test_tokens.py index 7c82d37..0208f53 100644 --- a/keystoneclient/tests/unit/v3/test_tokens.py +++ b/keystoneclient/tests/unit/v3/test_tokens.py @@ -12,10 +12,10 @@ import uuid +from keystoneauth1 import exceptions import testresources from keystoneclient import access -from keystoneclient import exceptions from keystoneclient.tests.unit import client_fixtures from keystoneclient.tests.unit.v3 import utils |
