mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 17:23:15 +00:00
* feat: Add slack trigger webhook * cr * better username tagging, react with eyes * cr * cr * cr
30 lines
881 B
Python
30 lines
881 B
Python
from __future__ import annotations
|
|
|
|
import asyncio
|
|
|
|
import pytest
|
|
|
|
from agent.utils import auth
|
|
|
|
|
|
def test_leave_failure_comment_posts_to_slack_thread(
|
|
monkeypatch: pytest.MonkeyPatch,
|
|
) -> None:
|
|
called: dict[str, str] = {}
|
|
|
|
async def fake_post_slack_thread_reply(channel_id: str, thread_ts: str, message: str) -> bool:
|
|
called["channel_id"] = channel_id
|
|
called["thread_ts"] = thread_ts
|
|
called["message"] = message
|
|
return True
|
|
|
|
monkeypatch.setattr(auth, "post_slack_thread_reply", fake_post_slack_thread_reply)
|
|
monkeypatch.setattr(
|
|
auth,
|
|
"get_config",
|
|
lambda: {"configurable": {"slack_thread": {"channel_id": "C123", "thread_ts": "1.2"}}},
|
|
)
|
|
|
|
asyncio.run(auth.leave_failure_comment("slack", "auth failed"))
|
|
|
|
assert called == {"channel_id": "C123", "thread_ts": "1.2", "message": "auth failed"}
|