From 79448056278058a6d7149031d5e530f2a3f2ae8f Mon Sep 17 00:00:00 2001 From: Jasmin Bom Date: Mon, 1 Apr 2019 13:05:45 +0200 Subject: [PATCH] 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 --- tests/test_bot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_bot.py b/tests/test_bot.py index a1a2522f7..6c54453c5 100644 --- a/tests/test_bot.py +++ b/tests/test_bot.py @@ -38,7 +38,9 @@ HIGHSCORE_DELTA = 1450000000 @pytest.fixture(scope='class') 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) @@ -101,7 +103,7 @@ class TestBot(object): @flaky(3, 1) @pytest.mark.timeout(10) 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 bot.delete_message(chat_id=chat_id, message_id=1)