sipmlify plugins and tests and remove superflous core event

This commit is contained in:
holger krekel
2020-03-06 12:09:23 +01:00
parent 724e1ea97e
commit a1d5120e58
6 changed files with 53 additions and 55 deletions

View File

@@ -2,7 +2,8 @@
import threading
import pytest
import py
from echo_and_quit import main
import echo_and_quit
import group_tracking
@pytest.fixture(scope='session')
@@ -21,11 +22,13 @@ def test_echo_quit_plugin(acfactory):
def run_bot():
print("*"*20 + " starting bot")
main([
"-l",
print("*"*20 + " bot_ac.dbpath", bot_ac.db_path)
echo_and_quit.main([
"echo",
"--show-ffi",
"--db", bot_ac.db_path,
"--email", bot_cfg["addr"],
"--password", bot_cfg["mail_pw"],
"--db", bot_ac.db_path
])
t = threading.Thread(target=run_bot)
@@ -39,3 +42,32 @@ def test_echo_quit_plugin(acfactory):
assert "hello" in reply.text
ch1.send_text("/quit")
t.join()
@pytest.mark.skip(reason="not implemented")
def test_group_tracking_plugin(acfactory):
bot_ac, bot_cfg = acfactory.get_online_config()
def run_bot():
print("*"*20 + " starting bot")
print("*"*20 + " bot_ac.dbpath", bot_ac.db_path)
group_tracking.main([
"group-tracking",
"--show-ffi", bot_ac.db_path,
"--db", bot_ac.db_path,
"--email", bot_cfg["addr"],
"--password", bot_cfg["mail_pw"],
])
t = threading.Thread(target=run_bot)
t.setDaemon(1)
t.start()
ac1 = acfactory.get_one_online_account()
bot_contact = ac1.create_contact(bot_cfg["addr"])
ch1 = ac1.create_chat_by_contact(bot_contact)
ch1.send_text("hello")
ch1.add_contact(ac1.create_contact("x@example.org"))
# XXX wait for bot to receive things
t.join()