refine test / chat API

This commit is contained in:
holger krekel
2020-06-08 14:16:40 +02:00
parent b6cc44a956
commit d8bbe2fcce
6 changed files with 34 additions and 47 deletions

View File

@@ -127,6 +127,12 @@ class FFIEventTracker:
if ev.data2 > 0:
return self.account.get_message_by_id(ev.data2)
def wait_msg_delivered(self, msg):
ev = self.get_matching("DC_EVENT_MSG_DELIVERED")
assert ev.data1 == msg.chat.id
assert ev.data2 == msg.id
assert msg.is_out_delivered()
class EventThread(threading.Thread):
""" Event Thread for an account.

View File

@@ -53,15 +53,15 @@ class Message(object):
lib.dc_msg_unref
))
def accept_sender_contact(self):
""" ensure that the sender is an accepted contact
and that the message has a non-deaddrop chat object.
def create_chat(self):
""" create a chat from a message (eg Contact-Request message).
"""
self.account.create_chat_by_message(self)
chat = self.account.create_chat_by_message(self)
self._dc_msg = ffi.gc(
lib.dc_get_msg(self.account._dc_context, self.id),
lib.dc_msg_unref
)
return chat
@props.with_doc
def text(self):