mirror of
https://github.com/chatmail/core.git
synced 2026-04-18 05:56:31 +03:00
start some docs
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user