Files
sillyhome-future/tests/test_future_api.py

23 lines
708 B
Python

from __future__ import annotations
from fastapi.testclient import TestClient
from app.main import app, stores
def test_health_and_backup_roundtrip(tmp_path, monkeypatch) -> None: # type: ignore[no-untyped-def]
monkeypatch.setenv("SILLYHOME_FUTURE_STORE", str(tmp_path))
client = TestClient(app)
health = client.get("/health")
backup = client.get("/v2/backup/export")
restore = client.post("/v2/backup/restore", json=backup.json())
assert stores is not None
assert health.status_code == 200
assert health.json()["version"] == "2.0.0-alpha.1"
assert backup.status_code == 200
assert restore.status_code == 200
assert restore.json() == {"status": "restored"}