diff --git a/deltachat-rpc-client/src/deltachat_rpc_client/account.py b/deltachat-rpc-client/src/deltachat_rpc_client/account.py index e65246c98..d0f87ee2f 100644 --- a/deltachat-rpc-client/src/deltachat_rpc_client/account.py +++ b/deltachat-rpc-client/src/deltachat_rpc_client/account.py @@ -87,6 +87,14 @@ class Account: """Configure an account.""" yield self._rpc.configure.future(self.id) + def bring_online(self): + """Start I/O and wait until IMAP becomes IDLE.""" + self.start_io() + while True: + event = self.wait_for_event() + if event.kind == EventType.IMAP_INBOX_IDLE: + break + def create_contact(self, obj: Union[int, str, Contact], name: Optional[str] = None) -> Contact: """Create a new Contact or return an existing one. diff --git a/deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py b/deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py index e8c4885d8..cbc933654 100644 --- a/deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py +++ b/deltachat-rpc-client/src/deltachat_rpc_client/pytestplugin.py @@ -54,11 +54,7 @@ class ACFactory: @futuremethod def get_online_account(self): account = yield self.new_configured_account.future() - account.start_io() - while True: - event = account.wait_for_event() - if event.kind == EventType.IMAP_INBOX_IDLE: - break + account.bring_online() return account def get_online_accounts(self, num: int) -> List[Account]: