|
@@ -899,6 +899,37 @@ class TestForeignMention:
|
|
|
adapter.handle_message.assert_called_once()
|
|
adapter.handle_message.assert_called_once()
|
|
|
adapter.add_reaction.assert_not_awaited()
|
|
adapter.add_reaction.assert_not_awaited()
|
|
|
|
|
|
|
|
|
|
+ async def test_several_people_addressed_and_none_of_them_us(self):
|
|
|
|
|
+ adapter = self._adapter()
|
|
|
|
|
+ adapter._chatto_client.get_user = AsyncMock(side_effect=lambda **kw: (
|
|
|
|
|
+ DirectoryMember(user=_make_user("u", kw["login"]))
|
|
|
|
|
+ if kw.get("login") in {"bob", "carol"} else None
|
|
|
|
|
+ ))
|
|
|
|
|
+ await self._dispatch(adapter, "@bob @carol schaut mal drüber")
|
|
|
|
|
+ adapter.handle_message.assert_not_called()
|
|
|
|
|
+ adapter.add_reaction.assert_awaited_once()
|
|
|
|
|
+
|
|
|
|
|
+ async def test_a_real_handle_after_an_unknown_one_still_counts(self):
|
|
|
|
|
+ """The scan must not stop at the first token it cannot resolve."""
|
|
|
|
|
+ adapter = self._adapter()
|
|
|
|
|
+ await self._dispatch(adapter, "@nonexistent @bob schaut mal drüber")
|
|
|
|
|
+ adapter.handle_message.assert_not_called()
|
|
|
|
|
+ adapter.add_reaction.assert_awaited_once()
|
|
|
|
|
+
|
|
|
|
|
+ async def test_being_named_among_several_others_still_answers(self):
|
|
|
|
|
+ adapter = self._adapter()
|
|
|
|
|
+ await self._dispatch(adapter, "@bob @hermes_bot @carol — was meint ihr?")
|
|
|
|
|
+ adapter.handle_message.assert_called_once()
|
|
|
|
|
+ adapter.add_reaction.assert_not_awaited()
|
|
|
|
|
+
|
|
|
|
|
+ async def test_broadcast_alongside_a_named_colleague_still_answers(self):
|
|
|
|
|
+ """@here keeps the bot in the audience; naming bob as well does not
|
|
|
|
|
+ remove it."""
|
|
|
|
|
+ adapter = self._adapter()
|
|
|
|
|
+ await self._dispatch(adapter, "@here @bob schaut mal drüber")
|
|
|
|
|
+ adapter.handle_message.assert_called_once()
|
|
|
|
|
+ adapter.add_reaction.assert_not_awaited()
|
|
|
|
|
+
|
|
|
async def test_broadcast_mentions_address_the_bot_too(self):
|
|
async def test_broadcast_mentions_address_the_bot_too(self):
|
|
|
adapter = self._adapter()
|
|
adapter = self._adapter()
|
|
|
for body in ("@here standup in 5", "@channel heads up", "@everyone hi"):
|
|
for body in ("@here standup in 5", "@channel heads up", "@everyone hi"):
|