make direct_imap a permanent feature of online accounts

This commit is contained in:
holger krekel
2020-06-08 11:15:53 +02:00
parent d40f96ac65
commit 0105c831f1
6 changed files with 92 additions and 39 deletions

View File

@@ -7,9 +7,9 @@ def test_basic_imap_api(acfactory, tmpdir):
ac1, ac2 = acfactory.get_two_online_accounts()
chat12 = acfactory.get_chat(ac1, ac2)
imap2 = acfactory.new_imap_conn(ac2)
imap2 = ac2.direct_imap
imap2.idle()
ac2.direct_imap.idle()
chat12.send_text("hello")
ac2._evtracker.wait_next_incoming_message()
@@ -26,38 +26,33 @@ class TestDirectImap:
def test_mark_read_on_server(self, acfactory, lp):
ac1, ac2 = acfactory.get_two_online_accounts(move=False)
imap1 = acfactory.new_imap_conn(ac1, config_folder="inbox")
assert imap1.get_unread_cnt() == 0
chat12, chat21 = acfactory.get_chats(ac1, ac2)
# send a message and check IMAP read flag
imap1.idle()
ac1.direct_imap.idle()
chat21.send_text("Text message")
msg_in = ac1._evtracker.wait_next_incoming_message()
assert list(ac1.get_fresh_messages())
imap1.idle_check()
ac1.direct_imap.idle_check()
msg_in.mark_seen()
imap1.idle_check(terminate=True)
assert imap1.get_unread_cnt() == 0
ac1.direct_imap.idle_check(terminate=True)
assert ac1.direct_imap.get_unread_cnt() == 0
def test_mark_bcc_read_on_server(self, acfactory, lp):
ac1, ac2 = acfactory.get_two_online_accounts(move=True)
imap1_mvbox = acfactory.new_imap_conn(ac1, config_folder="mvbox")
chat = acfactory.get_chat(ac1, ac2)
ac1.set_config("bcc_self", "1")
# wait for seen/read message to appear in mvbox
imap1_mvbox.idle()
ac1.direct_imap.select_config_folder("mvbox")
ac1.direct_imap.idle()
chat.send_text("Text message")
ac1._evtracker.get_matching("DC_EVENT_SMTP_MESSAGE_SENT")
while 1:
res = imap1_mvbox.idle_check()
res = ac1.direct_imap.idle_check()
for item in res:
uid = item[0]
if item[1] == FETCH:
if item[2][0] == FLAGS and SEEN in item[2][1]:
return