Ensure the endpoint policy API supports HEAD
This commit makes it so all endpoint policy GET APIs also support HEAD. Change-Id: Ib8eada4847506cc41eeb1e323752473608c38df5 Partial-Bug: 1696574
This commit is contained in:
parent
a83257f756
commit
b272068e52
|
@ -40,7 +40,7 @@ class Routers(wsgi.RoutersBase):
|
||||||
self._add_resource(
|
self._add_resource(
|
||||||
mapper, endpoint_policy_controller,
|
mapper, endpoint_policy_controller,
|
||||||
path='/policies/{policy_id}' + self.PATH_PREFIX + '/endpoints',
|
path='/policies/{policy_id}' + self.PATH_PREFIX + '/endpoints',
|
||||||
get_action='list_endpoints_for_policy',
|
get_head_action='list_endpoints_for_policy',
|
||||||
rel=build_resource_relation(resource_name='policy_endpoints'),
|
rel=build_resource_relation(resource_name='policy_endpoints'),
|
||||||
path_vars={'policy_id': json_home.Parameters.POLICY_ID})
|
path_vars={'policy_id': json_home.Parameters.POLICY_ID})
|
||||||
self._add_resource(
|
self._add_resource(
|
||||||
|
|
|
@ -113,17 +113,16 @@ class EndpointPolicyTestCase(test_v3.RestfulTestCase):
|
||||||
self.assertValidPolicyResponse(r, ref=self.policy)
|
self.assertValidPolicyResponse(r, ref=self.policy)
|
||||||
|
|
||||||
def test_list_endpoints_for_policy(self):
|
def test_list_endpoints_for_policy(self):
|
||||||
"""GET /policies/%(policy_id}/endpoints."""
|
"""GET & HEAD /policies/%(policy_id}/endpoints."""
|
||||||
self.put('/policies/%(policy_id)s/OS-ENDPOINT-POLICY'
|
url = (
|
||||||
'/endpoints/%(endpoint_id)s' % {
|
'/policies/%(policy_id)s/OS-ENDPOINT-POLICY'
|
||||||
'policy_id': self.policy['id'],
|
'/endpoints' % {'policy_id': self.policy['id']}
|
||||||
'endpoint_id': self.endpoint['id']})
|
)
|
||||||
|
self.put(url + '/' + self.endpoint['id'])
|
||||||
r = self.get('/policies/%(policy_id)s/OS-ENDPOINT-POLICY'
|
r = self.get(url)
|
||||||
'/endpoints' % {
|
|
||||||
'policy_id': self.policy['id']})
|
|
||||||
self.assertValidEndpointListResponse(r, ref=self.endpoint)
|
self.assertValidEndpointListResponse(r, ref=self.endpoint)
|
||||||
self.assertThat(r.result.get('endpoints'), matchers.HasLength(1))
|
self.assertThat(r.result.get('endpoints'), matchers.HasLength(1))
|
||||||
|
self.head(url, expected_status=http_client.OK)
|
||||||
|
|
||||||
def test_endpoint_association_cleanup_when_endpoint_deleted(self):
|
def test_endpoint_association_cleanup_when_endpoint_deleted(self):
|
||||||
url = ('/policies/%(policy_id)s/OS-ENDPOINT-POLICY'
|
url = ('/policies/%(policy_id)s/OS-ENDPOINT-POLICY'
|
||||||
|
|
Loading…
Reference in New Issue