File: poller_test.py

package info (click to toggle)
errbot 6.1.7%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 3,712 kB
  • sloc: python: 13,831; makefile: 164; sh: 97
file content (23 lines) | stat: -rw-r--r-- 832 bytes parent folder | download | duplicates (4)
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()