feat: SAC 0.7.4 sidebar system stats block with UI toggle
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"""GET /api/v1/system/stats"""
|
||||
|
||||
from app.services.ui_settings import upsert_ui_settings
|
||||
|
||||
|
||||
def test_system_stats_requires_auth(client):
|
||||
response = client.get("/api/v1/system/stats")
|
||||
assert response.status_code == 401
|
||||
|
||||
|
||||
def test_system_stats_visible_default(jwt_headers, client):
|
||||
response = client.get("/api/v1/system/stats", headers=jwt_headers)
|
||||
assert response.status_code == 200
|
||||
body = response.json()
|
||||
assert body["visible"] is True
|
||||
assert "collected_at" in body
|
||||
assert "database" in body
|
||||
assert body["database"]["status"] in ("ok", "error")
|
||||
assert "app" in body
|
||||
assert "events_last_hour" in body["app"]
|
||||
assert "problems_open" in body["app"]
|
||||
|
||||
|
||||
def test_system_stats_respects_ui_setting(jwt_headers, client, db_session):
|
||||
upsert_ui_settings(db_session, show_sidebar_system_stats=False)
|
||||
db_session.commit()
|
||||
|
||||
response = client.get("/api/v1/system/stats", headers=jwt_headers)
|
||||
assert response.status_code == 200
|
||||
assert response.json()["visible"] is False
|
||||
Reference in New Issue
Block a user