Skip to content
Snippets Groups Projects
Commit 1145e944 authored by Victor Löfgren's avatar Victor Löfgren
Browse files

Fix test_authorization

parent 376ec645
No related branches found
No related tags found
1 merge request!161Resolve "replace-restx-with-smorest"
...@@ -440,7 +440,7 @@ def test_authorization(client): ...@@ -440,7 +440,7 @@ def test_authorization(client):
#### TEAM #### #### TEAM ####
# Login in with team code # Login in with team code
response, body = post(client, "/api/auth/login/code", {"code": "111111"}) response, body = post(client, "/api/auth/code", {"code": "111111"})
assert response.status_code == http_codes.OK assert response.status_code == http_codes.OK
headers = {"Authorization": "Bearer " + body["access_token"]} headers = {"Authorization": "Bearer " + body["access_token"]}
...@@ -460,20 +460,16 @@ def test_authorization(client): ...@@ -460,20 +460,16 @@ def test_authorization(client):
assert response.status_code == http_codes.UNAUTHORIZED assert response.status_code == http_codes.UNAUTHORIZED
# Get own answers # Get own answers
response, body = get( response, body = get(client, f"/api/competitions/{competition_id}/teams/{team_id}/answers", headers=headers)
client, f"/api/competitions/{competition_id}/teams/{team_id}/answers/question_alternatives", headers=headers
)
assert response.status_code == http_codes.OK assert response.status_code == http_codes.OK
# Try to get another teams answers # Try to get another teams answers
response, body = get( response, body = get(client, f"/api/competitions/{competition_id}/teams/{team_id+1}/answers", headers=headers)
client, f"/api/competitions/{competition_id}/teams/{team_id+1}/answers/question_alternatives", headers=headers
)
assert response.status_code == http_codes.UNAUTHORIZED assert response.status_code == http_codes.UNAUTHORIZED
#### JUDGE #### #### JUDGE ####
# Login in with judge code # Login in with judge code
response, body = post(client, "/api/auth/login/code", {"code": "222222"}) response, body = post(client, "/api/auth/code", {"code": "222222"})
assert response.status_code == http_codes.OK assert response.status_code == http_codes.OK
headers = {"Authorization": "Bearer " + body["access_token"]} headers = {"Authorization": "Bearer " + body["access_token"]}
...@@ -492,13 +488,9 @@ def test_authorization(client): ...@@ -492,13 +488,9 @@ def test_authorization(client):
assert response.status_code == http_codes.UNAUTHORIZED assert response.status_code == http_codes.UNAUTHORIZED
# Get team answers # Get team answers
response, body = get( response, body = get(client, f"/api/competitions/{competition_id}/teams/{team_id}/answers", headers=headers)
client, f"/api/competitions/{competition_id}/teams/{team_id}/answers/question_alternatives", headers=headers
)
assert response.status_code == http_codes.OK assert response.status_code == http_codes.OK
# Also get antoher teams answers # Also get antoher teams answers
response, body = get( response, body = get(client, f"/api/competitions/{competition_id}/teams/{team_id+1}/answers", headers=headers)
client, f"/api/competitions/{competition_id}/teams/{team_id+1}/answers/question_alternatives", headers=headers
)
assert response.status_code == http_codes.OK assert response.status_code == http_codes.OK
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment