import pytest from httpx import AsyncClient @pytest.fixture async def auth_headers(client: AsyncClient): resp = await client.post("/api/v1/auth/register", json={ "email": "notifuser@example.com", "username": "notifuser", "password": "testpass123", }) assert resp.status_code == 201 return {"Authorization": f"Bearer {resp.json()['access_token']}"} async def test_list_notifications_empty(client: AsyncClient, auth_headers: dict): resp = await client.get("/api/v1/notifications/", headers=auth_headers) assert resp.status_code == 200 data = resp.json() assert data["notifications"] == [] assert data["unread_count"] == 0 async def test_unread_count(client: AsyncClient, auth_headers: dict): resp = await client.get("/api/v1/notifications/unread-count", headers=auth_headers) assert resp.status_code == 200 assert resp.json()["count"] == 0 async def test_mark_all_read(client: AsyncClient, auth_headers: dict): resp = await client.post("/api/v1/notifications/mark-all-read", headers=auth_headers) assert resp.status_code == 200 assert resp.json()["marked"] == 0 async def test_mark_nonexistent_read(client: AsyncClient, auth_headers: dict): resp = await client.patch( "/api/v1/notifications/00000000-0000-0000-0000-000000000000/read", headers=auth_headers, ) assert resp.status_code == 404 async def test_unauthenticated(client: AsyncClient): resp = await client.get("/api/v1/notifications/") assert resp.status_code == 401