Change status code to 204 when there is no content in response.

This commit is contained in:
Rebecca Law
2018-11-09 14:55:19 +00:00
parent 98de2591a7
commit 64f7f4c302
2 changed files with 10 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
from flask import Blueprint, jsonify, request, abort, current_app from flask import Blueprint, jsonify, request, current_app
from sqlalchemy.exc import IntegrityError from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm.exc import NoResultFound from sqlalchemy.orm.exc import NoResultFound
@@ -145,4 +145,4 @@ def move_to_template_folder(service_id, target_template_folder_id=None):
)) ))
else: else:
template.folder = target_template_folder template.folder = target_template_folder
return '', 200 return '', 204

View File

@@ -224,7 +224,8 @@ def test_move_to_folder_moves_folders_and_templates(admin_request, sample_servic
_data={ _data={
'templates': [str(t1.id)], 'templates': [str(t1.id)],
'folders': [str(f1.id)] 'folders': [str(f1.id)]
} },
_expected_status=204
) )
assert target_folder.parent is None assert target_folder.parent is None
@@ -258,7 +259,8 @@ def test_move_to_folder_moves_folders_and_templates_to_top_level_if_no_target(ad
_data={ _data={
'templates': [str(t1.id)], 'templates': [str(t1.id)],
'folders': [str(f1.id)] 'folders': [str(f1.id)]
} },
_expected_status=204
) )
assert f1.parent is None assert f1.parent is None
@@ -298,8 +300,8 @@ def test_move_to_folder_rejects_template_from_other_service(admin_request, notif
service_id=s1.id, service_id=s1.id,
target_template_folder_id=None, target_template_folder_id=None,
_data={ _data={
'templates': [], 'templates': [str(t2.id)],
'folders': [str(t2.id)] 'folders': []
}, },
_expected_status=400 _expected_status=400
) )
@@ -336,7 +338,8 @@ def test_move_to_folder_skips_archived_templates(admin_request, sample_service):
_data={ _data={
'templates': [str(archived_template.id), str(unarchived_template.id)], 'templates': [str(archived_template.id), str(unarchived_template.id)],
'folders': [] 'folders': []
} },
_expected_status=204
) )
assert archived_template.updated_at == archived_timestamp assert archived_template.updated_at == archived_timestamp