feat(jobs): t3code events go back to the dispatching conversation, quiet branches close at night
This commit is contained in:
1 parent
2bf2326178
commit
6db6c7b6ec
3 files changed
+43
-3
No files matched your search
@@ -0,0 +1,33 @@
|
||||
from typing import Any
|
||||
|
||||
from beaver_agent.jobs.t3code import t3code_event
|
||||
|
||||
|
||||
class FakeRun:
|
||||
def __init__(self, payload: dict[str, Any]) -> None:
|
||||
self.payload = payload
|
||||
self.injects: list[tuple[str | None, str, str, str]] = []
|
||||
|
||||
async def inject_into(
|
||||
self, public_id: str | None, text: str, *, urgency: str, origin: str
|
||||
) -> bool:
|
||||
self.injects.append((public_id, text, urgency, origin))
|
||||
return True
|
||||
|
||||
|
||||
async def test_the_event_goes_to_the_conversation_that_dispatched() -> None:
|
||||
run = FakeRun(
|
||||
{
|
||||
"event": "completed",
|
||||
"thread_id": "t1",
|
||||
"title": "lint",
|
||||
"machine": "mac",
|
||||
"project": "beaver",
|
||||
"origin": "conv-7",
|
||||
"text": "done",
|
||||
}
|
||||
)
|
||||
await t3code_event(run) # ty: ignore[invalid-argument-type]
|
||||
[(target, text, urgency, origin)] = run.injects
|
||||
assert (target, urgency, origin) == ("conv-7", "urgent", "t3code")
|
||||
assert "завершён" in text and "done" in text
|
||||
Reference in new issue
Block a user