mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-13 19:27:58 +01:00
Fix bot tests
- telegram how throws an error if you try to reply to nonexistent msg - telegram also changed the message when you try to delete old msg
This commit is contained in:
parent
b5891a6a61
commit
7944805627
1 changed files with 4 additions and 2 deletions
|
@ -38,7 +38,9 @@ HIGHSCORE_DELTA = 1450000000
|
||||||
|
|
||||||
@pytest.fixture(scope='class')
|
@pytest.fixture(scope='class')
|
||||||
def message(bot, chat_id):
|
def message(bot, chat_id):
|
||||||
return bot.send_message(chat_id, 'Text', reply_to_message_id=1,
|
to_reply_to = bot.send_message(chat_id, 'Text',
|
||||||
|
disable_web_page_preview=True, disable_notification=True)
|
||||||
|
return bot.send_message(chat_id, 'Text', reply_to_message_id=to_reply_to.message_id,
|
||||||
disable_web_page_preview=True, disable_notification=True)
|
disable_web_page_preview=True, disable_notification=True)
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,7 +103,7 @@ class TestBot(object):
|
||||||
@flaky(3, 1)
|
@flaky(3, 1)
|
||||||
@pytest.mark.timeout(10)
|
@pytest.mark.timeout(10)
|
||||||
def test_delete_message_old_message(self, bot, chat_id):
|
def test_delete_message_old_message(self, bot, chat_id):
|
||||||
with pytest.raises(TelegramError, match='can\'t be deleted'):
|
with pytest.raises(TelegramError, match='Message to delete not found'):
|
||||||
# Considering that the first message is old enough
|
# Considering that the first message is old enough
|
||||||
bot.delete_message(chat_id=chat_id, message_id=1)
|
bot.delete_message(chat_id=chat_id, message_id=1)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue