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

Fix test_slide_api

parent 28836c72
No related branches found
No related tags found
1 merge request!161Resolve "replace-restx-with-smorest"
......@@ -62,7 +62,7 @@ class Slides(MethodView):
@blp.response(http_codes.OK, SlideSchema)
@blp.alt_response(http_codes.CONFLICT, None, description="Can't edit slide")
@blp.alt_response(http_codes.BAD_REQUEST, None, description="Can't edit slide with the provided arguments")
def put(self, competition_id, slide_id, args):
def put(self, args, competition_id, slide_id):
""" Edits the specified slide using the provided arguments. """
item_slide = dbc.get.slide(competition_id, slide_id)
......
......@@ -283,20 +283,20 @@ def test_slide_api(client):
CID = 1
response, body = get(client, f"/api/competitions/{CID}/slides", headers=headers)
assert response.status_code == http_codes.OK
assert body["count"] == 1
assert len(body) == 1
# Get slides
CID = 2
response, body = get(client, f"/api/competitions/{CID}/slides", headers=headers)
assert response.status_code == http_codes.OK
assert body["count"] == 3
assert len(body) == 3
# Add slide
response, body = post(client, f"/api/competitions/{CID}/slides", headers=headers)
assert response.status_code == http_codes.OK
response, body = get(client, f"/api/competitions/{CID}/slides", headers=headers)
assert body["count"] == 4
assert len(body) == 4
# Get slide
slide_id = 2
......@@ -313,8 +313,6 @@ def test_slide_api(client):
response, item_slide = put(
client,
f"/api/competitions/{CID}/slides/{slide_id}",
# TODO: Implement so these commented lines can be edited
# {"order": order, "title": title, "body": body, "timer": timer},
{"title": title, "timer": timer},
headers=headers,
)
......@@ -330,7 +328,7 @@ def test_slide_api(client):
# Checks that there are fewer slides
response, body = get(client, f"/api/competitions/{CID}/slides", headers=headers)
assert response.status_code == http_codes.OK
assert body["count"] == 3
assert len(body) == 3
# Tries to delete slide again, which will fail
response, _ = delete(client, f"/api/competitions/{CID}/slides/{slide_id}", headers=headers)
......@@ -339,7 +337,7 @@ def test_slide_api(client):
# Get all slides
response, body = get(client, f"/api/competitions/{CID}/slides", headers=headers)
assert response.status_code == http_codes.OK
assert body["count"] == 3
assert len(body) == 3
assert body[0]["id"] == 3
assert body[0]["order"] == 0
slide_id = 3
......@@ -403,14 +401,14 @@ def test_question_api(client):
CID = 1 # TODO: Fix api-calls so that the ones not using CID don't require one
slide_order = 1
response, body = get(client, f"/api/competitions/{CID}/questions", headers=headers)
assert response.status_code == codes.OK
assert response.status_code == http_codes.OK
assert body["count"] == 0
# Get questions from another competition that should have some questions
CID = 3
response, body = get(client, f"/api/competitions/{CID}/questions", headers=headers)
num_questions = 3
assert response.status_code == codes.OK
assert response.status_code == http_codes.OK
assert body["count"] == num_questions
# Add question
......@@ -423,7 +421,7 @@ def test_question_api(client):
{"name": name, "type_id": type_id},
headers=headers,
)
assert response.status_code == codes.OK
assert response.status_code == http_codes.OK
assert item_question["name"] == name
assert item_question["type_id"] == type_id
num_questions += 1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment