X Tutup
Skip to content

Commit 8ac6669

Browse files
committed
test_bot.py: unit test setWebhook and deleteWebhook
1 parent c2c93f5 commit 8ac6669

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

tests/test_bot.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ def testGetChatMember(self):
291291

292292
@flaky(3, 1)
293293
@timeout(10)
294-
def test_forward_channel_messgae(self):
294+
def test_forward_channel_message(self):
295295
text = 'test forward message'
296296
msg = self._bot.sendMessage(self._channel_id, text)
297297
self.assertEqual(text, msg.text)
@@ -301,12 +301,25 @@ def test_forward_channel_messgae(self):
301301

302302
@flaky(3, 1)
303303
@timeout(10)
304-
def test_get_webhook_info(self):
304+
def test_set_webhook_get_webhook_info(self):
305305
url = 'https://python-telegram-bot.org/test/webhook'
306-
self._bot.set_webhook(url)
306+
max_connections = 7
307+
allowed_updates = ['message']
308+
self._bot.set_webhook(url, max_connections=7, allowed_updates=['message'])
307309
info = self._bot.getWebhookInfo()
308-
self._bot.set_webhook('')
310+
self._bot.delete_webhook()
309311
self.assertEqual(url, info.url)
312+
self.assertEqual(max_connections, info.max_connections)
313+
self.assertListEqual(allowed_updates, info.allowed_updates)
314+
315+
@flaky(3, 1)
316+
@timeout(10)
317+
def test_delete_webhook(self):
318+
url = 'https://python-telegram-bot.org/test/webhook'
319+
self._bot.set_webhook(url)
320+
self._bot.delete_webhook()
321+
info = self._bot.getWebhookInfo()
322+
self.assertEqual(info.url, '')
310323

311324
@flaky(3, 1)
312325
@timeout(10)

0 commit comments

Comments
 (0)
X Tutup