diff --git a/keystone/endpoint_policy/routers.py b/keystone/endpoint_policy/routers.py index 4846bb1807..a3a9e2556a 100644 --- a/keystone/endpoint_policy/routers.py +++ b/keystone/endpoint_policy/routers.py @@ -40,7 +40,7 @@ class Routers(wsgi.RoutersBase): self._add_resource( mapper, endpoint_policy_controller, 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'), path_vars={'policy_id': json_home.Parameters.POLICY_ID}) self._add_resource( diff --git a/keystone/tests/unit/test_v3_endpoint_policy.py b/keystone/tests/unit/test_v3_endpoint_policy.py index f5b45fb60b..785db8d50f 100644 --- a/keystone/tests/unit/test_v3_endpoint_policy.py +++ b/keystone/tests/unit/test_v3_endpoint_policy.py @@ -113,17 +113,16 @@ class EndpointPolicyTestCase(test_v3.RestfulTestCase): self.assertValidPolicyResponse(r, ref=self.policy) def test_list_endpoints_for_policy(self): - """GET /policies/%(policy_id}/endpoints.""" - self.put('/policies/%(policy_id)s/OS-ENDPOINT-POLICY' - '/endpoints/%(endpoint_id)s' % { - 'policy_id': self.policy['id'], - 'endpoint_id': self.endpoint['id']}) - - r = self.get('/policies/%(policy_id)s/OS-ENDPOINT-POLICY' - '/endpoints' % { - 'policy_id': self.policy['id']}) + """GET & HEAD /policies/%(policy_id}/endpoints.""" + url = ( + '/policies/%(policy_id)s/OS-ENDPOINT-POLICY' + '/endpoints' % {'policy_id': self.policy['id']} + ) + self.put(url + '/' + self.endpoint['id']) + r = self.get(url) self.assertValidEndpointListResponse(r, ref=self.endpoint) 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): url = ('/policies/%(policy_id)s/OS-ENDPOINT-POLICY'