Skip to content

Commit 86c8ebb

Browse files
committed
fix tests
1 parent cd38bdb commit 86c8ebb

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

tests/test_bot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def test_sendMessage_no_web_page_preview(self):
8585
@flaky(3, 1)
8686
@timeout(10)
8787
def testGetUpdates(self):
88+
self._bot.delete_webhook() # make sure there is no webhook set if webhook tests failed
8889
updates = self._bot.getUpdates(timeout=1)
8990

9091
if updates:

tests/test_updater.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -801,15 +801,29 @@ def mockUpdate(self, text):
801801

802802
return update
803803

804-
def setWebhook(self, webhook_url=None, certificate=None):
804+
def setWebhook(self, url=None, certificate=None):
805805
if self.bootstrap_retries is None:
806806
return
807807

808808
if self.bootstrap_attempts < self.bootstrap_retries:
809809
self.bootstrap_attempts += 1
810810
raise self.bootstrap_err
811811

812-
def getUpdates(self, offset=None, limit=100, timeout=0, network_delay=None, read_latency=2.):
812+
def deleteWebhook(self):
813+
if self.bootstrap_retries is None:
814+
return
815+
816+
if self.bootstrap_attempts < self.bootstrap_retries:
817+
self.bootstrap_attempts += 1
818+
raise self.bootstrap_err
819+
820+
def getUpdates(self,
821+
offset=None,
822+
limit=100,
823+
timeout=0,
824+
network_delay=None,
825+
read_latency=2.,
826+
allowed_updates=None):
813827

814828
if self.raise_error:
815829
raise TelegramError('Test Error 2')

0 commit comments

Comments
 (0)