diff options
author | David Stanek <dstanek@dstanek.com> | 2014-10-03 20:00:30 +0000 |
---|---|---|
committer | Dolph Mathews <dolph.mathews@gmail.com> | 2014-10-06 14:33:31 +0000 |
commit | 5caf29ad5d90a65d3b10dc55bb101c96b543e4f8 (patch) | |
tree | 53bba091c4b09a2828df2cc984d920093897174d | |
parent | c64eae8678327067ef22099e846d927bccb4a804 (diff) | |
download | keystone-5caf29ad5d90a65d3b10dc55bb101c96b543e4f8.tar.gz |
Fixes an error deleting an endpoint group project
Deleting a endpoint group project fails because the router specifies
a controller method that doesn't exist. This returns a 500 error to
the user for what should be a successful operation.
Change-Id: I3b91d8023d31555893fb944da73633a69d8e286f
Closes-bug: #1377304
-rw-r--r-- | keystone/contrib/endpoint_filter/controllers.py | 18 | ||||
-rw-r--r-- | keystone/tests/test_associate_project_endpoint_extension.py | 14 |
2 files changed, 23 insertions, 9 deletions
diff --git a/keystone/contrib/endpoint_filter/controllers.py b/keystone/contrib/endpoint_filter/controllers.py index 29225a2c2..ad11467e3 100644 --- a/keystone/contrib/endpoint_filter/controllers.py +++ b/keystone/contrib/endpoint_filter/controllers.py @@ -205,15 +205,6 @@ class EndpointGroupV3Controller(_ControllerBase): context, self._get_endpoint_groups_for_project(project_id)) @controller.protected() - def remove_endpoint_group_from_project(self, context, endpoint_group_id, - project_id): - """Remove the endpoint group from associated project.""" - self.assignment_api.get_project(project_id) - self.endpoint_filter_api.get_endpoint_group(endpoint_group_id) - self.endpoint_filter_api.remove_endpoint_group_from_project( - endpoint_group_id, project_id) - - @controller.protected() def list_projects_associated_with_endpoint_group(self, context, endpoint_group_id): @@ -278,6 +269,15 @@ class ProjectEndpointGroupV3Controller(_ControllerBase): self.endpoint_filter_api.add_endpoint_group_to_project( endpoint_group_id, project_id) + @controller.protected() + def remove_endpoint_group_from_project(self, context, endpoint_group_id, + project_id): + """Remove the endpoint group from associated project.""" + self.assignment_api.get_project(project_id) + self.endpoint_filter_api.get_endpoint_group(endpoint_group_id) + self.endpoint_filter_api.remove_endpoint_group_from_project( + endpoint_group_id, project_id) + @classmethod def _add_self_referential_link(cls, context, ref): url = ('/OS-EP-FILTER/endpoint_groups/%(endpoint_group_id)s' diff --git a/keystone/tests/test_associate_project_endpoint_extension.py b/keystone/tests/test_associate_project_endpoint_extension.py index f4aee5bb1..e4cf33536 100644 --- a/keystone/tests/test_associate_project_endpoint_extension.py +++ b/keystone/tests/test_associate_project_endpoint_extension.py @@ -1015,6 +1015,20 @@ class EndpointGroupCRUDTestCase(TestExtensionCase): 'endpoint_group_id': endpoint_group_id}) self.get(url, expected_status=404) + def test_removing_an_endpoint_group_project(self): + # create an endpoint group + endpoint_group_id = self._create_valid_endpoint_group( + self.DEFAULT_ENDPOINT_GROUP_URL, self.DEFAULT_ENDPOINT_GROUP_BODY) + + # create an endpoint_group project + url = self._get_project_endpoint_group_url( + endpoint_group_id, self.default_domain_project_id) + self.put(url) + + # remove the endpoint group project + self.delete(url) + self.get(url, expected_status=404) + def _create_valid_endpoint_group(self, url, body): r = self.post(url, body=body) return r.result['endpoint_group']['id'] |