From 474acc5bba5cf24177976d8883d848a370ce0031 Mon Sep 17 00:00:00 2001 From: Leo Hemsted Date: Mon, 10 Dec 2018 12:59:16 +0000 Subject: [PATCH] new chillmaid approved error messages these get shown on the front-end so make sure their content is good --- app/template_folder/rest.py | 7 ++----- tests/app/template_folder/test_template_folder_rest.py | 6 ++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/template_folder/rest.py b/app/template_folder/rest.py index f2f79c521..010bc1a66 100644 --- a/app/template_folder/rest.py +++ b/app/template_folder/rest.py @@ -141,11 +141,8 @@ def move_to_template_folder(service_id, target_template_folder_id=None): def _validate_folder_move(target_template_folder, target_template_folder_id, template_folder, template_folder_id): if str(target_template_folder_id) == str(template_folder_id): - msg = 'Could not move folder to itself' + msg = 'You cannot move a folder to itself' raise InvalidRequest(msg, status_code=400) if target_template_folder and template_folder.is_parent_of(target_template_folder): - msg = 'Could not move to folder: {} is an ancestor of target folder {}'.format( - template_folder_id, - target_template_folder_id - ) + msg = 'You cannot move a folder to one of its subfolders' raise InvalidRequest(msg, status_code=400) diff --git a/tests/app/template_folder/test_template_folder_rest.py b/tests/app/template_folder/test_template_folder_rest.py index bc9058aca..ff861f0de 100644 --- a/tests/app/template_folder/test_template_folder_rest.py +++ b/tests/app/template_folder/test_template_folder_rest.py @@ -325,9 +325,7 @@ def test_move_to_folder_rejects_if_it_would_cause_folder_loop(admin_request, sam }, _expected_status=400 ) - assert response['message'] == 'Could not move to folder: {} is an ancestor of target folder {}'.format( - f1.id, target_folder.id - ) + assert response['message'] == 'You cannot move a folder to one of its subfolders' def test_move_to_folder_itself_is_rejected(admin_request, sample_service): @@ -343,7 +341,7 @@ def test_move_to_folder_itself_is_rejected(admin_request, sample_service): }, _expected_status=400 ) - assert response['message'] == 'Could not move folder to itself' + assert response['message'] == 'You cannot move a folder to itself' def test_move_to_folder_skips_archived_templates(admin_request, sample_service):