24 lines
677 B
Python
24 lines
677 B
Python
from pathlib import Path
|
|
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
|
|
from app.auth import SessionManager, make_password_hash
|
|
from app.main import create_app
|
|
|
|
|
|
@pytest.fixture()
|
|
def client(tmp_path: Path):
|
|
app = create_app(tmp_path / "data", Path(__file__).parents[1] / "config" / "layouts", SessionManager(None))
|
|
with TestClient(app) as test_client:
|
|
yield test_client
|
|
|
|
|
|
@pytest.fixture()
|
|
def auth_client(tmp_path: Path):
|
|
manager = SessionManager(make_password_hash("secret"))
|
|
app = create_app(tmp_path / "data", Path(__file__).parents[1] / "config" / "layouts", manager)
|
|
with TestClient(app) as test_client:
|
|
yield test_client
|
|
|