Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
teknikattan-scoring-system
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tddd96-grupp1
teknikattan-scoring-system
Commits
e04a6398
Commit
e04a6398
authored
3 years ago
by
Victor Löfgren
Browse files
Options
Downloads
Patches
Plain Diff
Fix test_slide_api
parent
28836c72
No related branches found
No related tags found
1 merge request
!161
Resolve "replace-restx-with-smorest"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/app/apis/slides.py
+1
-1
1 addition, 1 deletion
server/app/apis/slides.py
server/tests/test_app.py
+8
-10
8 additions, 10 deletions
server/tests/test_app.py
with
9 additions
and
11 deletions
server/app/apis/slides.py
+
1
−
1
View file @
e04a6398
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
server/tests/test_app.py
+
8
−
10
View file @
e04a6398
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment