summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--keystone/common/wsgi.py3
-rw-r--r--keystone/contrib/ec2/core.py4
-rw-r--r--keystone/test.py7
-rw-r--r--keystone/token/controllers.py10
-rw-r--r--keystone/token/providers/uuid.py4
-rw-r--r--tests/test_backend.py32
-rw-r--r--tests/test_keystoneclient.py2
-rw-r--r--tests/test_token_provider.py1
-rw-r--r--tests/test_v3.py3
-rw-r--r--tests/test_v3_identity.py12
10 files changed, 35 insertions, 43 deletions
diff --git a/keystone/common/wsgi.py b/keystone/common/wsgi.py
index 87636dbe..f47cde13 100644
--- a/keystone/common/wsgi.py
+++ b/keystone/common/wsgi.py
@@ -283,8 +283,7 @@ class Application(BaseApplication):
def assert_admin(self, context):
if not context['is_admin']:
try:
- user_token_ref = self.token_api.get_token(
- token_id=context['token_id'])
+ user_token_ref = self.token_api.get_token(context['token_id'])
except exception.TokenNotFound as e:
raise exception.Unauthorized(e)
diff --git a/keystone/contrib/ec2/core.py b/keystone/contrib/ec2/core.py
index adba7e74..8f72e431 100644
--- a/keystone/contrib/ec2/core.py
+++ b/keystone/contrib/ec2/core.py
@@ -188,9 +188,7 @@ class Ec2Controller(controller.V2Controller):
for role_id in roles]
catalog_ref = self.catalog_api.get_catalog(
- user_id=user_ref['id'],
- tenant_id=tenant_ref['id'],
- metadata=metadata_ref)
+ user_ref['id'], tenant_ref['id'], metadata_ref)
auth_token_data = dict(user=user_ref,
tenant=tenant_ref,
diff --git a/keystone/test.py b/keystone/test.py
index 5d1ad505..9118b2ea 100644
--- a/keystone/test.py
+++ b/keystone/test.py
@@ -272,7 +272,12 @@ class TestCase(NoModule, unittest.TestCase):
# identity driver.
for manager in [identity, assignment, catalog, credential, ec2, policy,
token, token_provider, trust]:
- manager_name = '%s_api' % manager.__name__.split('.')[-1]
+ # manager.__name__ is like keystone.xxx[.yyy],
+ # converted to xxx[_yyy]
+ manager_name = ('%s_api' %
+ manager.__name__.replace('keystone.', '').
+ replace('.', '_'))
+
setattr(self, manager_name, manager.Manager())
dependency.resolve_future_dependencies()
diff --git a/keystone/token/controllers.py b/keystone/token/controllers.py
index d2b7d9fd..9ebc29fe 100644
--- a/keystone/token/controllers.py
+++ b/keystone/token/controllers.py
@@ -91,9 +91,7 @@ class Auth(controller.V2Controller):
if tenant_ref:
catalog_ref = self.catalog_api.get_catalog(
- user_id=user_ref['id'],
- tenant_id=tenant_ref['id'],
- metadata=metadata_ref)
+ user_ref['id'], tenant_ref['id'], metadata_ref)
else:
catalog_ref = {}
@@ -457,9 +455,9 @@ class Auth(controller.V2Controller):
catalog_ref = None
if token_ref.get('tenant'):
catalog_ref = self.catalog_api.get_catalog(
- user_id=token_ref['user']['id'],
- tenant_id=token_ref['tenant']['id'],
- metadata=token_ref['metadata'])
+ token_ref['user']['id'],
+ token_ref['tenant']['id'],
+ token_ref['metadata'])
return Auth.format_endpoint_list(catalog_ref)
diff --git a/keystone/token/providers/uuid.py b/keystone/token/providers/uuid.py
index 94896920..acfa9372 100644
--- a/keystone/token/providers/uuid.py
+++ b/keystone/token/providers/uuid.py
@@ -438,7 +438,7 @@ class Provider(token.provider.Provider):
def _verify_token(self, token_id, belongs_to=None):
"""Verify the given token and return the token_ref."""
- token_ref = self.token_api.get_token(token_id=token_id)
+ token_ref = self.token_api.get_token(token_id)
assert token_ref
if belongs_to:
assert (token_ref['tenant'] and
@@ -518,7 +518,7 @@ class Provider(token.provider.Provider):
catalog_ref = self.catalog_api.get_catalog(
token_ref['user']['id'],
token_ref['tenant']['id'],
- metadata=metadata_ref)
+ metadata_ref)
token_data = self.v2_token_data_helper.get_token_data(
token_ref=token_ref,
roles_ref=role_refs,
diff --git a/tests/test_backend.py b/tests/test_backend.py
index a43e92ae..7e4d820e 100644
--- a/tests/test_backend.py
+++ b/tests/test_backend.py
@@ -118,26 +118,25 @@ class IdentityTests(object):
self.assertEqual(unicode_name, ref['name'])
def test_get_project(self):
- tenant_ref = self.identity_api.get_project(
- tenant_id=self.tenant_bar['id'])
+ tenant_ref = self.identity_api.get_project(self.tenant_bar['id'])
self.assertDictEqual(tenant_ref, self.tenant_bar)
def test_get_project_404(self):
self.assertRaises(exception.ProjectNotFound,
self.identity_api.get_project,
- tenant_id=uuid.uuid4().hex)
+ uuid.uuid4().hex)
def test_get_project_by_name(self):
tenant_ref = self.identity_api.get_project_by_name(
- tenant_name=self.tenant_bar['name'],
- domain_id=DEFAULT_DOMAIN_ID)
+ self.tenant_bar['name'],
+ DEFAULT_DOMAIN_ID)
self.assertDictEqual(tenant_ref, self.tenant_bar)
def test_get_project_by_name_404(self):
self.assertRaises(exception.ProjectNotFound,
self.identity_api.get_project_by_name,
- tenant_name=uuid.uuid4().hex,
- domain_id=DEFAULT_DOMAIN_ID)
+ uuid.uuid4().hex,
+ DEFAULT_DOMAIN_ID)
def test_get_project_users(self):
tenant_ref = self.identity_api.get_project_users(self.tenant_baz['id'])
@@ -152,10 +151,10 @@ class IdentityTests(object):
def test_get_project_users_404(self):
self.assertRaises(exception.ProjectNotFound,
self.identity_api.get_project_users,
- tenant_id=uuid.uuid4().hex)
+ uuid.uuid4().hex)
def test_get_user(self):
- user_ref = self.identity_api.get_user(user_id=self.user_foo['id'])
+ user_ref = self.identity_api.get_user(self.user_foo['id'])
# NOTE(termie): the password field is left in user_foo to make
# it easier to authenticate in tests, but should
# not be returned by the api
@@ -165,12 +164,12 @@ class IdentityTests(object):
def test_get_user_404(self):
self.assertRaises(exception.UserNotFound,
self.identity_api.get_user,
- user_id=uuid.uuid4().hex)
+ uuid.uuid4().hex)
def test_get_user_by_name(self):
user_ref = self.identity_api.get_user_by_name(
- user_name=self.user_foo['name'],
- domain_id=DEFAULT_DOMAIN_ID)
+ self.user_foo['name'], DEFAULT_DOMAIN_ID)
+
# NOTE(termie): the password field is left in user_foo to make
# it easier to authenticate in tests, but should
# not be returned by the api
@@ -180,19 +179,18 @@ class IdentityTests(object):
def test_get_user_by_name_404(self):
self.assertRaises(exception.UserNotFound,
self.identity_api.get_user_by_name,
- user_name=uuid.uuid4().hex,
- domain_id=DEFAULT_DOMAIN_ID)
+ uuid.uuid4().hex,
+ DEFAULT_DOMAIN_ID)
def test_get_role(self):
- role_ref = self.identity_api.get_role(
- role_id=self.role_admin['id'])
+ role_ref = self.identity_api.get_role(self.role_admin['id'])
role_ref_dict = dict((x, role_ref[x]) for x in role_ref)
self.assertDictEqual(role_ref_dict, self.role_admin)
def test_get_role_404(self):
self.assertRaises(exception.RoleNotFound,
self.identity_api.get_role,
- role_id=uuid.uuid4().hex)
+ uuid.uuid4().hex)
def test_create_duplicate_role_name_fails(self):
role = {'id': 'fake1',
diff --git a/tests/test_keystoneclient.py b/tests/test_keystoneclient.py
index a26d6595..38062d4b 100644
--- a/tests/test_keystoneclient.py
+++ b/tests/test_keystoneclient.py
@@ -18,7 +18,6 @@ import uuid
import webob
from keystone import test
-from keystone import token
from keystone import config
from keystone.openstack.common import jsonutils
@@ -40,7 +39,6 @@ class CompatTestCase(test.TestCase):
# started because the servers use the backends.
self.load_backends()
- self.token_provider_api = token.provider.Manager()
self.load_fixtures(default_fixtures)
# TODO(termie): add an admin user to the fixtures and use that user
diff --git a/tests/test_token_provider.py b/tests/test_token_provider.py
index ac0b0d6b..a7e92717 100644
--- a/tests/test_token_provider.py
+++ b/tests/test_token_provider.py
@@ -333,7 +333,6 @@ class TestTokenProvider(test.TestCase):
def setUp(self):
super(TestTokenProvider, self).setUp()
self.load_backends()
- self.token_provider_api = token.provider.Manager()
def test_get_token_version(self):
self.assertEqual(
diff --git a/tests/test_v3.py b/tests/test_v3.py
index 60a52d69..4f00de7d 100644
--- a/tests/test_v3.py
+++ b/tests/test_v3.py
@@ -5,7 +5,6 @@ from lxml import etree
import webtest
from keystone import test
-from keystone import token
from keystone import auth
from keystone.common import serializer
@@ -45,8 +44,6 @@ class RestfulTestCase(test_content_types.RestfulTestCase):
test.setup_test_database()
self.load_backends()
- self.token_provider_api = token.provider.Manager()
-
self.public_app = webtest.TestApp(
self.loadapp('keystone', name='main'))
self.admin_app = webtest.TestApp(
diff --git a/tests/test_v3_identity.py b/tests/test_v3_identity.py
index 891f0c6a..f1e19c42 100644
--- a/tests/test_v3_identity.py
+++ b/tests/test_v3_identity.py
@@ -270,19 +270,19 @@ class IdentityTestCase(test_v3.RestfulTestCase):
# Check all the domain2 relevant entities are gone
self.assertRaises(exception.DomainNotFound,
self.identity_api.get_domain,
- domain_id=self.domain2['id'])
+ self.domain2['id'])
self.assertRaises(exception.ProjectNotFound,
self.identity_api.get_project,
- tenant_id=self.project2['id'])
+ self.project2['id'])
self.assertRaises(exception.GroupNotFound,
self.identity_api.get_group,
- group_id=self.group2['id'])
+ self.group2['id'])
self.assertRaises(exception.UserNotFound,
self.identity_api.get_user,
- user_id=self.user2['id'])
+ self.user2['id'])
self.assertRaises(exception.CredentialNotFound,
self.credential_api.get_credential,
- credential_id=self.credential2['id'])
+ self.credential2['id'])
# ...and that all self.domain entities are still here
r = self.identity_api.get_domain(self.domain['id'])
@@ -523,7 +523,7 @@ class IdentityTestCase(test_v3.RestfulTestCase):
# that reference this project
self.assertRaises(exception.CredentialNotFound,
self.credential_api.get_credential,
- credential_id=self.credential['id'])
+ self.credential['id'])
# And the no tokens we remain valid
tokens = self.token_api.list_tokens(self.user['id'])
self.assertEquals(len(tokens), 0)