mirror of
https://github.com/Av0idD4rk/firegex.git
synced 2026-10-23 16:31:00 +00:00
Expose 28 tools with shared REST operations, role-scoped bearer authentication, revisions, durable retries, snapshots, jobs and timed rollback. Add Docker verification harnesses and setup/workflow documentation in docs/mcp.md and inst.md. Validated with 330 unit tests, two consecutive 25-case MCP/import runs, and restart recovery; the full upstream regression run remains incomplete.
25 lines
962 B
Python
25 lines
962 B
Python
from types import SimpleNamespace
|
|
import pytest
|
|
from application import services
|
|
from mcp_api.auth import MCPError
|
|
from mcp_api.server import check_import_health
|
|
|
|
|
|
@pytest.mark.parametrize("status,manager,ok", [
|
|
("stop", None, False),
|
|
("active", None, False),
|
|
("active", SimpleNamespace(active=False), False),
|
|
("active", SimpleNamespace(active=True), True),
|
|
("stop", SimpleNamespace(active=False), True),
|
|
])
|
|
def test_import_never_reports_success_for_uninitialized_services(monkeypatch, status, manager, ok):
|
|
monkeypatch.setattr(services.db, "query", lambda *args: [{"service_id": "s", "status": status}])
|
|
monkeypatch.setattr(services.firewall, "services", {"s": manager} if manager else {})
|
|
if ok:
|
|
check_import_health()
|
|
else:
|
|
with pytest.raises(MCPError) as error:
|
|
check_import_health()
|
|
assert error.value.data["code"] == "APPLY_FAILED"
|
|
assert error.value.data["service_id"] == "s"
|