@@ -1970,18 +1970,23 @@ Message content",
19701970async fn test_unencrypted_doesnt_goto_self_chat ( ) -> Result < ( ) > {
19711971 let mut tcm = TestContextManager :: new ( ) ;
19721972 let t = & tcm. alice ( ) . await ;
1973+ let mut chat_id = None ;
19731974
1974- for to in [
1975+ for ( i, to) in [
1976+ "<alice@example.org>" ,
19751977 "<alice@example.org>" ,
19761978 "alice@example.org, alice@example.org" ,
19771979 "hidden-recipients:;" ,
1978- ] {
1980+ ]
1981+ . iter ( )
1982+ . enumerate ( )
1983+ {
19791984 receive_imf (
19801985 t,
19811986 format ! (
19821987 "Subject: s
19831988Chat-Version: 1.0
1984- Message-ID: <foobar@localhost>
1989+ Message-ID: <foobar{i} @localhost>
19851990To: {to}
19861991From: <alice@example.org>
19871992
@@ -1996,9 +2001,14 @@ Your server is hacked. Have a nice day!"
19962001 assert_ne ! ( msg. chat_id, t. get_self_chat( ) . await . id) ;
19972002 assert_eq ! ( msg. from_id, ContactId :: SELF ) ;
19982003 assert_eq ! ( msg. to_id, ContactId :: SELF ) ;
1999- let chat = Chat :: load_from_db ( t, msg. chat_id ) . await ?;
2000- assert_eq ! ( chat. typ, Chattype :: Group ) ;
2001- assert ! ( !chat. is_encrypted( t) . await ?) ;
2004+ if let Some ( chat_id) = chat_id {
2005+ assert_eq ! ( msg. chat_id, chat_id) ;
2006+ } else {
2007+ chat_id = Some ( msg. chat_id ) ;
2008+ let chat = Chat :: load_from_db ( t, msg. chat_id ) . await ?;
2009+ assert_eq ! ( chat. typ, Chattype :: Group ) ;
2010+ assert ! ( !chat. is_encrypted( t) . await ?) ;
2011+ }
20022012 }
20032013 Ok ( ( ) )
20042014}
0 commit comments