mirror of
https://gitea.publichub.eu/oscar.krause/fastapi-dls.git
synced 2025-11-03 05:06:15 +00:00
Merge branch 'dev' into sqlalchemy
# Conflicts: # app/main.py
This commit is contained in:
20
test/main.py
20
test/main.py
@@ -1,3 +1,6 @@
|
||||
from uuid import uuid4
|
||||
|
||||
from jose import jwt
|
||||
from starlette.testclient import TestClient
|
||||
import sys
|
||||
|
||||
@@ -9,6 +12,8 @@ from app import main
|
||||
|
||||
client = TestClient(main.app)
|
||||
|
||||
ORIGIN_REF = str(uuid4())
|
||||
|
||||
|
||||
def test_index():
|
||||
response = client.get('/')
|
||||
@@ -39,14 +44,25 @@ def test_auth_v1_origin():
|
||||
"host_driver_version": "host_driver_version"
|
||||
},
|
||||
"update_pending": False,
|
||||
"candidate_origin_ref": "00112233-4455-6677-8899-aabbccddeeff"
|
||||
"candidate_origin_ref": ORIGIN_REF,
|
||||
}
|
||||
|
||||
response = client.post('/auth/v1/origin', json=payload)
|
||||
assert response.status_code == 200
|
||||
assert response.json()['origin_ref'] == ORIGIN_REF
|
||||
|
||||
|
||||
def test_auth_v1_code():
|
||||
pass
|
||||
payload = {
|
||||
"code_challenge": "0wmaiAMAlTIDyz4Fgt2/j0tXnGv72TYbbLs4ISRCZlY",
|
||||
"origin_ref": ORIGIN_REF,
|
||||
}
|
||||
|
||||
response = client.post('/auth/v1/code', json=payload)
|
||||
assert response.status_code == 200
|
||||
|
||||
payload = jwt.get_unverified_claims(token=response.json()['auth_code'])
|
||||
assert payload['origin_ref'] == ORIGIN_REF
|
||||
|
||||
|
||||
def test_auth_v1_token():
|
||||
|
||||
Reference in New Issue
Block a user