@@ -1014,26 +1014,25 @@ def check_account(ac, contact, inviter_side, please_wait_info_msg=False):
10141014 check_account (bob2 , bob2 .create_contact (alice ), inviter_side = False )
10151015
10161016
1017- def test_dont_show_emails (acfactory , lp ):
1017+ def test_dont_show_emails (acfactory , direct_imap , log ):
10181018 """Most mailboxes have a "Drafts" folder where constantly new emails appear but we don't actually want to show them.
10191019 So: If it's outgoing AND there is no Received header, then ignore the email.
10201020
10211021 If the draft email is sent out and received later (i.e. it's in "Inbox"), it must be shown.
10221022
10231023 Also, test that unknown emails in the Spam folder are not shown."""
1024- ac1 = acfactory .new_online_configuring_account ()
1024+ ac1 = acfactory .new_configured_account ()
1025+ ac1 .stop_io ()
10251026 ac1 .set_config ("show_emails" , "2" )
1026- ac1 .
create_contact (
"[email protected] " ).
create_chat ()
10271027
1028- acfactory .wait_configured (ac1 )
1029- ac1 .direct_imap .create_folder ("Drafts" )
1030- ac1 .direct_imap .create_folder ("Spam" )
1031- ac1 .direct_imap .create_folder ("Junk" )
1028+ ac1 .
create_contact (
"[email protected] " ).
create_chat ()
10321029
1033- acfactory .bring_accounts_online ()
1034- ac1 .stop_io ()
1030+ ac1_direct_imap = direct_imap (ac1 )
1031+ ac1_direct_imap .create_folder ("Drafts" )
1032+ ac1_direct_imap .create_folder ("Spam" )
1033+ ac1_direct_imap .create_folder ("Junk" )
10351034
1036- ac1 . direct_imap .append (
1035+ ac1_direct_imap .append (
10371036 "Drafts" ,
10381037 """
10391038 From: ac1 <{}>
@@ -1047,7 +1046,7 @@ def test_dont_show_emails(acfactory, lp):
10471046 ac1 .get_config ("configured_addr" ),
10481047 ),
10491048 )
1050- ac1 . direct_imap .append (
1049+ ac1_direct_imap .append (
10511050 "Spam" ,
10521051 """
10531052@@ -1061,7 +1060,7 @@ def test_dont_show_emails(acfactory, lp):
10611060 ac1 .get_config ("configured_addr" ),
10621061 ),
10631062 )
1064- ac1 . direct_imap .append (
1063+ ac1_direct_imap .append (
10651064 "Spam" ,
10661065 """
10671066@@ -1075,7 +1074,7 @@ def test_dont_show_emails(acfactory, lp):
10751074 ac1 .get_config ("configured_addr" ),
10761075 ),
10771076 )
1078- ac1 . direct_imap .append (
1077+ ac1_direct_imap .append (
10791078 "Spam" ,
10801079 """
10811080 From: delta<address: [email protected] > @@ -1089,7 +1088,7 @@ def test_dont_show_emails(acfactory, lp):
10891088 ac1 .get_config ("configured_addr" ),
10901089 ),
10911090 )
1092- ac1 . direct_imap .append (
1091+ ac1_direct_imap .append (
10931092 "Spam" ,
10941093 """
10951094@@ -1103,7 +1102,7 @@ def test_dont_show_emails(acfactory, lp):
11031102 ac1 .get_config ("configured_addr" ),
11041103 ),
11051104 )
1106- ac1 . direct_imap .append (
1105+ ac1_direct_imap .append (
11071106 "Junk" ,
11081107 """
11091108@@ -1119,15 +1118,17 @@ def test_dont_show_emails(acfactory, lp):
11191118 )
11201119
11211120 ac1 .set_config ("scan_all_folders_debounce_secs" , "0" )
1122- lp . sec ("All prepared, now let DC find the message" )
1121+ log . section ("All prepared, now let DC find the message" )
11231122 ac1 .start_io ()
11241123
11251124 # Wait until each folder was scanned, this is necessary for this test to test what it should test:
1126- ac1 ._evtracker . wait_idle_inbox_ready ( )
1125+ ac1 .wait_for_event ( EventType . IMAP_INBOX_IDLE )
11271126
11281127 fresh_msgs = list (ac1 .get_fresh_messages ())
11291128 msg = fresh_msgs [0 ]
1130- chat_msgs = msg .chat .get_messages ()
1129+ print (msg .get_snapshot ())
1130+ return
1131+ chat_msgs = msg .get_snapshot ().chat .get_messages ()
11311132 assert len (chat_msgs ) == 1
11321133 assert any (msg .text == "subj – Actually interesting message in Spam" for msg in chat_msgs )
11331134
0 commit comments