Merge "Ensure the trust API supports HEAD requests"
This commit is contained in:
commit
8badbabd6a
|
@ -112,28 +112,44 @@ class TestTrustOperations(test_v3.RestfulTestCase):
|
||||||
self.assertValidTrustResponse(r, ref)
|
self.assertValidTrustResponse(r, ref)
|
||||||
|
|
||||||
# list all trusts
|
# list all trusts
|
||||||
r = self.get('/OS-TRUST/trusts')
|
list_url = '/OS-TRUST/trusts'
|
||||||
|
r = self.get(list_url)
|
||||||
|
self.head(list_url, expected_status=http_client.OK)
|
||||||
trusts = r.result['trusts']
|
trusts = r.result['trusts']
|
||||||
self.assertEqual(3, len(trusts))
|
self.assertEqual(3, len(trusts))
|
||||||
self.assertValidTrustListResponse(r)
|
self.assertValidTrustListResponse(r)
|
||||||
|
|
||||||
# list all trusts for the trustor
|
# list all trusts for the trustor
|
||||||
r = self.get('/OS-TRUST/trusts?trustor_user_id=%s' %
|
list_for_trustor_url = (
|
||||||
self.user_id)
|
'/OS-TRUST/trusts?trustor_user_id=%s' % self.user_id
|
||||||
|
)
|
||||||
|
r = self.get(list_for_trustor_url)
|
||||||
|
self.head(list_for_trustor_url, expected_status=http_client.OK)
|
||||||
trusts = r.result['trusts']
|
trusts = r.result['trusts']
|
||||||
self.assertEqual(3, len(trusts))
|
self.assertEqual(3, len(trusts))
|
||||||
self.assertValidTrustListResponse(r)
|
self.assertValidTrustListResponse(r)
|
||||||
|
|
||||||
# list all trusts as the trustor as the trustee.
|
# list all trusts as the trustor as the trustee.
|
||||||
r = self.get('/OS-TRUST/trusts?trustee_user_id=%s' %
|
list_as_trustor_url = (
|
||||||
self.user_id)
|
'/OS-TRUST/trusts?trustee_user_id=%s' % self.user_id
|
||||||
|
)
|
||||||
|
r = self.get(list_as_trustor_url)
|
||||||
|
self.head(list_as_trustor_url, expected_status=http_client.OK)
|
||||||
trusts = r.result['trusts']
|
trusts = r.result['trusts']
|
||||||
self.assertEqual(0, len(trusts))
|
self.assertEqual(0, len(trusts))
|
||||||
|
|
||||||
# list all trusts as the trustee is forbidden
|
# list all trusts as the trustee is forbidden
|
||||||
r = self.get('/OS-TRUST/trusts?trustee_user_id=%s' %
|
list_all_as_trustee_url = (
|
||||||
self.trustee_user_id,
|
'/OS-TRUST/trusts?trustee_user_id=%s' % self.trustee_user_id
|
||||||
expected_status=http_client.FORBIDDEN)
|
)
|
||||||
|
r = self.get(
|
||||||
|
list_all_as_trustee_url,
|
||||||
|
expected_status=http_client.FORBIDDEN
|
||||||
|
)
|
||||||
|
self.head(
|
||||||
|
list_all_as_trustee_url,
|
||||||
|
expected_status=http_client.FORBIDDEN
|
||||||
|
)
|
||||||
|
|
||||||
def test_delete_trust(self):
|
def test_delete_trust(self):
|
||||||
# create a trust
|
# create a trust
|
||||||
|
|
|
@ -36,13 +36,13 @@ class Routers(wsgi.RoutersBase):
|
||||||
self._add_resource(
|
self._add_resource(
|
||||||
mapper, trust_controller,
|
mapper, trust_controller,
|
||||||
path='/OS-TRUST/trusts',
|
path='/OS-TRUST/trusts',
|
||||||
get_action='list_trusts',
|
get_head_action='list_trusts',
|
||||||
post_action='create_trust',
|
post_action='create_trust',
|
||||||
rel=_build_resource_relation(resource_name='trusts'))
|
rel=_build_resource_relation(resource_name='trusts'))
|
||||||
self._add_resource(
|
self._add_resource(
|
||||||
mapper, trust_controller,
|
mapper, trust_controller,
|
||||||
path='/OS-TRUST/trusts/{trust_id}',
|
path='/OS-TRUST/trusts/{trust_id}',
|
||||||
get_action='get_trust',
|
get_head_action='get_trust',
|
||||||
delete_action='delete_trust',
|
delete_action='delete_trust',
|
||||||
rel=_build_resource_relation(resource_name='trust'),
|
rel=_build_resource_relation(resource_name='trust'),
|
||||||
path_vars={
|
path_vars={
|
||||||
|
@ -51,7 +51,7 @@ class Routers(wsgi.RoutersBase):
|
||||||
self._add_resource(
|
self._add_resource(
|
||||||
mapper, trust_controller,
|
mapper, trust_controller,
|
||||||
path='/OS-TRUST/trusts/{trust_id}/roles',
|
path='/OS-TRUST/trusts/{trust_id}/roles',
|
||||||
get_action='list_roles_for_trust',
|
get_head_action='list_roles_for_trust',
|
||||||
rel=_build_resource_relation(resource_name='trust_roles'),
|
rel=_build_resource_relation(resource_name='trust_roles'),
|
||||||
path_vars={
|
path_vars={
|
||||||
'trust_id': TRUST_ID_PARAMETER_RELATION,
|
'trust_id': TRUST_ID_PARAMETER_RELATION,
|
||||||
|
|
Loading…
Reference in New Issue