Files
stork/tests/conftest.py
T
ilia b88791a0b7
CI / python-ci (push) Successful in 1m39s
CI / secret-scan (push) Successful in 32s
Add Stork family name board MVP with invite auth and votes.
Includes multilingual etymology fields, seed data for starter names, and CI-ready Python project layout.
2026-08-06 16:43:06 -04:00

35 lines
931 B
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 authed(client: TestClient) -> TestClient:
res = client.post(
"/api/session",
json={"invite": "test-invite-token", "display_name": "Aunt Mira"},
)
assert res.status_code == 200
return client