@@ -5,7 +5,7 @@ use crate::chat::{Chat, get_chat_contacts, send_text_msg};
55use crate :: chatlist:: Chatlist ;
66use crate :: receive_imf:: receive_imf;
77use crate :: securejoin:: get_securejoin_qr;
8- use crate :: test_utils:: { self , TestContext , TestContextManager , TimeShiftFalsePositiveNote } ;
8+ use crate :: test_utils:: { self , TestContext , TestContextManager , TimeShiftFalsePositiveNote , sync } ;
99
1010#[ test]
1111fn test_contact_id_values ( ) {
@@ -846,8 +846,7 @@ CCCB 5AA9 F6E1 141C 9431
846846 Ok ( ( ) )
847847}
848848
849- /// Tests that status is synchronized when sending encrypted BCC-self messages and not
850- /// synchronized when the message is not encrypted.
849+ /// Tests that self-status is not synchronized from outgoing messages.
851850#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
852851async fn test_synchronize_status ( ) -> Result < ( ) > {
853852 let mut tcm = TestContextManager :: new ( ) ;
@@ -866,39 +865,22 @@ async fn test_synchronize_status() -> Result<()> {
866865 . await ?;
867866 let chat = alice1. create_email_chat ( bob) . await ;
868867
869- // Alice sends a message to Bob from the first device.
868+ // Alice sends an unencrypted message to Bob from the first device.
870869 send_text_msg ( alice1, chat. id , "Hello" . to_string ( ) ) . await ?;
871870 let sent_msg = alice1. pop_sent_msg ( ) . await ;
872871
873- // Message is not encrypted.
874- let message = sent_msg. load_from_db ( ) . await ;
875- assert ! ( !message. get_showpadlock( ) ) ;
876-
877872 // Alice's second devices receives a copy of outgoing message.
878873 alice2. recv_msg ( & sent_msg) . await ;
879-
880- // Bob receives message.
881- bob. recv_msg ( & sent_msg) . await ;
882-
883- // Message was not encrypted, so status is not copied.
884874 assert_eq ! ( alice2. get_config( Config :: Selfstatus ) . await ?, default_status) ;
885875
886876 // Alice sends encrypted message.
887877 let chat = alice1. create_chat ( bob) . await ;
888878 send_text_msg ( alice1, chat. id , "Hello" . to_string ( ) ) . await ?;
889879 let sent_msg = alice1. pop_sent_msg ( ) . await ;
890880
891- // Second message is encrypted.
892- let message = sent_msg. load_from_db ( ) . await ;
893- assert ! ( message. get_showpadlock( ) ) ;
894-
895881 // Alice's second devices receives a copy of second outgoing message.
896882 alice2. recv_msg ( & sent_msg) . await ;
897-
898- assert_eq ! (
899- alice2. get_config( Config :: Selfstatus ) . await ?,
900- Some ( "New status" . to_string( ) )
901- ) ;
883+ assert_eq ! ( alice2. get_config( Config :: Selfstatus ) . await ?, default_status) ;
902884
903885 Ok ( ( ) )
904886}
@@ -911,9 +893,9 @@ async fn test_selfavatar_changed_event() -> Result<()> {
911893 // Alice has two devices.
912894 let alice1 = & tcm. alice ( ) . await ;
913895 let alice2 = & tcm. alice ( ) . await ;
914-
915- // Bob has one device.
916- let bob = & tcm . bob ( ) . await ;
896+ for a in [ alice1 , alice2 ] {
897+ a . set_config_bool ( Config :: SyncMsgs , true ) . await ? ;
898+ }
917899
918900 assert_eq ! ( alice1. get_config( Config :: Selfavatar ) . await ?, None ) ;
919901
@@ -929,17 +911,7 @@ async fn test_selfavatar_changed_event() -> Result<()> {
929911 . get_matching ( |e| matches ! ( e, EventType :: SelfavatarChanged ) )
930912 . await ;
931913
932- // Alice sends a message.
933- let alice1_chat_id = alice1. create_chat ( bob) . await . id ;
934- send_text_msg ( alice1, alice1_chat_id, "Hello" . to_string ( ) ) . await ?;
935- let sent_msg = alice1. pop_sent_msg ( ) . await ;
936-
937- // The message is encrypted.
938- let message = sent_msg. load_from_db ( ) . await ;
939- assert ! ( message. get_showpadlock( ) ) ;
940-
941- // Alice's second device receives a copy of the outgoing message.
942- alice2. recv_msg ( & sent_msg) . await ;
914+ sync ( alice1, alice2) . await ;
943915
944916 // Alice's second device applies the selfavatar.
945917 assert ! ( alice2. get_config( Config :: Selfavatar ) . await ?. is_some( ) ) ;
0 commit comments