Merge "Project Group UI should permit removing project group even if it is not empty."

This commit is contained in:
Zuul 2019-06-05 18:09:34 +00:00 committed by Gerrit Code Review
commit 4ff5d9a3b2
3 changed files with 5 additions and 10 deletions

View File

@ -282,8 +282,6 @@ class ProjectGroupsController(rest.RestController):
project_groups.project_group_delete(project_group_id)
except exc.NotFound as not_found_exc:
abort(404, not_found_exc.message)
except exc.NotEmpty as not_empty_exc:
abort(400, not_empty_exc.message)
projects = ProjectsSubcontroller()

View File

@ -174,7 +174,4 @@ def project_group_delete(project_group_id):
if not project_group:
raise exc.NotFound(_('Project group not found.'))
if len(project_group.projects) > 0:
raise exc.NotEmpty(_('Project group must be empty.'))
api_base.entity_hard_delete(models.ProjectGroup, project_group_id)

View File

@ -103,13 +103,13 @@ class TestProjectGroups(base.FunctionalTest):
# check for a too short name
self.assertRaises(AppError, self.put_json, url, delta)
def test_delete_invalid(self):
# try to delete project group with projects
# she can't be deleted, because
# only empty project groups can be deleted
def test_delete_nonempty_valid(self):
# check if a non-empty project_group
# is deleted successfully with response
# code 204
response = self.delete(self.resource + '/2', expect_errors=True)
self.assertEqual(400, response.status_code)
self.assertEqual(204, response.status_code)
def test_delete(self):
# create new empty project group with name 'testProjectGroup'