"""node-26#49 — releases are visible: /health reports the server's, checkin carries the node's.""" from unittest.mock import AsyncMock, patch import pytest from fastapi.testclient import TestClient from app.internal.mqtt_handler import MQTTHandler from app.main import app def test_health_reports_the_release(): with patch("app.main._VERSION", "1.1.4"): body = TestClient(app).get("/health").json() assert body["version"] == "1.1.4" assert "git_sha" in body @pytest.mark.asyncio async def test_checkin_stores_the_node_release(): with patch("app.internal.mqtt_handler.fstore") as fs: fs.doc_get = AsyncMock(return_value=None) fs.doc_set = AsyncMock() await MQTTHandler()._handle_checkin("n1", {"name": "Pi", "version": "1.1.10"}) assert fs.doc_set.call_args[0][2]["version"] == "1.1.10"