@@ -162,6 +162,7 @@ def test_html_message(acfactory, lp):
162162
163163def test_webxdc_message (acfactory , data , lp ):
164164 ac1 , ac2 = acfactory .get_online_accounts (2 )
165+ ac2 .set_config ("bcc_self" , "1" )
165166 chat = acfactory .get_accepted_chat (ac1 , ac2 )
166167
167168 lp .sec ("ac1: prepare and send text message to ac2" )
@@ -512,6 +513,8 @@ def test_send_and_receive_message_markseen(acfactory, lp):
512513 # make DC's life harder wrt to encodings
513514 ac1 .set_config ("displayname" , "ä name" )
514515
516+ ac2 .set_config ("bcc_self" , "1" )
517+
515518 # clear any fresh device messages
516519 ac1 .get_device_chat ().mark_noticed ()
517520 ac2 .get_device_chat ().mark_noticed ()
@@ -569,9 +572,6 @@ def test_send_and_receive_message_markseen(acfactory, lp):
569572 assert ev .data2 > dc .const .DC_MSG_ID_LAST_SPECIAL
570573 lp .step ("2" )
571574
572- # Check that ac1 marks the read receipt as read.
573- ac1 ._evtracker .get_info_contains ("Marked messages .* in folder INBOX as seen." )
574-
575575 assert msg1 .is_out_mdn_received ()
576576 assert msg3 .is_out_mdn_received ()
577577
@@ -587,7 +587,7 @@ def test_send_and_receive_message_markseen(acfactory, lp):
587587def test_moved_markseen (acfactory ):
588588 """Test that message already moved to DeltaChat folder is marked as seen."""
589589 ac1 = acfactory .new_online_configuring_account ()
590- ac2 = acfactory .new_online_configuring_account (mvbox_move = True )
590+ ac2 = acfactory .new_online_configuring_account (mvbox_move = True , bcc_self = True )
591591 acfactory .bring_accounts_online ()
592592
593593 ac2 .stop_io ()
@@ -652,31 +652,35 @@ def test_message_override_sender_name(acfactory, lp):
652652
653653
654654@pytest .mark .parametrize ("mvbox_move" , [True , False ])
655- def test_markseen_message_and_mdn (acfactory , mvbox_move ):
655+ def test_markseen_message (acfactory , mvbox_move ):
656656 # Please only change this test if you are very sure that it will still catch the issues it catches now.
657657 # We had so many problems with markseen, if in doubt, rather create another test, it can't harm.
658658 ac1 = acfactory .new_online_configuring_account (mvbox_move = mvbox_move )
659659 ac2 = acfactory .new_online_configuring_account (mvbox_move = mvbox_move )
660660 acfactory .bring_accounts_online ()
661- # Do not send BCC to self, we only want to test MDN on ac1.
662- ac1 . set_config ( "bcc_self" , "0" )
661+ ac2 . set_config ( "bcc_self" , "1" )
662+ ac2 . stop_io ( )
663663
664664 acfactory .get_accepted_chat (ac1 , ac2 ).send_text ("hi" )
665+ # We only want to test MDN on ac1, so set "bcc_self" after sending.
666+ ac1 .set_config ("bcc_self" , "1" )
667+
668+ ac2 .start_io ()
665669 msg = ac2 ._evtracker .wait_next_incoming_message ()
666670
667671 ac2 .mark_seen_messages ([msg ])
668672
669673 folder = "mvbox" if mvbox_move else "inbox"
670- for ac in [ ac1 , ac2 ] :
671- if mvbox_move :
672- ac . _evtracker . get_info_contains ( "Marked messages [0-9]+ in folder DeltaChat as seen." )
673- else :
674- ac ._evtracker .get_info_contains ( "Marked messages [0-9]+ in folder INBOX as seen. " )
674+ if mvbox_move :
675+ ac2 . _evtracker . get_info_contains ( "Marked messages [0-9]+ in folder DeltaChat as seen." )
676+ else :
677+ ac2 . _evtracker . get_info_contains ( "Marked messages [0-9]+ in folder INBOX as seen." )
678+ ac1 ._evtracker .get_matching ( "DC_EVENT_MSG_READ " )
675679 ac1 .direct_imap .select_config_folder (folder )
676680 ac2 .direct_imap .select_config_folder (folder )
677681
678- # Check that the mdn is marked as seen
679- assert len (list (ac1 .direct_imap .conn .fetch (AND (seen = True )))) == 1
682+ # Check that the mdn isn't marked as seen
683+ assert len (list (ac1 .direct_imap .conn .fetch (AND (seen = True )))) == 0
680684 # Check original message is marked as seen
681685 assert len (list (ac2 .direct_imap .conn .fetch (AND (seen = True )))) == 1
682686
@@ -715,15 +719,17 @@ def test_mdn_asymmetric(acfactory, lp):
715719 chat = ac1 .create_chat (ac2 )
716720 ac2 .create_chat (ac1 )
717721
718- # make sure mdns are enabled (usually enabled by default already)
719- ac1 .set_config ("mdns_enabled" , "1" )
720- ac2 .set_config ("mdns_enabled" , "1" )
722+ ac1 .set_config ("bcc_self" , "1" )
723+ ac2 .set_config ("bcc_self" , "1" )
721724
722725 lp .sec ("sending text message from ac1 to ac2" )
723726 msg_out = chat .send_text ("message1" )
724727
725728 assert len (chat .get_messages ()) == 1 + E2EE_INFO_MSGS
726729
730+ # Wait for the message to be marked as seen on IMAP.
731+ ac1 ._evtracker .get_info_contains ("Marked messages [0-9]+ in folder DeltaChat as seen." )
732+
727733 lp .sec ("disable ac1 MDNs" )
728734 ac1 .set_config ("mdns_enabled" , "0" )
729735
@@ -735,16 +741,17 @@ def test_mdn_asymmetric(acfactory, lp):
735741 lp .sec ("ac2: mark incoming message as seen" )
736742 ac2 .mark_seen_messages ([msg ])
737743
744+ # Wait for the message to be marked as seen on IMAP.
745+ ac2 ._evtracker .get_info_contains ("Marked messages [0-9]+ in folder INBOX as seen." )
746+
738747 lp .sec ("ac1: waiting for incoming activity" )
739748 # MDN should be moved even though MDNs are already disabled
740749 ac1 ._evtracker .get_matching ("DC_EVENT_IMAP_MESSAGE_MOVED" )
741750
742751 assert len (chat .get_messages ()) == 1 + E2EE_INFO_MSGS
743752
744- # Wait for the message to be marked as seen on IMAP.
745- ac1 ._evtracker .get_info_contains ("Marked messages [0-9]+ in folder DeltaChat as seen." )
746-
747753 # MDN is received even though MDNs are already disabled
754+ ac1 ._evtracker .get_matching ("DC_EVENT_MSG_READ" )
748755 assert msg_out .is_out_mdn_received ()
749756
750757 ac1 .direct_imap .select_config_folder ("mvbox" )
0 commit comments