@@ -4,7 +4,7 @@ use super::*;
44use crate :: chat:: { Chat , ProtectionStatus , get_chat_contacts, send_text_msg} ;
55use crate :: chatlist:: Chatlist ;
66use crate :: receive_imf:: receive_imf;
7- use crate :: test_utils:: { self , TestContext , TestContextManager , TimeShiftFalsePositiveNote } ;
7+ use crate :: test_utils:: { self , TestContext , TestContextManager , TimeShiftFalsePositiveNote , sync } ;
88
99#[ test]
1010fn test_contact_id_values ( ) {
@@ -831,8 +831,7 @@ CCCB 5AA9 F6E1 141C 9431
831831 Ok ( ( ) )
832832}
833833
834- /// Tests that status is synchronized when sending encrypted BCC-self messages and not
835- /// synchronized when the message is not encrypted.
834+ /// Tests that self-status is not synchronized from outgoing messages.
836835#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
837836async fn test_synchronize_status ( ) -> Result < ( ) > {
838837 let mut tcm = TestContextManager :: new ( ) ;
@@ -851,39 +850,22 @@ async fn test_synchronize_status() -> Result<()> {
851850 . await ?;
852851 let chat = alice1. create_email_chat ( bob) . await ;
853852
854- // Alice sends a message to Bob from the first device.
853+ // Alice sends an unencrypted message to Bob from the first device.
855854 send_text_msg ( alice1, chat. id , "Hello" . to_string ( ) ) . await ?;
856855 let sent_msg = alice1. pop_sent_msg ( ) . await ;
857856
858- // Message is not encrypted.
859- let message = sent_msg. load_from_db ( ) . await ;
860- assert ! ( !message. get_showpadlock( ) ) ;
861-
862857 // Alice's second devices receives a copy of outgoing message.
863858 alice2. recv_msg ( & sent_msg) . await ;
864-
865- // Bob receives message.
866- bob. recv_msg ( & sent_msg) . await ;
867-
868- // Message was not encrypted, so status is not copied.
869859 assert_eq ! ( alice2. get_config( Config :: Selfstatus ) . await ?, default_status) ;
870860
871861 // Alice sends encrypted message.
872862 let chat = alice1. create_chat ( bob) . await ;
873863 send_text_msg ( alice1, chat. id , "Hello" . to_string ( ) ) . await ?;
874864 let sent_msg = alice1. pop_sent_msg ( ) . await ;
875865
876- // Second message is encrypted.
877- let message = sent_msg. load_from_db ( ) . await ;
878- assert ! ( message. get_showpadlock( ) ) ;
879-
880866 // Alice's second devices receives a copy of second outgoing message.
881867 alice2. recv_msg ( & sent_msg) . await ;
882-
883- assert_eq ! (
884- alice2. get_config( Config :: Selfstatus ) . await ?,
885- Some ( "New status" . to_string( ) )
886- ) ;
868+ assert_eq ! ( alice2. get_config( Config :: Selfstatus ) . await ?, default_status) ;
887869
888870 Ok ( ( ) )
889871}
@@ -896,9 +878,9 @@ async fn test_selfavatar_changed_event() -> Result<()> {
896878 // Alice has two devices.
897879 let alice1 = & tcm. alice ( ) . await ;
898880 let alice2 = & tcm. alice ( ) . await ;
899-
900- // Bob has one device.
901- let bob = & tcm . bob ( ) . await ;
881+ for a in [ alice1 , alice2 ] {
882+ a . set_config_bool ( Config :: SyncMsgs , true ) . await ? ;
883+ }
902884
903885 assert_eq ! ( alice1. get_config( Config :: Selfavatar ) . await ?, None ) ;
904886
@@ -914,17 +896,7 @@ async fn test_selfavatar_changed_event() -> Result<()> {
914896 . get_matching ( |e| matches ! ( e, EventType :: SelfavatarChanged ) )
915897 . await ;
916898
917- // Alice sends a message.
918- let alice1_chat_id = alice1. create_chat ( bob) . await . id ;
919- send_text_msg ( alice1, alice1_chat_id, "Hello" . to_string ( ) ) . await ?;
920- let sent_msg = alice1. pop_sent_msg ( ) . await ;
921-
922- // The message is encrypted.
923- let message = sent_msg. load_from_db ( ) . await ;
924- assert ! ( message. get_showpadlock( ) ) ;
925-
926- // Alice's second device receives a copy of the outgoing message.
927- alice2. recv_msg ( & sent_msg) . await ;
899+ sync ( alice1, alice2) . await ;
928900
929901 // Alice's second device applies the selfavatar.
930902 assert ! ( alice2. get_config( Config :: Selfavatar ) . await ?. is_some( ) ) ;
0 commit comments