diff --git a/tests/test_boteventhandler.py b/tests/test_boteventhandler.py index a87ded12f..82e3fcd4a 100644 --- a/tests/test_boteventhandler.py +++ b/tests/test_boteventhandler.py @@ -78,6 +78,14 @@ class BotEventHandlerTest(BaseTest, unittest.TestCase): self.received_message = update self.message_count += 1 + def additionalArgsTest(self, bot, update, update_queue, args): + self.received_message = update + self.message_count += 1 + if args[0] == 'resend': + update_queue.put('/test5 noresend') + elif args[0] == 'noresend': + pass + def errorHandlerTest(self, bot, update, error): self.received_message = error self.message_count += 1 @@ -197,6 +205,18 @@ class BotEventHandlerTest(BaseTest, unittest.TestCase): self.assertEqual(self.received_message, 'Test4') self.assertEqual(self.message_count, 2) + def test_additionalArgs(self): + print('Testing additional arguments for handlers') + self.beh.bot = MockBot('') + self.beh.broadcaster.addStringCommandHandler( + 'test5', self.additionalArgsTest) + + queue = self.beh.start_polling(0.05) + queue.put('/test5 resend') + sleep(.2) + self.assertEqual(self.received_message, '/test5 noresend') + self.assertEqual(self.message_count, 2) + def test_webhook(self): print('Testing Webhook') self.beh.bot = MockBot('Test4', messages=2)