From f8282dbacabd50505dadfea805700705a919f4c3 Mon Sep 17 00:00:00 2001 From: David256 Date: Fri, 13 Dec 2024 04:11:42 -0500 Subject: [PATCH 1/3] Reset file seek to read again --- tests/test_telebot.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_telebot.py b/tests/test_telebot.py index 8b04ac402..de5172732 100644 --- a/tests/test_telebot.py +++ b/tests/test_telebot.py @@ -147,6 +147,9 @@ def test_send_file_with_filename(self): ret_msg = tb.send_document(CHAT_ID, file_data) assert ret_msg.message_id + # Reset the file + file_data.seek(0) + ret_msg = tb.send_document(CHAT_ID, file_data, visible_file_name="test.jpg") assert ret_msg.message_id From dc902931c6ac2650516270731a1843471a91ef24 Mon Sep 17 00:00:00 2001 From: David256 Date: Fri, 13 Dec 2024 04:12:22 -0500 Subject: [PATCH 2/3] Add missing required params as None to create an Update --- tests/test_telebot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_telebot.py b/tests/test_telebot.py index de5172732..604d8a7d5 100644 --- a/tests/test_telebot.py +++ b/tests/test_telebot.py @@ -553,7 +553,7 @@ def create_message_update(text): return types.Update(-1001234038283, message, edited_message, channel_post, edited_channel_post, inline_query, chosen_inline_result, callback_query, shipping_query, pre_checkout_query, poll, poll_answer, my_chat_member, chat_member, chat_join_request, message_reaction, message_reaction_count, chat_boost, chat_boost_removed, - purchased_paid_media) + purchased_paid_media, None, None, None, None) def test_is_string_unicode(self): s1 = u'string' From 172828d1a1f915645dcbfc21ccb8749f91e31a6a Mon Sep 17 00:00:00 2001 From: David256 Date: Fri, 13 Dec 2024 04:26:28 -0500 Subject: [PATCH 3/3] Set a dummy token --- tests/test_telebot.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_telebot.py b/tests/test_telebot.py index 604d8a7d5..698ed0b45 100644 --- a/tests/test_telebot.py +++ b/tests/test_telebot.py @@ -44,11 +44,11 @@ def test_message_listener(self): def listener(messages): assert len(messages) == 100 - tb = telebot.TeleBot('') + tb = telebot.TeleBot('10:need') tb.set_update_listener(listener) def test_message_handler(self): - tb = telebot.TeleBot('') + tb = telebot.TeleBot('10:need') msg = self.create_text_message('/help') @tb.message_handler(commands=['help', 'start']) @@ -60,7 +60,7 @@ def command_handler(message): assert msg.text == 'got' def test_message_handler_reg(self): - bot = telebot.TeleBot('') + bot = telebot.TeleBot('10:need') msg = self.create_text_message(r'https://web.telegram.org/') # noinspection PyUnusedLocal @@ -73,7 +73,7 @@ def command_url(message): assert msg.text == 'got' def test_message_handler_lambda(self): - bot = telebot.TeleBot('') + bot = telebot.TeleBot('10:need') msg = self.create_text_message(r'lambda_text') # noinspection PyUnusedLocal @@ -86,7 +86,7 @@ def command_url(message): assert msg.text == 'got' def test_message_handler_lambda_fail(self): - bot = telebot.TeleBot('') + bot = telebot.TeleBot('10:need') msg = self.create_text_message(r'text') # noinspection PyUnusedLocal @@ -99,7 +99,7 @@ def command_url(message): assert not msg.text == 'got' def test_message_handler_reg_fail(self): - bot = telebot.TeleBot('') + bot = telebot.TeleBot('10:need') msg = self.create_text_message(r'web.telegram.org/') # noinspection PyUnusedLocal @@ -660,7 +660,7 @@ def test_typed_middleware_handler(self): apihelper.ENABLE_MIDDLEWARE = True - tb = telebot.TeleBot('') + tb = telebot.TeleBot('10:need') update = self.create_message_update('/help') # noinspection PyUnusedLocal @@ -681,7 +681,7 @@ def test_default_middleware_handler(self): apihelper.ENABLE_MIDDLEWARE = True - tb = telebot.TeleBot('') + tb = telebot.TeleBot('10:need') update = self.create_message_update('/help') # noinspection PyUnusedLocal