Debian Codegraph @

tests/poller_test.py

raw
1 import time
2 from os import path
3
4 CURRENT_FILE_DIR = path.dirname(path.realpath(__file__))
5 extra_plugin_dir = path.join(CURRENT_FILE_DIR, "poller_plugin")
6
7
8 def test_delayed_hello(testbot):
9 assert "Hello, world!" in testbot.exec_command("!hello")
10 time.sleep(1)
11 delayed_msg = "Hello world! was sent 5 seconds ago"
12 assert delayed_msg in testbot.pop_message(timeout=1)
13 # Assert that only one message has been enqueued
14 assert testbot.bot.outgoing_message_queue.empty()
15
16
17 def test_delayed_hello_loop(testbot):
18 assert "Hello, world!" in testbot.exec_command("!hello_loop")
19 time.sleep(1)
20 delayed_msg = "Hello world! was sent 5 seconds ago"
21 assert delayed_msg in testbot.pop_message(timeout=1)
22 # Assert that only one message has been enqueued
23 assert testbot.bot.outgoing_message_queue.empty()