@@ -273,137 +273,6 @@ async fn test_degrade_verified_oneonone_chat() -> Result<()> {
273
273
Ok ( ( ) )
274
274
}
275
275
276
- /// Messages with old timestamps are difficult for verified chats:
277
- /// - They must not be sorted over a protection-changed info message.
278
- /// That's what `test_old_message_2` tests
279
- /// - If they change the protection, then they must not be sorted over existing other messages,
280
- /// because then the protection-changed info message would also be above these existing messages.
281
- /// That's what `test_old_message_3` tests.
282
- ///
283
- /// `test_old_message_1` tests the case where both the old and the new message
284
- /// change verification
285
- #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
286
- async fn test_old_message_1 ( ) -> Result < ( ) > {
287
- let mut tcm = TestContextManager :: new ( ) ;
288
- let alice = tcm. alice ( ) . await ;
289
- let bob = tcm. bob ( ) . await ;
290
- enable_verified_oneonone_chats ( & [ & alice, & bob] ) . await ;
291
-
292
- mark_as_verified ( & alice, & bob) . await ;
293
-
294
- let chat = alice. create_chat ( & bob) . await ; // This creates a protection-changed info message
295
- assert ! ( chat. is_protected( ) ) ;
296
-
297
- // This creates protection-changed info message #2;
298
- // even though the date is old, info message and email must be sorted below the original info message.
299
- receive_imf (
300
- & alice,
301
- b"From: Bob <[email protected] >\n \
302
-
303
- Message-ID: <[email protected] >\n \
304
- Date: Sat, 07 Dec 2019 19:00:27 +0000\n \
305
- \n \
306
- Message from Thunderbird\n ",
307
- true ,
308
- )
309
- . await ?;
310
-
311
- alice. golden_test_chat ( chat. id , "test_old_message_1" ) . await ;
312
-
313
- Ok ( ( ) )
314
- }
315
-
316
- #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
317
- async fn test_old_message_2 ( ) -> Result < ( ) > {
318
- let mut tcm = TestContextManager :: new ( ) ;
319
- let alice = tcm. alice ( ) . await ;
320
- let bob = tcm. bob ( ) . await ;
321
- enable_verified_oneonone_chats ( & [ & alice, & bob] ) . await ;
322
-
323
- mark_as_verified ( & alice, & bob) . await ;
324
-
325
- // This creates protection-changed info message #1:
326
- let chat = alice. create_chat ( & bob) . await ;
327
- assert ! ( chat. is_protected( ) ) ;
328
- let protection_msg = alice. get_last_msg ( ) . await ;
329
- assert_eq ! (
330
- protection_msg. param. get_cmd( ) ,
331
- SystemMessage :: ChatProtectionEnabled
332
- ) ;
333
-
334
- // This creates protection-changed info message #2 with `timestamp_sort` greater by 1.
335
- let first_email = receive_imf (
336
- & alice,
337
- b"From: Bob <[email protected] >\n \
338
-
339
- Message-ID: <[email protected] >\n \
340
- Date: Sun, 08 Dec 2019 19:00:27 +0000\n \
341
- \n \
342
- Somewhat old message\n ",
343
- false ,
344
- )
345
- . await ?
346
- . unwrap ( ) ;
347
-
348
- // Both messages will get the same timestamp, so this one will be sorted under the previous one
349
- // even though it has an older timestamp.
350
- let second_email = receive_imf (
351
- & alice,
352
- b"From: Bob <[email protected] >\n \
353
-
354
- Message-ID: <[email protected] >\n \
355
- Date: Sat, 07 Dec 2019 19:00:27 +0000\n \
356
- \n \
357
- Even older message, that must NOT be shown before the info message\n ",
358
- true ,
359
- )
360
- . await ?
361
- . unwrap ( ) ;
362
-
363
- assert_eq ! ( first_email. sort_timestamp, second_email. sort_timestamp) ;
364
- assert_eq ! (
365
- first_email. sort_timestamp,
366
- protection_msg. timestamp_sort + 1
367
- ) ;
368
-
369
- alice. golden_test_chat ( chat. id , "test_old_message_2" ) . await ;
370
-
371
- Ok ( ( ) )
372
- }
373
-
374
- #[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
375
- async fn test_old_message_3 ( ) -> Result < ( ) > {
376
- let mut tcm = TestContextManager :: new ( ) ;
377
- let alice = tcm. alice ( ) . await ;
378
- let bob = tcm. bob ( ) . await ;
379
- enable_verified_oneonone_chats ( & [ & alice, & bob] ) . await ;
380
-
381
- mark_as_verified ( & alice, & bob) . await ;
382
- mark_as_verified ( & bob, & alice) . await ;
383
-
384
- tcm. send_recv_accept ( & bob, & alice, "Heyho from my verified device!" )
385
- . await ;
386
-
387
- // This unverified message must not be sorted over the message sent in the previous line:
388
- receive_imf (
389
- & alice,
390
- b"From: Bob <[email protected] >\n \
391
-
392
- Message-ID: <[email protected] >\n \
393
- Date: Sat, 07 Dec 2019 19:00:27 +0000\n \
394
- \n \
395
- Old, unverified message\n ",
396
- true ,
397
- )
398
- . await ?;
399
-
400
- alice
401
- . golden_test_chat ( alice. get_pgp_chat ( & bob) . await . id , "test_old_message_3" )
402
- . await ;
403
-
404
- Ok ( ( ) )
405
- }
406
-
407
276
/// Alice is offline for some time.
408
277
/// When she comes online, first her inbox is synced and then her sentbox.
409
278
/// This test tests that the messages are still in the right order.
0 commit comments