Skip to content

Commit

Permalink
Change delete_template_category http code to 204 (#2218)
Browse files Browse the repository at this point in the history
* Change delete_template_category http code to 204

* Fix test

* Revert "Fix test"

This reverts commit 203133d.

* Quick fix
  • Loading branch information
whabanks authored Jul 11, 2024
1 parent 74e31fc commit 9c98020
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/template/template_category_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ def delete_template_category(template_category_id):

if request.args.get("cascade") == "True":
dao_delete_template_category_by_id(template_category_id, cascade=True)
return "", 200
return "", 204

if Template.query.filter_by(template_category_id=template_category_id).count() > 0:
return jsonify(message="Cannot delete a template category with templates assigned to it."), 400
else:
dao_delete_template_category_by_id(template_category_id)
return "", 200
return "", 204
2 changes: 1 addition & 1 deletion tests/app/template/test_template_category_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_get_template_categories(
@pytest.mark.parametrize(
"cascade, expected_status_code, expected_msg",
[
("True", 200, ""),
("True", 204, ""),
("False", 400, "Cannot delete a template category with templates assigned to it."),
],
)
Expand Down

0 comments on commit 9c98020

Please sign in to comment.