Add GitHub webhook receiver
This commit is contained in:
32
tests/test_dispatcher.py
Normal file
32
tests/test_dispatcher.py
Normal file
@@ -0,0 +1,32 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import unittest
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import AsyncMock
|
||||
|
||||
from app.commands import CommandDispatcher, CommandRegistry
|
||||
|
||||
|
||||
class CommandDispatcherTests(unittest.IsolatedAsyncioTestCase):
|
||||
async def test_unknown_owner_command_is_silent(self) -> None:
|
||||
dispatcher = CommandDispatcher(CommandRegistry())
|
||||
message = SimpleNamespace(
|
||||
text=".missing",
|
||||
from_user=SimpleNamespace(id=123),
|
||||
reply_text=AsyncMock(),
|
||||
)
|
||||
account = SimpleNamespace(me=SimpleNamespace(id=123))
|
||||
|
||||
handled = await dispatcher.dispatch(
|
||||
client=SimpleNamespace(),
|
||||
message=message,
|
||||
manager=SimpleNamespace(),
|
||||
account=account,
|
||||
)
|
||||
|
||||
self.assertTrue(handled)
|
||||
message.reply_text.assert_not_awaited()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user