[fix] solution/backend: Teams 카드 필수 필드 보완
웹훅 요청의 contentUrl 및 스키마 선언 누락을 공식 형식에 맞춤. HTTP 202와 채널 게시 성공을 구분하도록 검증 한계 기록. 검증: Teams 요청 형식 회귀 테스트 1건 통과. 워크플로 실제 수신은 별도 확인 필요.
This commit is contained in:
1 parent
3f47d5ecd2
commit
0f7d22750f
3 files changed
+35
-1
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import httpx
|
||||
from services import search_console_alerts as alerts
|
||||
|
||||
|
||||
async def test_teams_payload_has_required_attachment_fields(monkeypatch):
|
||||
requests = []
|
||||
real_client = httpx.AsyncClient
|
||||
|
||||
def receive(request):
|
||||
import json
|
||||
requests.append(json.loads(request.content))
|
||||
return httpx.Response(202)
|
||||
|
||||
monkeypatch.setattr(alerts.httpx, "AsyncClient", lambda **kw: real_client(
|
||||
transport=httpx.MockTransport(receive), **kw,
|
||||
))
|
||||
assert await alerts.send_alert("https://example.test/webhook", "https://example.test/s/a", "test")
|
||||
card = requests[0]["attachments"][0]
|
||||
assert card["contentType"] == "application/vnd.microsoft.card.adaptive"
|
||||
assert "contentUrl" in card and card["contentUrl"] is None
|
||||
assert card["content"]["$schema"] == "http://adaptivecards.io/schemas/adaptive-card.json"
|
||||
Reference in new issue
Block a user