ForcePilot/test/api/test_dashboard_router.py

26 lines
825 B
Python
Raw Normal View History

"""
Integration tests for dashboard router endpoints.
"""
from __future__ import annotations
import pytest
pytestmark = [pytest.mark.asyncio, pytest.mark.integration]
async def test_dashboard_requires_authentication(test_client):
response = await test_client.get("/api/dashboard/conversations")
assert response.status_code == 401
async def test_standard_user_is_forbidden(test_client, standard_user):
response = await test_client.get("/api/dashboard/conversations", headers=standard_user["headers"])
assert response.status_code == 403
async def test_admin_can_fetch_conversations(test_client, admin_headers):
response = await test_client.get("/api/dashboard/conversations", headers=admin_headers)
assert response.status_code == 200, response.text
assert isinstance(response.json(), list)