mirror of
https://github.com/bellingcat/whisperbox-transcribe.git
synced 2026-06-13 05:58:35 +03:00
feat: add job & artifact tables
* remove `accounts` table in favor of a simple API key auth
This commit is contained in:
@@ -2,7 +2,7 @@ from typing import Dict
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.db.models import Account
|
||||
from app.config import settings
|
||||
from app.main import app
|
||||
|
||||
client = TestClient(app)
|
||||
@@ -18,15 +18,15 @@ def test_authorization_header_missing() -> None:
|
||||
|
||||
|
||||
def test_authorization_header_malformed() -> None:
|
||||
res = client.get("/api/v1", headers=auth_header("not_a_uuid"))
|
||||
res = client.get("/api/v1", headers={"Authorization": "Bearer"})
|
||||
assert res.status_code == 422
|
||||
|
||||
|
||||
def test_inexistent_api_key(test_account: Account) -> None:
|
||||
res = client.get("/api/v1", headers=auth_header(str(test_account.id)))
|
||||
def test_incorrect_api_key() -> None:
|
||||
res = client.get("/api/v1", headers=auth_header("not_valid"))
|
||||
assert res.status_code == 401
|
||||
|
||||
|
||||
def test_existing_api_key(test_account: Account) -> None:
|
||||
res = client.get("/api/v1", headers=auth_header(str(test_account.api_key)))
|
||||
def test_existing_api_key() -> None:
|
||||
res = client.get("/api/v1", headers=auth_header(settings.API_SECRET))
|
||||
assert res.status_code == 200
|
||||
|
||||
Reference in New Issue
Block a user