diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-08-02 07:14:15 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-08-02 07:14:15 +0000 |
commit | 7cc361371ee06d592b1094038287fab6d02db19d (patch) | |
tree | ac53e5d3dcc398b2d5e22523c963dd7c1d5e527d | |
parent | 61ec0bd3e490d6e72fc6e49987eed217385073cf (diff) | |
parent | 7ac3d4e4543ed7b540fe60db9b222b179ea301b7 (diff) | |
download | keystone-7cc361371ee06d592b1094038287fab6d02db19d.tar.gz keystone-7cc361371ee06d592b1094038287fab6d02db19d.tar.xz keystone-7cc361371ee06d592b1094038287fab6d02db19d.zip |
Merge "add OS-TRUST to links"
-rw-r--r-- | keystone/trust/controllers.py | 18 | ||||
-rw-r--r-- | tests/test_auth.py | 4 |
2 files changed, 20 insertions, 2 deletions
diff --git a/keystone/trust/controllers.py b/keystone/trust/controllers.py index 7be6e8fd..7a94fe29 100644 --- a/keystone/trust/controllers.py +++ b/keystone/trust/controllers.py @@ -35,6 +35,21 @@ class TrustV3(controller.V3Controller): collection_name = "trusts" member_name = "trust" + @classmethod + def base_url(cls, path=None): + endpoint = CONF.public_endpoint % CONF + + # allow a missing trailing slash in the config + if endpoint[-1] != '/': + endpoint += '/' + + url = endpoint + 'v3/OS-TRUST' + + if path: + return url + path + else: + return url + '/' + cls.collection_name + def _get_user_id(self, context): if 'token_id' in context: token_id = context['token_id'] @@ -78,8 +93,7 @@ class TrustV3(controller.V3Controller): trust_full_roles.append(full_role) trust['roles'] = trust_full_roles trust['roles_links'] = { - 'self': (CONF.public_endpoint % CONF + - "trusts/%s/roles" % trust['id']), + 'self': (self.base_url() + "/%s/roles" % trust['id']), 'next': None, 'previous': None} diff --git a/tests/test_auth.py b/tests/test_auth.py index 1416269b..db5314be 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -618,6 +618,10 @@ class AuthWithTrust(AuthTest): role_ids = [self.role_browser['id'], self.role_member['id']] self.assertTrue(timeutils.parse_strtime(self.new_trust['expires_at'], fmt=TIME_FORMAT)) + self.assertIn('http://localhost:5000/v3/OS-TRUST/', + self.new_trust['links']['self']) + self.assertIn('http://localhost:5000/v3/OS-TRUST/', + self.new_trust['roles_links']['self']) for role in self.new_trust['roles']: self.assertIn(role['id'], role_ids) |