"""Notification channel tests — Go/Gin backend.""" import pytest from httpx import AsyncClient from tests.conftest import auth_header class TestListNotifications: async def test_list(self, client: AsyncClient, admin_token: str): resp = await client.get("/api/v1/notifications", headers=auth_header(admin_token)) assert resp.status_code == 200 data = resp.json() assert isinstance(data, list) async def test_no_auth(self, client: AsyncClient): resp = await client.get("/api/v1/notifications") assert resp.status_code == 401 class TestCreateNotification: async def test_create_feishu(self, client: AsyncClient, admin_token: str): import uuid resp = await client.post("/api/v1/notifications", headers=auth_header(admin_token), json={ "name": f"test-feishu-{uuid.uuid4().hex[:6]}", "channel_type": "webhook_feishu", "config": {"webhook_url": "https://example.com/feishu"}, "is_enabled": False, }) assert resp.status_code == 200 async def test_create_dingtalk(self, client: AsyncClient, admin_token: str): import uuid resp = await client.post("/api/v1/notifications", headers=auth_header(admin_token), json={ "name": f"test-ding-{uuid.uuid4().hex[:6]}", "channel_type": "dingtalk", "config": {"webhook_url": "https://example.com/dingtalk"}, "is_enabled": False, }) assert resp.status_code == 200