Skip to content

Commit

Permalink
Updated status code
Browse files Browse the repository at this point in the history
  • Loading branch information
ryangrundy7 committed Apr 17, 2024
1 parent c11fa09 commit afeee24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rh_ui/views/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/views/test_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,22 @@ 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


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


Expand Down

0 comments on commit afeee24

Please sign in to comment.