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

Story: 2000164
Task: 2274

Change-Id: I8099d6fef1fe56d3330fbdf9391100add6afdeca
Signed-off-by: Ankita Bansal <ankitabansal2798@gmail.com>
This commit is contained in:
Ankita Bansal 2019-03-10 18:21:32 +05:30
parent a2f0f207cd
commit 3292db6bdf
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) project_groups.project_group_delete(project_group_id)
except exc.NotFound as not_found_exc: except exc.NotFound as not_found_exc:
abort(404, not_found_exc.message) abort(404, not_found_exc.message)
except exc.NotEmpty as not_empty_exc:
abort(400, not_empty_exc.message)
projects = ProjectsSubcontroller() projects = ProjectsSubcontroller()

View File

@ -174,7 +174,4 @@ def project_group_delete(project_group_id):
if not project_group: if not project_group:
raise exc.NotFound(_('Project group not found.')) 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) 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 # check for a too short name
self.assertRaises(AppError, self.put_json, url, delta) self.assertRaises(AppError, self.put_json, url, delta)
def test_delete_invalid(self): def test_delete_nonempty_valid(self):
# try to delete project group with projects # check if a non-empty project_group
# she can't be deleted, because # is deleted successfully with response
# only empty project groups can be deleted # code 204
response = self.delete(self.resource + '/2', expect_errors=True) 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): def test_delete(self):
# create new empty project group with name 'testProjectGroup' # create new empty project group with name 'testProjectGroup'