Files
stork/tests/conftest.py
T
ilia b91ba3490c
CI / secret-scan (pull_request) Successful in 32s
CI / python-ci (pull_request) Successful in 50s
Add shareable multi-board links with paper UI and voice notes.
Boards use /b/<uid> with no invite password; restore renamable columns,
recordings, and seeded locale notes, with first column locked.
2026-08-07 14:47:28 -04:00

43 lines
1.2 KiB
Python

"""Shared fixtures for Stork API tests."""
from __future__ import annotations
import importlib
from pathlib import Path
import pytest
from fastapi.testclient import TestClient
@pytest.fixture()
def client(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> TestClient:
monkeypatch.setenv("STORK_DATA", str(tmp_path / "data"))
monkeypatch.setenv("STORK_INVITE_TOKEN", "test-invite-token")
monkeypatch.setenv("STORK_ADMIN_TOKEN", "test-admin-token")
monkeypatch.setenv("STORK_COOKIE_SECURE", "false")
import stork.app as app_mod
importlib.reload(app_mod)
with TestClient(app_mod.app) as test_client:
yield test_client
app_mod.store.close()
@pytest.fixture()
def family_board(client: TestClient) -> dict:
"""Bootstrap Family board id (from STORK_INVITE_TOKEN)."""
res = client.get("/api/resolve", params={"invite": "test-invite-token"})
assert res.status_code == 200
return res.json()
@pytest.fixture()
def authed(client: TestClient, family_board: dict) -> TestClient:
res = client.post(
"/api/session",
json={"board_id": family_board["id"], "display_name": "Aunt Mira"},
)
assert res.status_code == 200
return client