mirror of
https://github.com/chatmail/core.git
synced 2026-04-05 23:22:11 +03:00
fix a couple of issues wrt to configuring move/mvbox behaviour in tests
This commit is contained in:
@@ -223,27 +223,28 @@ def acfactory(pytestconfig, tmpdir, request, session_liveconfig, datadir):
|
||||
ac._evtracker.set_timeout(30)
|
||||
return ac, dict(configdict)
|
||||
|
||||
def get_online_configuring_account(self, mvbox=False, sentbox=False,
|
||||
def get_online_configuring_account(self, mvbox=False, sentbox=False, move=False,
|
||||
pre_generated_key=True, config={}):
|
||||
ac, configdict = self.get_online_config(
|
||||
pre_generated_key=pre_generated_key)
|
||||
configdict.update(config)
|
||||
configdict["mvbox_watch"] = str(int(mvbox))
|
||||
configdict["mvbox_move"] = "1"
|
||||
configdict["mvbox_move"] = str(int(move))
|
||||
configdict["sentbox_watch"] = str(int(sentbox))
|
||||
ac.update_config(configdict)
|
||||
ac.start()
|
||||
return ac
|
||||
|
||||
def get_one_online_account(self, pre_generated_key=True):
|
||||
def get_one_online_account(self, pre_generated_key=True, mvbox=False, move=False):
|
||||
ac1 = self.get_online_configuring_account(
|
||||
pre_generated_key=pre_generated_key)
|
||||
pre_generated_key=pre_generated_key, mvbox=mvbox, move=move)
|
||||
ac1._configtracker.wait_imap_connected()
|
||||
ac1._configtracker.wait_smtp_connected()
|
||||
ac1._configtracker.wait_finish()
|
||||
return ac1
|
||||
|
||||
def get_two_online_accounts(self):
|
||||
ac1 = self.get_online_configuring_account()
|
||||
def get_two_online_accounts(self, move=False):
|
||||
ac1 = self.get_online_configuring_account(move=True)
|
||||
ac2 = self.get_online_configuring_account()
|
||||
ac1._configtracker.wait_finish()
|
||||
ac2._configtracker.wait_finish()
|
||||
|
||||
@@ -497,7 +497,7 @@ class TestOnlineAccount:
|
||||
for x in export_files:
|
||||
assert x.startswith(dir.strpath)
|
||||
ac1._evtracker.consume_events()
|
||||
ac1.import_self_keys(dir.strpath)
|
||||
ac2.import_self_keys(dir.strpath)
|
||||
|
||||
def test_one_account_send_bcc_setting(self, acfactory, lp):
|
||||
ac1 = acfactory.get_online_configuring_account()
|
||||
@@ -607,7 +607,7 @@ class TestOnlineAccount:
|
||||
|
||||
def test_mvbox_sentbox_threads(self, acfactory, lp):
|
||||
lp.sec("ac1: start with mvbox thread")
|
||||
ac1 = acfactory.get_online_configuring_account(mvbox=True, sentbox=True)
|
||||
ac1 = acfactory.get_online_configuring_account(mvbox=True, move=True, sentbox=True)
|
||||
|
||||
lp.sec("ac2: start without mvbox/sentbox threads")
|
||||
ac2 = acfactory.get_online_configuring_account()
|
||||
@@ -627,7 +627,7 @@ class TestOnlineAccount:
|
||||
|
||||
def test_move_works(self, acfactory):
|
||||
ac1 = acfactory.get_online_configuring_account()
|
||||
ac2 = acfactory.get_online_configuring_account(mvbox=True)
|
||||
ac2 = acfactory.get_online_configuring_account(mvbox=True, move=True)
|
||||
wait_configuration_progress(ac2, 1000)
|
||||
wait_configuration_progress(ac1, 1000)
|
||||
chat = self.get_chat(ac1, ac2)
|
||||
@@ -637,7 +637,7 @@ class TestOnlineAccount:
|
||||
ac2._evtracker.get_matching("DC_EVENT_IMAP_MESSAGE_MOVED")
|
||||
|
||||
def test_move_works_on_self_sent(self, acfactory):
|
||||
ac1 = acfactory.get_online_configuring_account(mvbox=True)
|
||||
ac1 = acfactory.get_online_configuring_account(mvbox=True, move=True)
|
||||
ac1.set_config("bcc_self", "1")
|
||||
ac2 = acfactory.get_online_configuring_account()
|
||||
wait_configuration_progress(ac2, 1000)
|
||||
@@ -708,16 +708,16 @@ class TestOnlineAccount:
|
||||
assert msg_in.is_forwarded()
|
||||
|
||||
def test_send_self_message_and_empty_folder(self, acfactory, lp):
|
||||
ac1 = acfactory.get_one_online_account()
|
||||
ac1 = acfactory.get_one_online_account(mvbox=True, move=True)
|
||||
lp.sec("ac1: create self chat")
|
||||
chat = ac1.create_chat_by_contact(ac1.get_self_contact())
|
||||
chat.send_text("hello")
|
||||
ac1._evtracker.get_matching("DC_EVENT_SMTP_MESSAGE_SENT")
|
||||
ac1.empty_server_folders(inbox=True, mvbox=True)
|
||||
ev = ac1._evtracker.get_matching("DC_EVENT_IMAP_FOLDER_EMPTIED")
|
||||
assert ev.data2 == "DeltaChat"
|
||||
ev = ac1._evtracker.get_matching("DC_EVENT_IMAP_FOLDER_EMPTIED")
|
||||
assert ev.data2 == "INBOX"
|
||||
ev1 = ac1._evtracker.get_matching("DC_EVENT_IMAP_FOLDER_EMPTIED")
|
||||
ev2 = ac1._evtracker.get_matching("DC_EVENT_IMAP_FOLDER_EMPTIED")
|
||||
boxes = sorted([ev1.data2, ev2.data2])
|
||||
assert boxes == ["DeltaChat", "INBOX"]
|
||||
|
||||
def test_send_and_receive_message_markseen(self, acfactory, lp):
|
||||
ac1, ac2 = acfactory.get_two_online_accounts()
|
||||
@@ -789,7 +789,7 @@ class TestOnlineAccount:
|
||||
pass # mark_seen_messages() has generated events before it returns
|
||||
|
||||
def test_mdn_asymetric(self, acfactory, lp):
|
||||
ac1, ac2 = acfactory.get_two_online_accounts()
|
||||
ac1, ac2 = acfactory.get_two_online_accounts(move=True)
|
||||
|
||||
lp.sec("ac1: create chat with ac2")
|
||||
chat = self.get_chat(ac1, ac2, both_created=True)
|
||||
@@ -1477,8 +1477,8 @@ class TestGroupStressTests:
|
||||
class TestOnlineConfigureFails:
|
||||
def test_invalid_password(self, acfactory):
|
||||
ac1, configdict = acfactory.get_online_config()
|
||||
ac1.configure(addr=configdict["addr"], mail_pw="123")
|
||||
ac1.start_threads()
|
||||
ac1.update_config(dict(addr=configdict["addr"], mail_pw="123"))
|
||||
ac1.start()
|
||||
wait_configuration_progress(ac1, 500)
|
||||
ev = ac1._evtracker.get_matching("DC_EVENT_ERROR_NETWORK")
|
||||
assert "cannot login" in ev.data2.lower()
|
||||
@@ -1486,8 +1486,8 @@ class TestOnlineConfigureFails:
|
||||
|
||||
def test_invalid_user(self, acfactory):
|
||||
ac1, configdict = acfactory.get_online_config()
|
||||
ac1.configure(addr="x" + configdict["addr"], mail_pw=configdict["mail_pw"])
|
||||
ac1.start_threads()
|
||||
ac1.update_config(dict(addr="x" + configdict["addr"], mail_pw=configdict["mail_pw"]))
|
||||
ac1.start()
|
||||
wait_configuration_progress(ac1, 500)
|
||||
ev = ac1._evtracker.get_matching("DC_EVENT_ERROR_NETWORK")
|
||||
assert "cannot login" in ev.data2.lower()
|
||||
@@ -1495,8 +1495,8 @@ class TestOnlineConfigureFails:
|
||||
|
||||
def test_invalid_domain(self, acfactory):
|
||||
ac1, configdict = acfactory.get_online_config()
|
||||
ac1.configure(addr=configdict["addr"] + "x", mail_pw=configdict["mail_pw"])
|
||||
ac1.start_threads()
|
||||
ac1.update_config((dict(addr=configdict["addr"] + "x", mail_pw=configdict["mail_pw"])))
|
||||
ac1.start()
|
||||
wait_configuration_progress(ac1, 500)
|
||||
ev = ac1._evtracker.get_matching("DC_EVENT_ERROR_NETWORK")
|
||||
assert "could not connect" in ev.data2.lower()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import print_function
|
||||
from deltachat import capi, cutil, const, set_context_callback, clear_context_callback
|
||||
from deltachat import register_global_plugin
|
||||
from deltachat.hookspec import account_hookimpl, global_hookimpl
|
||||
from deltachat.hookspec import global_hookimpl
|
||||
from deltachat.capi import ffi
|
||||
from deltachat.capi import lib
|
||||
|
||||
|
||||
Reference in New Issue
Block a user