Merge "Fixes an error deleting an endpoint group project" into proposed/juno

This commit is contained in:
Jenkins 2014-10-07 08:50:42 +00:00 committed by Gerrit Code Review
commit 75dcfd04be
2 changed files with 23 additions and 9 deletions

View File

@ -204,15 +204,6 @@ class EndpointGroupV3Controller(_ControllerBase):
return EndpointGroupV3Controller.wrap_collection(
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,
@ -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'

View File

@ -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']