|
20 | 20 |
|
21 | 21 | import pytest |
22 | 22 |
|
23 | | -from telegram import Update, Message, User, Chat, CallbackQuery |
| 23 | +from telegram import (CallbackQuery, Chat, ChosenInlineResult, InlineQuery, Message, |
| 24 | + PreCheckoutQuery, ShippingQuery, Update, User) |
24 | 25 | from telegram.ext import (ConversationHandler, CommandHandler, CallbackQueryHandler) |
25 | 26 |
|
26 | 27 |
|
@@ -277,3 +278,19 @@ def test_channel_message_without_chat(self, bot): |
277 | 278 | message = Message(0, None, None, Chat(0, Chat.CHANNEL, 'Misses Test'), bot=bot) |
278 | 279 | update = Update(0, message=message) |
279 | 280 | assert not handler.check_update(update) |
| 281 | + |
| 282 | + def test_all_update_types(self, dp, bot, user1): |
| 283 | + handler = ConversationHandler(entry_points=[CommandHandler('start', self.start_end)], |
| 284 | + states={}, fallbacks=[]) |
| 285 | + message = Message(0, user1, None, self.group, text='ignore', bot=bot) |
| 286 | + callback_query = CallbackQuery(0, user1, None, message=message, data='data', bot=bot) |
| 287 | + chosen_inline_result = ChosenInlineResult(0, user1, 'query', bot=bot) |
| 288 | + inline_query = InlineQuery(0, user1, 'query', 0, bot=bot) |
| 289 | + pre_checkout_query = PreCheckoutQuery(0, user1, 'USD', 100, [], bot=bot) |
| 290 | + shipping_query = ShippingQuery(0, user1, [], None, bot=bot) |
| 291 | + assert not handler.check_update(Update(0, callback_query=callback_query)) |
| 292 | + assert not handler.check_update(Update(0, chosen_inline_result=chosen_inline_result)) |
| 293 | + assert not handler.check_update(Update(0, inline_query=inline_query)) |
| 294 | + assert not handler.check_update(Update(0, message=message)) |
| 295 | + assert not handler.check_update(Update(0, pre_checkout_query=pre_checkout_query)) |
| 296 | + assert not handler.check_update(Update(0, shipping_query=shipping_query)) |
0 commit comments