import httpx from gti_fiscal_agent.client import HubClient def test_identity_requests_authenticated_identity_only(monkeypatch): calls = {} payload = { "agent_id": 2, "installation_id": "00000000-0000-4000-8000-000000000222", "hostname": "DESKTOP-B0HL02I", "version": "1.1.1", "status": "OFFLINE", } class Response: status_code = 200 def raise_for_status(self): return None def json(self): return payload def fake_get(url, *, headers, timeout): calls.update(url=url, headers=headers, timeout=timeout) return Response() monkeypatch.setattr(httpx, "get", fake_get) client = HubClient("https://hub.example", "test-agent-token") assert client.identity() == payload assert calls["url"] == "https://hub.example/v1/agents/me/identity" assert calls["headers"] == {"Authorization": "Bearer test-agent-token"}