Skip to content

Commit 7c980c5

Browse files
committed
Make the remaining Rust tests pass
1 parent 27c76ea commit 7c980c5

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

src/chat/chat_tests.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,8 +2741,8 @@ async fn test_broadcast_members_cant_see_each_other() -> Result<()> {
27412741
let vc_pubkey = alice.pop_sent_msg().await;
27422742
assert_eq!(vc_pubkey.recipients, "[email protected]");
27432743
let parsed = charlie.parse_msg(&vc_pubkey).await;
2744-
assert!(parsed.get_header(HeaderDef::AutocryptGossip).is_some());
2745-
assert!(parsed.decoded_data_contains("[email protected]"));
2744+
assert!(parsed.get_header(HeaderDef::AutocryptGossip).is_none());
2745+
assert_eq!(parsed.decoded_data_contains("[email protected]"), false);
27462746
assert_eq!(parsed.decoded_data_contains("[email protected]"), false);
27472747

27482748
let parsed_by_bob = bob.parse_msg(&vc_pubkey).await;
@@ -3182,14 +3182,17 @@ async fn test_broadcast_joining_golden() -> Result<()> {
31823182
.await;
31833183

31843184
let alice_bob_contact = alice.add_or_lookup_contact_no_key(bob).await;
3185-
let private_chat = ChatIdBlocked::lookup_by_contact(alice, alice_bob_contact.id)
3186-
.await?
3187-
.unwrap();
31883185
// The 1:1 chat with Bob should not be visible to the user:
3189-
assert_eq!(private_chat.blocked, Blocked::Yes);
3186+
assert!(
3187+
ChatIdBlocked::lookup_by_contact(alice, alice_bob_contact.id)
3188+
.await?
3189+
.is_none()
3190+
);
3191+
let private_chat_id =
3192+
ChatId::create_for_contact_with_blocked(alice, alice_bob_contact.id, Blocked::Not).await?;
31903193
alice
31913194
.golden_test_chat(
3192-
private_chat.id,
3195+
private_chat_id,
31933196
"test_broadcast_joining_golden_private_chat",
31943197
)
31953198
.await;

src/mimefactory.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,6 +2310,7 @@ pub(crate) async fn render_symm_encrypted_securejoin_message(
23102310
"Auto-Submitted",
23112311
mail_builder::headers::raw::Raw::new("auto-generated".to_string()).into(),
23122312
));
2313+
// TODO it's not nice that we're comparing strings here
23132314
} else if step != "vc-request-pubkey" {
23142315
headers.push((
23152316
"Auto-Submitted",

src/securejoin/securejoin_tests.rs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ async fn test_secure_join() -> Result<()> {
462462
msg.get_header(HeaderDef::SecureJoin).unwrap(),
463463
"vc-request-pubkey"
464464
);
465-
assert!(msg.get_header(HeaderDef::SecureJoinInvitenumber).is_some());
465+
assert!(msg.get_header(HeaderDef::SecureJoinAuth).is_some());
466466
assert!(!msg.header_exists(HeaderDef::AutoSubmitted));
467467

468468
// Old Delta Chat core sent `Secure-Join-Group` header in `vg-request`,
@@ -473,19 +473,16 @@ async fn test_secure_join() -> Result<()> {
473473
// is only sent in `vg-request-with-auth` for compatibility.
474474
assert!(!msg.header_exists(HeaderDef::SecureJoinGroup));
475475

476-
tcm.section("Step 3: Alice receives vg-request, sends vg-auth-required");
476+
tcm.section("Step 3: Alice receives vc-request-pubkey, sends vc-pubkey");
477477
alice.recv_msg_trash(&sent).await;
478478

479479
let sent = alice.pop_sent_msg().await;
480480
assert!(sent.payload.contains("Auto-Submitted: auto-replied"));
481481
let msg = bob.parse_msg(&sent).await;
482482
assert!(msg.was_encrypted());
483-
assert_eq!(
484-
msg.get_header(HeaderDef::SecureJoin).unwrap(),
485-
"vg-auth-required"
486-
);
483+
assert_eq!(msg.get_header(HeaderDef::SecureJoin).unwrap(), "vc-pubkey");
487484

488-
tcm.section("Step 4: Bob receives vg-auth-required, sends vg-request-with-auth");
485+
tcm.section("Step 4: Bob receives vc-pubkey, sends vg-request-with-auth");
489486
bob.recv_msg_trash(&sent).await;
490487
let sent = bob.pop_sent_msg().await;
491488

@@ -579,13 +576,12 @@ async fn test_secure_join() -> Result<()> {
579576
{
580577
// Now Alice's chat with Bob should still be hidden, the verified message should
581578
// appear in the group chat.
582-
583-
let chat = alice.get_chat(&bob).await;
584-
assert_eq!(
585-
chat.blocked,
586-
Blocked::Yes,
587-
"Alice's 1:1 chat with Bob is not hidden"
579+
assert!(
580+
ChatIdBlocked::lookup_by_contact(&alice, contact_bob.id)
581+
.await?
582+
.is_none()
588583
);
584+
589585
// There should be 2 messages in the chat:
590586
// - The ChatProtectionEnabled message
591587
// - You added member [email protected]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Single#Chat#1002: [email protected] [KEY [email protected]]
22
--------------------------------------------------------------------------------
3-
Msg#1003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
3+
Msg#1007: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
44
--------------------------------------------------------------------------------

0 commit comments

Comments
 (0)