From 1145e9446e101b6275982b34819c2edfb2f1694f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Victor=20L=C3=B6fgren?= <viclo211@student.liu.se>
Date: Sat, 22 May 2021 12:13:35 +0200
Subject: [PATCH] Fix test_authorization

---
 server/tests/test_app.py | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/server/tests/test_app.py b/server/tests/test_app.py
index 31d4d2b5..6f0ad93c 100644
--- a/server/tests/test_app.py
+++ b/server/tests/test_app.py
@@ -440,7 +440,7 @@ def test_authorization(client):
 
     #### TEAM ####
     # 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
     headers = {"Authorization": "Bearer " + body["access_token"]}
 
@@ -460,20 +460,16 @@ def test_authorization(client):
     assert response.status_code == http_codes.UNAUTHORIZED
 
     # Get own answers
-    response, body = get(
-        client, f"/api/competitions/{competition_id}/teams/{team_id}/answers/question_alternatives", headers=headers
-    )
+    response, body = get(client, f"/api/competitions/{competition_id}/teams/{team_id}/answers", headers=headers)
     assert response.status_code == http_codes.OK
 
     # Try to get another teams answers
-    response, body = get(
-        client, f"/api/competitions/{competition_id}/teams/{team_id+1}/answers/question_alternatives", headers=headers
-    )
+    response, body = get(client, f"/api/competitions/{competition_id}/teams/{team_id+1}/answers", headers=headers)
     assert response.status_code == http_codes.UNAUTHORIZED
 
     #### JUDGE ####
     # 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
     headers = {"Authorization": "Bearer " + body["access_token"]}
 
@@ -492,13 +488,9 @@ def test_authorization(client):
     assert response.status_code == http_codes.UNAUTHORIZED
 
     # Get team answers
-    response, body = get(
-        client, f"/api/competitions/{competition_id}/teams/{team_id}/answers/question_alternatives", headers=headers
-    )
+    response, body = get(client, f"/api/competitions/{competition_id}/teams/{team_id}/answers", headers=headers)
     assert response.status_code == http_codes.OK
 
     # Also get antoher teams answers
-    response, body = get(
-        client, f"/api/competitions/{competition_id}/teams/{team_id+1}/answers/question_alternatives", headers=headers
-    )
+    response, body = get(client, f"/api/competitions/{competition_id}/teams/{team_id+1}/answers", headers=headers)
     assert response.status_code == http_codes.OK
-- 
GitLab