Expose BanGUI version in API responses (dashboard + config)

This commit is contained in:
2026-03-19 19:19:42 +01:00
parent 80a6bac33e
commit 1cc9968d31
6 changed files with 22 additions and 3 deletions

View File

@@ -9,6 +9,8 @@ import aiosqlite
import pytest
from httpx import ASGITransport, AsyncClient
import app
from app.config import Settings
from app.db import init_db
from app.main import create_app
@@ -151,6 +153,9 @@ class TestDashboardStatus:
body = response.json()
assert "status" in body
assert "bangui_version" in body
assert body["bangui_version"] == app.__version__
status = body["status"]
assert "online" in status
assert "version" in status
@@ -163,8 +168,10 @@ class TestDashboardStatus:
) -> None:
"""Endpoint returns the exact values from ``app.state.server_status``."""
response = await dashboard_client.get("/api/dashboard/status")
status = response.json()["status"]
body = response.json()
status = body["status"]
assert body["bangui_version"] == app.__version__
assert status["online"] is True
assert status["version"] == "1.0.2"
assert status["active_jails"] == 2
@@ -177,8 +184,10 @@ class TestDashboardStatus:
"""Endpoint returns online=False when the cache holds an offline snapshot."""
response = await offline_dashboard_client.get("/api/dashboard/status")
assert response.status_code == 200
status = response.json()["status"]
body = response.json()
status = body["status"]
assert body["bangui_version"] == app.__version__
assert status["online"] is False
assert status["version"] is None
assert status["active_jails"] == 0