mirror of
https://github.com/bellingcat/whisperbox-transcribe.git
synced 2026-06-08 03:28:35 +03:00
26 lines
679 B
Python
26 lines
679 B
Python
from fastapi.testclient import TestClient
|
|
|
|
from app.web.main import app
|
|
|
|
client = TestClient(app)
|
|
|
|
|
|
def test_authorization_header_missing() -> None:
|
|
res = client.get("/api/v1")
|
|
assert res.status_code == 401
|
|
|
|
|
|
def test_authorization_header_malformed() -> None:
|
|
res = client.get("/api/v1", headers={"Authorization": "Bearer"})
|
|
assert res.status_code == 401
|
|
|
|
|
|
def test_incorrect_api_key() -> None:
|
|
res = client.get("/api/v1", headers={"Authorization": "Bearer incorrect"})
|
|
assert res.status_code == 401
|
|
|
|
|
|
def test_existing_api_key(auth_headers: dict[str, str]) -> None:
|
|
res = client.get("/api/v1", headers=auth_headers)
|
|
assert res.status_code == 204
|