22 lines
707 B
Python
22 lines
707 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.2"
|
|
assert backup.status_code == 200
|
|
assert restore.status_code == 200
|
|
assert restore.json() == {"status": "restored"}
|