|
|
@ -40,14 +40,14 @@ def test_openapi_schema(): |
|
|
|
|
|
|
|
|
|
|
|
def test_security_api_key(): |
|
|
|
client.cookies={"key": "secret"} |
|
|
|
response = client.get("/users/me") #, cookies={"key": "secret"}) |
|
|
|
client.cookies = {"key": "secret"} |
|
|
|
response = client.get("/users/me") # , cookies={"key": "secret"}) |
|
|
|
assert response.status_code == 200, response.text |
|
|
|
assert response.json() == {"username": "secret"} |
|
|
|
|
|
|
|
|
|
|
|
def test_security_api_key_no_key(): |
|
|
|
client.cookies=None |
|
|
|
client.cookies = None |
|
|
|
response = client.get("/users/me") |
|
|
|
assert response.status_code == 403, response.text |
|
|
|
assert response.json() == {"detail": "Not authenticated"} |
|
|
|