Skip to content

Commit

Permalink
Return 401 error code with invalid credentials on authentication endp…
Browse files Browse the repository at this point in the history
…oint
  • Loading branch information
val500 committed Sep 16, 2024
1 parent 4ad9205 commit 619007d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions server/tests/test_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,3 +779,19 @@ def test_authenticate_client_get(mongo_app):
token = output.data
decoded_token = jwt.decode(token, v1.SECRET_KEY, algorithms="HS256")
assert decoded_token["permissions"] == permissions


def test_authenticate_invalid_credentials(mongo_app):
"""
Tests that authentication endpoint returns 401 error code
when receiving invalid credentials
"""
app, _ = mongo_app
client_id = "my_client_id"
client_key = "my_client_key"

output = app.get(
f"/v1/authenticate/token/{client_id}",
headers={"client-key": client_key},
)
assert output.status_code == 401

0 comments on commit 619007d

Please sign in to comment.