""" Integration tests for channel status endpoint (/channel/status). """ from __future__ import annotations import pytest pytestmark = [pytest.mark.asyncio, pytest.mark.integration] async def test_channel_status_returns_list(test_client, channel_auth_headers): response = await test_client.get("/channel/status", headers=channel_auth_headers) if response.status_code == 503: pytest.skip("Channel gateway not initialized") assert response.status_code == 200, response.text payload = response.json() assert isinstance(payload, list) async def test_channel_status_item_has_required_fields(test_client, channel_auth_headers): response = await test_client.get("/channel/status", headers=channel_auth_headers) if response.status_code == 503: pytest.skip("Channel gateway not initialized") assert response.status_code == 200, response.text payload = response.json() if not payload: pytest.skip("No channel adapters registered") item = payload[0] for field in ("channel_type", "healthy", "capabilities", "active_sessions"): assert field in item, f"missing field: {field}" async def test_channel_status_capabilities_structure(test_client, channel_auth_headers): response = await test_client.get("/channel/status", headers=channel_auth_headers) if response.status_code == 503: pytest.skip("Channel gateway not initialized") assert response.status_code == 200, response.text payload = response.json() if not payload: pytest.skip("No channel adapters registered") caps = payload[0]["capabilities"] for field in ("media", "group", "dm", "streaming", "typing", "max_text_length"): assert field in caps, f"missing capability field: {field}" async def test_channel_status_healthy_is_boolean(test_client, channel_auth_headers): response = await test_client.get("/channel/status", headers=channel_auth_headers) if response.status_code == 503: pytest.skip("Channel gateway not initialized") assert response.status_code == 200, response.text payload = response.json() if not payload: pytest.skip("No channel adapters registered") assert isinstance(payload[0]["healthy"], bool)