Skip to content

Commit

Permalink
Test for Update.idle()
Browse files Browse the repository at this point in the history
  • Loading branch information
jh0ker committed Nov 24, 2015
1 parent 1005ad5 commit e1f3f34
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_boteventhandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import unittest
import sys
import re
import os
import signal
from random import randrange
from time import sleep
from datetime import datetime
Expand Down Expand Up @@ -259,6 +261,21 @@ def test_webhook(self):
sleep(1)
self.assertEqual(self.received_message, 'Webhook Test')

def signalsender(self):
sleep(0.5)
os.kill(os.getpid(), signal.SIGTERM)

def test_idle(self):
print('Testing idle')
self.updater.bot = MockBot('Test4', messages=0)
self.updater.start_polling(poll_interval=0.01)
Thread(target=self.signalsender).start()
self.updater.idle()
# If we get this far, idle() ran through
sleep(1)
self.updater.running = False



class MockBot:

Expand Down

0 comments on commit e1f3f34

Please sign in to comment.