feat: add backup dashboard summary endpoint
This commit is contained in:
@@ -7,6 +7,32 @@ from media_library_viewer_api.main import app
|
||||
from media_library_viewer_api.services.settings_store import SettingsStore
|
||||
|
||||
|
||||
def test_dashboard_backups():
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
db_path = Path(tmpdir) / "test_settings.sqlite"
|
||||
store = SettingsStore(db_path)
|
||||
store.init_schema()
|
||||
|
||||
# Monkey-patch the global store for this test
|
||||
import media_library_viewer_api.auth as auth_module
|
||||
from media_library_viewer_api.services import settings_store
|
||||
|
||||
original_store = settings_store._store
|
||||
settings_store._store = store
|
||||
auth_module._API_KEY = None
|
||||
|
||||
try:
|
||||
client = TestClient(app)
|
||||
response = client.get("/api/dashboard/backups")
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert "total_jobs" in data
|
||||
assert "success_rate_24h" in data
|
||||
finally:
|
||||
settings_store._store = original_store
|
||||
auth_module._API_KEY = None
|
||||
|
||||
|
||||
def test_post_backup_report():
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
db_path = Path(tmpdir) / "test_settings.sqlite"
|
||||
|
||||
Reference in New Issue
Block a user