Island: Respond with 422 instead of 404 from POST /api/island-mode

This commit is contained in:
Mike Salvatore 2021-07-13 10:09:53 -04:00
parent 9310463f44
commit c56ca37bc0
2 changed files with 2 additions and 2 deletions

View File

@ -21,4 +21,4 @@ class IslandMode(flask_restful.Resource):
set_mode(mode) set_mode(mode)
return make_response({}, 200) return make_response({}, 200)
except ValueError: except ValueError:
return make_response({}, 404) return make_response({}, 422)

View File

@ -21,7 +21,7 @@ def test_island_mode_post__invalid_mode(flask_client):
resp = flask_client.post( resp = flask_client.post(
"/api/island-mode", data=json.dumps({"mode": "bogus mode"}), follow_redirects=True "/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): def test_island_mode_post__set_model(flask_client, uses_database):