Add monitor API tests (B8)

- test_monitor.py: 12 test cases covering:
  - API key generation (success, 404, admin-only)
  - heartbeat-v2 endpoint (valid key, invalid key, missing key)
  - API key revocation and validation
  - ServerState data persistence (agents_json, cpu_pct, etc.)
  - Disabled server rejection
- conftest.py: import app.models.monitor for test database setup

All tests passing (pytest -v).
This commit is contained in:
zhi
2026-03-19 19:39:15 +00:00
parent 5f6a3dffe4
commit ed21b73a43
2 changed files with 326 additions and 0 deletions

View File

@@ -32,6 +32,10 @@ try:
import app.models.webhook # noqa: F401
except ImportError:
pass
try:
import app.models.monitor # noqa: F401
except ImportError:
pass
TEST_DATABASE_URL = "sqlite://" # in-memory