33 lines
655 B
Python
33 lines
655 B
Python
import pytest
|
|||
|
|
from fastapi.testclient import TestClient
|
||
|
|
|
||
|
|
from pigway_frame_flow.api.app import create_app
|
||
|
|
from pigway_frame_flow.settings import Settings
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.fixture
|
||
|
|
def settings(tmp_path):
|
||
|
|
return Settings(
|
||
|
|
data_dir=tmp_path / "data",
|
||
|
|
config_dir=tmp_path / "config",
|
||
|
|
api_token="test-frame-token",
|
||
|
|
mock=True,
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.fixture
|
||
|
|
def app(settings):
|
||
|
|
return create_app(settings, start_worker=False)
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.fixture
|
||
|
|
def client(app):
|
||
|
|
with TestClient(app) as c:
|
||
|
|
c.headers["Authorization"] = "Bearer test-frame-token"
|
||
|
|
yield c
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.fixture
|
||
|
|
def service(app):
|
||
|
|
return app.state.service
|