"""Integration tests for admin dashboard endpoints.""" import pytest from httpx import AsyncClient class TestAdminDashboard: @pytest.mark.asyncio async def test_get_dashboard_metrics( self, client: AsyncClient, admin_auth_headers: dict, test_user: dict ): """Super admin can get dashboard metrics.""" response = await client.get("/api/v1/admin/dashboard/metrics", headers=admin_auth_headers) assert response.status_code == 200 data = response.json() assert "total_users" in data assert data["total_users"] >= 2 # admin + test_user @pytest.mark.asyncio async def test_get_dashboard_activity( self, client: AsyncClient, admin_auth_headers: dict ): """Super admin can get recent activity.""" response = await client.get("/api/v1/admin/dashboard/activity", headers=admin_auth_headers) assert response.status_code == 200 assert isinstance(response.json(), list) @pytest.mark.asyncio async def test_non_admin_cannot_access_dashboard( self, client: AsyncClient, auth_headers: dict ): """Non-admin gets 403.""" response = await client.get("/api/v1/admin/dashboard/metrics", headers=auth_headers) assert response.status_code == 403