From c56ca37bc0c2ec8990f5d2a4bdada8a43a2a133e Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 13 Jul 2021 10:09:53 -0400 Subject: [PATCH] Island: Respond with 422 instead of 404 from POST /api/island-mode --- monkey/monkey_island/cc/resources/island_mode.py | 2 +- .../unit_tests/monkey_island/cc/resources/test_island_mode.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/monkey/monkey_island/cc/resources/island_mode.py b/monkey/monkey_island/cc/resources/island_mode.py index 889b25a26..dd51d9fdb 100644 --- a/monkey/monkey_island/cc/resources/island_mode.py +++ b/monkey/monkey_island/cc/resources/island_mode.py @@ -21,4 +21,4 @@ class IslandMode(flask_restful.Resource): set_mode(mode) return make_response({}, 200) except ValueError: - return make_response({}, 404) + return make_response({}, 422) diff --git a/monkey/tests/unit_tests/monkey_island/cc/resources/test_island_mode.py b/monkey/tests/unit_tests/monkey_island/cc/resources/test_island_mode.py index 5c4362c64..91c6d0435 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/resources/test_island_mode.py +++ b/monkey/tests/unit_tests/monkey_island/cc/resources/test_island_mode.py @@ -21,7 +21,7 @@ def test_island_mode_post__invalid_mode(flask_client): resp = flask_client.post( "/api/island-mode", data=json.dumps({"mode": "bogus mode"}), follow_redirects=True ) - assert resp.status_code == 404 + assert resp.status_code == 422 def test_island_mode_post__set_model(flask_client, uses_database):