diff --git a/rh_ui/views/start.py b/rh_ui/views/start.py index 470ffee..0ee117b 100644 --- a/rh_ui/views/start.py +++ b/rh_ui/views/start.py @@ -29,7 +29,7 @@ def start_post(): uac = request.form.get('uac').upper().replace(' ', '') if error := pre_check_uac(uac): flash(error) - return render_template("start.html"), 422 + return render_template("start.html"), 401 token_response = get_eq_token(uac, g.lang_code) if error_response := handle_token_error_response(token_response): diff --git a/tests/unit/views/test_start.py b/tests/unit/views/test_start.py index e34147d..8dccc74 100644 --- a/tests/unit/views/test_start.py +++ b/tests/unit/views/test_start.py @@ -36,14 +36,14 @@ def test_en_enter_uac_success(test_client): def test_en_enter_uac_blank(test_client): response = test_client.post(EN_START_ROUTE, data={"uac": ""}, follow_redirects=True) - assert response.status_code == 422 + assert response.status_code == 401 assert 'Enter an access code' in response.text def test_en_enter_uac_invalid_length(test_client): response = test_client.post(EN_START_ROUTE, data={"uac": "testing"}, follow_redirects=True) - assert response.status_code == 422 + assert response.status_code == 401 assert 'Enter a 16-character access code' in response.text @@ -51,7 +51,7 @@ def test_uac_pattern_match_failure(test_client): # When we try to hash a UAC that is an invalid format, then it raises the error response = test_client.post(EN_START_ROUTE, data={"uac": 'testing_uac_err-'}, follow_redirects=True) - assert response.status_code == 422 + assert response.status_code == 401 assert 'Access code not recognised. Enter the code again.' in response.text