Exemplo n.º 1
0
 async def test_on_message_from_other(self):
     bot = GatherBot('testuser')
     regex = r'^test'
     action = get_mock_coro(True)
     bot.actions = {regex: (re.compile(regex, re.IGNORECASE), action)}
     mock_message = mock.Mock()
     mock_message.author = 'anotheruser'
     mock_message.content = 'test'
     await bot.on_message(mock_message)
     self.assertTrue(action.called)
Exemplo n.º 2
0
 async def test_on_message_error(self):
     bot = GatherBot('testuser')
     regex = r'^test'
     action = get_mock_coro_throwing_exception(AssertionError, 'error')
     bot.actions = {regex: (re.compile(regex, re.IGNORECASE), action)}
     bot.say = get_mock_coro(True)
     mock_message = mock.Mock()
     mock_message.author = 'anotheruser'
     mock_message.content = 'test'
     await bot.on_message(mock_message)
     self.assertTrue(action.called)
     self.assertTrue(bot.say.called)