mirror of
https://github.com/bellingcat/whisperbox-transcribe.git
synced 2026-06-13 05:58:35 +03:00
test: add integration test for sharing
This commit is contained in:
@@ -1,25 +1,18 @@
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.web.main import app
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
def test_authorization_header_missing() -> None:
|
||||
def test_authorization_header_missing(client):
|
||||
res = client.get("/api/v1/jobs")
|
||||
assert res.status_code == 401
|
||||
|
||||
|
||||
def test_authorization_header_malformed() -> None:
|
||||
def test_authorization_header_malformed(client):
|
||||
res = client.get("/api/v1/jobs", headers={"Authorization": "Bearer"})
|
||||
assert res.status_code == 401
|
||||
|
||||
|
||||
def test_incorrect_api_key() -> None:
|
||||
def test_incorrect_api_key(client):
|
||||
res = client.get("/api/v1/jobs", headers={"Authorization": "Bearer incorrect"})
|
||||
assert res.status_code == 401
|
||||
|
||||
|
||||
def test_existing_api_key(auth_headers: dict[str, str]) -> None:
|
||||
def test_existing_api_key(client, auth_headers):
|
||||
res = client.get("/api/v1/jobs", headers=auth_headers)
|
||||
assert res.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user