mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 04:46:29 +03:00
Add test_mark_bcc_read_on_server
This commit is contained in:
@@ -28,7 +28,8 @@ class ImapConn():
|
|||||||
self.connection.login(user, pw)
|
self.connection.login(user, pw)
|
||||||
messages = self.reselect_folder()
|
messages = self.reselect_folder()
|
||||||
try:
|
try:
|
||||||
self.original_msg_count = messages[0]
|
self.original_msg_count = int(messages[0])
|
||||||
|
print("dbg", str(messages))
|
||||||
except IndexError:
|
except IndexError:
|
||||||
self.original_msg_count = 0
|
self.original_msg_count = 0
|
||||||
|
|
||||||
@@ -64,7 +65,7 @@ class ImapConn():
|
|||||||
def get_new_email_cnt(self):
|
def get_new_email_cnt(self):
|
||||||
messages = self.reselect_folder()
|
messages = self.reselect_folder()
|
||||||
try:
|
try:
|
||||||
return messages[0] - self.original_msg_count
|
return int(messages[0]) - self.original_msg_count
|
||||||
except IndexError:
|
except IndexError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
@@ -77,8 +78,15 @@ class ImapConn():
|
|||||||
return messages
|
return messages
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
# self.connection.close()
|
try:
|
||||||
|
self.connection.close()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
self.connection.logout()
|
self.connection.logout()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def make_direct_imap(account, folder):
|
def make_direct_imap(account, folder):
|
||||||
conn_info = (account.get_config("configured_mail_server"),
|
conn_info = (account.get_config("configured_mail_server"),
|
||||||
|
|||||||
@@ -647,7 +647,7 @@ class TestOnlineAccount:
|
|||||||
ac2.start_io()
|
ac2.start_io()
|
||||||
|
|
||||||
imap2 = make_direct_imap(ac2, direct_imap.MVBOX)
|
imap2 = make_direct_imap(ac2, direct_imap.MVBOX)
|
||||||
imap2.mark_all_read()
|
#imap2.mark_all_read()
|
||||||
assert imap2.get_unread_cnt() == 0
|
assert imap2.get_unread_cnt() == 0
|
||||||
|
|
||||||
chat = self.get_chat(ac1, ac2)
|
chat = self.get_chat(ac1, ac2)
|
||||||
@@ -660,25 +660,62 @@ class TestOnlineAccount:
|
|||||||
|
|
||||||
assert list(ac2.get_fresh_messages())
|
assert list(ac2.get_fresh_messages())
|
||||||
|
|
||||||
for i in range(0, 30):
|
for i in range(0, 20):
|
||||||
if imap2.get_unread_cnt() == 1:
|
if imap2.get_unread_cnt() == 1:
|
||||||
break
|
break
|
||||||
time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core
|
time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core
|
||||||
assert imap2.get_unread_cnt() == 1
|
assert imap2.get_unread_cnt() == 1
|
||||||
|
|
||||||
incoming_on_ac2.mark_seen()
|
|
||||||
chat_on_ac2.mark_noticed()
|
chat_on_ac2.mark_noticed()
|
||||||
|
incoming_on_ac2.mark_seen()
|
||||||
ac2._evtracker.wait_next_messages_changed()
|
ac2._evtracker.wait_next_messages_changed()
|
||||||
|
|
||||||
assert not list(ac2.get_fresh_messages())
|
assert not list(ac2.get_fresh_messages())
|
||||||
|
|
||||||
# The new messages should be seen now.
|
# The new messages should be seen now.
|
||||||
for i in range(0, 30):
|
for i in range(0, 20):
|
||||||
if imap2.get_unread_cnt() == 0:
|
if imap2.get_unread_cnt() == 0:
|
||||||
break
|
break
|
||||||
time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core
|
time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core
|
||||||
assert imap2.get_unread_cnt() == 0
|
assert imap2.get_unread_cnt() == 0
|
||||||
|
|
||||||
|
#print_imap_structure(ac1.db_path)
|
||||||
|
|
||||||
|
def test_mark_bcc_read_on_server(self, acfactory, lp):
|
||||||
|
ac1 = acfactory.get_online_configuring_account(mvbox=True, move=True)
|
||||||
|
ac2 = acfactory.get_online_configuring_account()
|
||||||
|
|
||||||
|
ac1.wait_configure_finish()
|
||||||
|
ac1.start_io()
|
||||||
|
ac2.wait_configure_finish()
|
||||||
|
ac2.start_io()
|
||||||
|
|
||||||
|
imap1 = make_direct_imap(ac1, direct_imap.MVBOX)
|
||||||
|
#imap1.mark_all_read()
|
||||||
|
assert imap1.get_unread_cnt() == 0
|
||||||
|
|
||||||
|
chat = self.get_chat(ac1, ac2)
|
||||||
|
|
||||||
|
ac1.set_config("bcc_self", "1")
|
||||||
|
chat.send_text("Text message")
|
||||||
|
|
||||||
|
ac1._evtracker.get_matching("DC_EVENT_SMTP_MESSAGE_SENT")
|
||||||
|
|
||||||
|
for i in range(0, 20):
|
||||||
|
if imap1.get_new_email_cnt() == 1:
|
||||||
|
break
|
||||||
|
time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core
|
||||||
|
assert imap1.get_new_email_cnt() == 1
|
||||||
|
|
||||||
|
for i in range(0, 20):
|
||||||
|
if imap1.get_unread_cnt() == 0:
|
||||||
|
break
|
||||||
|
time.sleep(1) # We might need to wait because Imaplib is slower than DC-Core
|
||||||
|
|
||||||
|
#print_imap_structure(ac1.db_path)
|
||||||
|
|
||||||
|
assert imap1.get_unread_cnt() == 0
|
||||||
|
|
||||||
def test_send_file_twice_unicode_filename_mangling(self, tmpdir, acfactory, lp):
|
def test_send_file_twice_unicode_filename_mangling(self, tmpdir, acfactory, lp):
|
||||||
ac1, ac2 = acfactory.get_two_online_accounts()
|
ac1, ac2 = acfactory.get_two_online_accounts()
|
||||||
chat = self.get_chat(ac1, ac2)
|
chat = self.get_chat(ac1, ac2)
|
||||||
|
|||||||
Reference in New Issue
Block a user