mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
merge direct imap tests into their already existing counterparts
This commit is contained in:
@@ -511,6 +511,25 @@ class TestOfflineChat:
|
|||||||
assert in_list[1][2] == contacts[3]
|
assert in_list[1][2] == contacts[3]
|
||||||
|
|
||||||
|
|
||||||
|
def test_basic_imap_api(acfactory, tmpdir):
|
||||||
|
ac1, ac2 = acfactory.get_two_online_accounts()
|
||||||
|
chat12 = acfactory.get_chat(ac1, ac2)
|
||||||
|
|
||||||
|
imap2 = ac2.direct_imap
|
||||||
|
|
||||||
|
ac2.direct_imap.idle_start()
|
||||||
|
chat12.send_text("hello")
|
||||||
|
ac2._evtracker.wait_next_incoming_message()
|
||||||
|
|
||||||
|
imap2.idle_check(terminate=True)
|
||||||
|
assert imap2.get_unread_cnt() == 1
|
||||||
|
imap2.mark_all_read()
|
||||||
|
assert imap2.get_unread_cnt() == 0
|
||||||
|
|
||||||
|
imap2.dump_imap_structures(tmpdir, logfile=sys.stdout)
|
||||||
|
imap2.shutdown()
|
||||||
|
|
||||||
|
|
||||||
class TestOnlineAccount:
|
class TestOnlineAccount:
|
||||||
@pytest.mark.ignored
|
@pytest.mark.ignored
|
||||||
def test_configure_generate_key(self, acfactory, lp):
|
def test_configure_generate_key(self, acfactory, lp):
|
||||||
@@ -852,7 +871,9 @@ class TestOnlineAccount:
|
|||||||
msg4 = ac2._evtracker.wait_next_incoming_message()
|
msg4 = ac2._evtracker.wait_next_incoming_message()
|
||||||
|
|
||||||
lp.sec("mark messages as seen on ac2, wait for changes on ac1")
|
lp.sec("mark messages as seen on ac2, wait for changes on ac1")
|
||||||
|
ac2.direct_imap.idle_start()
|
||||||
ac2.mark_seen_messages([msg2, msg4])
|
ac2.mark_seen_messages([msg2, msg4])
|
||||||
|
ac2.direct_imap.idle_check(terminate=True)
|
||||||
lp.step("1")
|
lp.step("1")
|
||||||
for i in range(2):
|
for i in range(2):
|
||||||
ev = ac1._evtracker.get_matching("DC_EVENT_MSG_READ")
|
ev = ac1._evtracker.get_matching("DC_EVENT_MSG_READ")
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
import sys
|
|
||||||
|
|
||||||
from deltachat.direct_imap import SEEN, FLAGS, FETCH
|
|
||||||
|
|
||||||
|
|
||||||
def test_basic_imap_api(acfactory, tmpdir):
|
|
||||||
ac1, ac2 = acfactory.get_two_online_accounts()
|
|
||||||
chat12 = acfactory.get_chat(ac1, ac2)
|
|
||||||
|
|
||||||
imap2 = ac2.direct_imap
|
|
||||||
|
|
||||||
ac2.direct_imap.idle_start()
|
|
||||||
chat12.send_text("hello")
|
|
||||||
ac2._evtracker.wait_next_incoming_message()
|
|
||||||
|
|
||||||
imap2.idle_check(terminate=True)
|
|
||||||
assert imap2.get_unread_cnt() == 1
|
|
||||||
imap2.mark_all_read()
|
|
||||||
assert imap2.get_unread_cnt() == 0
|
|
||||||
|
|
||||||
imap2.dump_imap_structures(tmpdir, logfile=sys.stdout)
|
|
||||||
imap2.shutdown()
|
|
||||||
|
|
||||||
|
|
||||||
class TestDirectImap:
|
|
||||||
def test_mark_read_on_server(self, acfactory, lp):
|
|
||||||
ac1, ac2 = acfactory.get_two_online_accounts(move=False)
|
|
||||||
|
|
||||||
chat12, chat21 = acfactory.get_chats(ac1, ac2)
|
|
||||||
|
|
||||||
# send a message and check IMAP read flag
|
|
||||||
ac1.direct_imap.idle_start()
|
|
||||||
chat21.send_text("Text message")
|
|
||||||
|
|
||||||
msg_in = ac1._evtracker.wait_next_incoming_message()
|
|
||||||
assert list(ac1.get_fresh_messages())
|
|
||||||
|
|
||||||
ac1.direct_imap.idle_check()
|
|
||||||
msg_in.mark_seen()
|
|
||||||
ac1.direct_imap.idle_check(terminate=True)
|
|
||||||
assert ac1.direct_imap.get_unread_cnt() == 0
|
|
||||||
Reference in New Issue
Block a user