feat: POST /speakers — resolves pipeline pause with speaker name mapping
This commit is contained in:
@@ -171,6 +171,29 @@ def test_state_has_speaker_fields():
|
||||
assert s._speaker_names is None
|
||||
|
||||
|
||||
def test_post_speakers_resolves_pipeline_pause():
|
||||
import asyncio
|
||||
from main import app
|
||||
from api.router import current_user
|
||||
from api.state import state
|
||||
|
||||
state._speakers_event = asyncio.Event()
|
||||
state._speaker_names = None
|
||||
|
||||
app.dependency_overrides[current_user] = lambda: {"username": "u", "output_dir": "/tmp", "is_admin": False}
|
||||
try:
|
||||
from fastapi.testclient import TestClient
|
||||
client = TestClient(app)
|
||||
r = client.post("/speakers", json={"SPEAKER_00": "Thomas", "SPEAKER_01": "Möller"})
|
||||
assert r.status_code == 200
|
||||
assert state._speaker_names == {"SPEAKER_00": "Thomas", "SPEAKER_01": "Möller"}
|
||||
assert state._speakers_event.is_set()
|
||||
finally:
|
||||
app.dependency_overrides.pop(current_user, None)
|
||||
state._speakers_event = None
|
||||
state._speaker_names = None
|
||||
|
||||
|
||||
def test_put_config_deep_merges(tmp_path, monkeypatch):
|
||||
import config as cfg_mod
|
||||
monkeypatch.setattr(cfg_mod, "CONFIG_PATH", str(tmp_path / "config.toml"))
|
||||
|
||||
Reference in New Issue
Block a user