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