mirror of
https://github.com/chatmail/core.git
synced 2026-04-06 07:32:12 +03:00
test: add get_protected_chat to testplugin.py
This commit is contained in:
@@ -10,6 +10,7 @@ import time
|
||||
import weakref
|
||||
import random
|
||||
from queue import Queue
|
||||
from threading import Event
|
||||
from typing import Callable, Dict, List, Optional, Set
|
||||
|
||||
import pytest
|
||||
@@ -590,6 +591,25 @@ class ACFactory:
|
||||
ac2.create_chat(ac1)
|
||||
return ac1.create_chat(ac2)
|
||||
|
||||
def get_protected_chat(self, ac1: Account, ac2: Account):
|
||||
class SetupPlugin:
|
||||
def __init__(self) -> None:
|
||||
self.member_added = Event()
|
||||
|
||||
@account_hookimpl
|
||||
def ac_member_added(self, chat: deltachat.Chat, contact, actor, message):
|
||||
self.member_added.set()
|
||||
|
||||
setupplugin = SetupPlugin()
|
||||
ac1.add_account_plugin(setupplugin)
|
||||
chat = ac1.create_group_chat("Protected Group", verified=True)
|
||||
qr = chat.get_join_qr()
|
||||
ac2.qr_join_chat(qr)
|
||||
setupplugin.member_added.wait(timeout=30)
|
||||
ac2.wait_next_incoming_message()
|
||||
ac2.wait_next_incoming_message()
|
||||
return chat
|
||||
|
||||
def introduce_each_other(self, accounts, sending=True):
|
||||
to_wait = []
|
||||
for i, acc in enumerate(accounts):
|
||||
|
||||
Reference in New Issue
Block a user