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
1145e944
Commit
1145e944
authored
3 years ago
by
Victor Löfgren
Browse files
Options
Downloads
Patches
Plain Diff
Fix test_authorization
parent
376ec645
No related branches found
No related tags found
1 merge request
!161
Resolve "replace-restx-with-smorest"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/tests/test_app.py
+6
-14
6 additions, 14 deletions
server/tests/test_app.py
with
6 additions
and
14 deletions
server/tests/test_app.py
+
6
−
14
View file @
1145e944
...
@@ -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
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