start some docs

This commit is contained in:
holger krekel
2020-02-26 15:10:57 +01:00
parent fb33c31378
commit 6213917089
8 changed files with 71 additions and 9 deletions

View File

@@ -9,6 +9,7 @@ from deltachat import Account
from deltachat.tracker import ConfigureTracker
from deltachat import const
from deltachat.capi import lib
from deltachat.hookspec import PerAccount
from deltachat.eventlogger import FFIEventLogger
from _pytest.monkeypatch import MonkeyPatch
from ffi_event import FFIEventTracker
@@ -290,6 +291,18 @@ def lp():
return Printer()
@pytest.fixture
def make_plugin_recorder():
def make_plugin_recorder(account):
class HookImpl:
def __init__(self):
self.calls_member_added = []
@account_hookimpl
def member_added(self, chat, member):
self.calls_member_added.append(dict(chat=chat, member=member))
def wait_configuration_progress(account, min_target, max_target=1001):
min_target = min(min_target, max_target)
while 1:

View File

@@ -167,6 +167,17 @@ class TestOfflineChat:
else:
pytest.fail("could not find chat")
def test_add_member_event(self, ac1):
contact1 = ac1.create_contact("some1@hello.com", name="some1")
contact2 = ac1.create_contact("some2@hello.com", name="some2")
chat = ac1.create_group_chat(name="title1")
with make_plugin_recorder(ac1) as rec:
chat.add_contact(contact2)
kwargs = rec.get_first("member_added")
assert kwargs["chat"] == chat
assert kwargs["member"] == contact2
def test_group_chat_creation(self, ac1):
contact1 = ac1.create_contact("some1@hello.com", name="some1")
contact2 = ac1.create_contact("some2@hello.com", name="some2")