mirror of
https://github.com/chatmail/core.git
synced 2026-04-05 23:22:11 +03:00
fix configure_canceled test
This commit is contained in:
@@ -297,7 +297,7 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, data):
|
||||
return ac, dict(configdict)
|
||||
|
||||
def get_online_configuring_account(self, mvbox=False, sentbox=False, move=False,
|
||||
pre_generated_key=True, quiet=False, config={}):
|
||||
pre_generated_key=True, quiet=False, config={}, start=True):
|
||||
ac, configdict = self.get_online_config(
|
||||
pre_generated_key=pre_generated_key, quiet=quiet)
|
||||
configdict.update(config)
|
||||
@@ -305,7 +305,8 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, data):
|
||||
configdict["mvbox_move"] = str(int(move))
|
||||
configdict["sentbox_watch"] = str(int(sentbox))
|
||||
ac.update_config(configdict)
|
||||
ac.start()
|
||||
if start:
|
||||
ac.start()
|
||||
return ac
|
||||
|
||||
def get_one_online_account(self, pre_generated_key=True, mvbox=False, move=False):
|
||||
|
||||
@@ -45,6 +45,7 @@ class ConfigureTracker:
|
||||
self._smtp_finished = Event()
|
||||
self._imap_finished = Event()
|
||||
self._ffi_events = []
|
||||
self._progress = Queue()
|
||||
|
||||
@account_hookimpl
|
||||
def ac_process_ffi_event(self, ffi_event):
|
||||
@@ -53,6 +54,8 @@ class ConfigureTracker:
|
||||
self._smtp_finished.set()
|
||||
elif ffi_event.name == "DC_EVENT_IMAP_CONNECTED":
|
||||
self._imap_finished.set()
|
||||
elif ffi_event.name == "DC_EVENT_CONFIGURE_PROGRESS":
|
||||
self._progress.put(ffi_event.data1)
|
||||
|
||||
@account_hookimpl
|
||||
def ac_configure_completed(self, success):
|
||||
@@ -66,6 +69,9 @@ class ConfigureTracker:
|
||||
""" wait until smtp is configured. """
|
||||
self._imap_finished.wait()
|
||||
|
||||
def wait_progress(self):
|
||||
return self._progress.get()
|
||||
|
||||
def wait_finish(self):
|
||||
""" wait until configure is completed.
|
||||
|
||||
|
||||
@@ -3,9 +3,10 @@ import pytest
|
||||
import os
|
||||
import queue
|
||||
import time
|
||||
from deltachat import const, Account
|
||||
from deltachat import const, Account, capi
|
||||
from deltachat.message import Message
|
||||
from deltachat.hookspec import account_hookimpl
|
||||
from deltachat.tracker import ConfigureTracker
|
||||
from datetime import datetime, timedelta
|
||||
from conftest import (wait_configuration_progress,
|
||||
wait_securejoin_inviter_progress)
|
||||
@@ -563,10 +564,12 @@ class TestOnlineAccount:
|
||||
assert msg3_in.is_encrypted()
|
||||
|
||||
def test_configure_canceled(self, acfactory):
|
||||
ac1 = acfactory.get_online_configuring_account()
|
||||
wait_configuration_progress(ac1, 200)
|
||||
ac1.stop_ongoing()
|
||||
wait_configuration_progress(ac1, 0, 0)
|
||||
ac1 = acfactory.get_online_configuring_account(start=False)
|
||||
with ac1.temp_plugin(ConfigureTracker()) as config_tracker:
|
||||
capi.lib.dc_configure(ac1._dc_context)
|
||||
config_tracker.wait_progress()
|
||||
ac1.stop_ongoing()
|
||||
config_tracker.wait_finish()
|
||||
|
||||
def test_export_import_self_keys(self, acfactory, tmpdir):
|
||||
ac1, ac2 = acfactory.get_two_online_accounts()
|
||||
|
||||
Reference in New Issue
Block a user