mirror of
https://github.com/chatmail/core.git
synced 2026-05-09 01:46:30 +03:00
Make the remaining Rust tests pass
This commit is contained in:
@@ -2741,8 +2741,8 @@ async fn test_broadcast_members_cant_see_each_other() -> Result<()> {
|
|||||||
let vc_pubkey = alice.pop_sent_msg().await;
|
let vc_pubkey = alice.pop_sent_msg().await;
|
||||||
assert_eq!(vc_pubkey.recipients, "charlie@example.net");
|
assert_eq!(vc_pubkey.recipients, "charlie@example.net");
|
||||||
let parsed = charlie.parse_msg(&vc_pubkey).await;
|
let parsed = charlie.parse_msg(&vc_pubkey).await;
|
||||||
assert!(parsed.get_header(HeaderDef::AutocryptGossip).is_some());
|
assert!(parsed.get_header(HeaderDef::AutocryptGossip).is_none());
|
||||||
assert!(parsed.decoded_data_contains("charlie@example.net"));
|
assert_eq!(parsed.decoded_data_contains("charlie@example.net"), false);
|
||||||
assert_eq!(parsed.decoded_data_contains("bob@example.net"), false);
|
assert_eq!(parsed.decoded_data_contains("bob@example.net"), false);
|
||||||
|
|
||||||
let parsed_by_bob = bob.parse_msg(&vc_pubkey).await;
|
let parsed_by_bob = bob.parse_msg(&vc_pubkey).await;
|
||||||
@@ -3182,14 +3182,17 @@ async fn test_broadcast_joining_golden() -> Result<()> {
|
|||||||
.await;
|
.await;
|
||||||
|
|
||||||
let alice_bob_contact = alice.add_or_lookup_contact_no_key(bob).await;
|
let alice_bob_contact = alice.add_or_lookup_contact_no_key(bob).await;
|
||||||
let private_chat = ChatIdBlocked::lookup_by_contact(alice, alice_bob_contact.id)
|
|
||||||
.await?
|
|
||||||
.unwrap();
|
|
||||||
// The 1:1 chat with Bob should not be visible to the user:
|
// The 1:1 chat with Bob should not be visible to the user:
|
||||||
assert_eq!(private_chat.blocked, Blocked::Yes);
|
assert!(
|
||||||
|
ChatIdBlocked::lookup_by_contact(alice, alice_bob_contact.id)
|
||||||
|
.await?
|
||||||
|
.is_none()
|
||||||
|
);
|
||||||
|
let private_chat_id =
|
||||||
|
ChatId::create_for_contact_with_blocked(alice, alice_bob_contact.id, Blocked::Not).await?;
|
||||||
alice
|
alice
|
||||||
.golden_test_chat(
|
.golden_test_chat(
|
||||||
private_chat.id,
|
private_chat_id,
|
||||||
"test_broadcast_joining_golden_private_chat",
|
"test_broadcast_joining_golden_private_chat",
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|||||||
@@ -2310,6 +2310,7 @@ pub(crate) async fn render_symm_encrypted_securejoin_message(
|
|||||||
"Auto-Submitted",
|
"Auto-Submitted",
|
||||||
mail_builder::headers::raw::Raw::new("auto-generated".to_string()).into(),
|
mail_builder::headers::raw::Raw::new("auto-generated".to_string()).into(),
|
||||||
));
|
));
|
||||||
|
// TODO it's not nice that we're comparing strings here
|
||||||
} else if step != "vc-request-pubkey" {
|
} else if step != "vc-request-pubkey" {
|
||||||
headers.push((
|
headers.push((
|
||||||
"Auto-Submitted",
|
"Auto-Submitted",
|
||||||
|
|||||||
@@ -462,7 +462,7 @@ async fn test_secure_join() -> Result<()> {
|
|||||||
msg.get_header(HeaderDef::SecureJoin).unwrap(),
|
msg.get_header(HeaderDef::SecureJoin).unwrap(),
|
||||||
"vc-request-pubkey"
|
"vc-request-pubkey"
|
||||||
);
|
);
|
||||||
assert!(msg.get_header(HeaderDef::SecureJoinInvitenumber).is_some());
|
assert!(msg.get_header(HeaderDef::SecureJoinAuth).is_some());
|
||||||
assert!(!msg.header_exists(HeaderDef::AutoSubmitted));
|
assert!(!msg.header_exists(HeaderDef::AutoSubmitted));
|
||||||
|
|
||||||
// Old Delta Chat core sent `Secure-Join-Group` header in `vg-request`,
|
// Old Delta Chat core sent `Secure-Join-Group` header in `vg-request`,
|
||||||
@@ -473,19 +473,16 @@ async fn test_secure_join() -> Result<()> {
|
|||||||
// is only sent in `vg-request-with-auth` for compatibility.
|
// is only sent in `vg-request-with-auth` for compatibility.
|
||||||
assert!(!msg.header_exists(HeaderDef::SecureJoinGroup));
|
assert!(!msg.header_exists(HeaderDef::SecureJoinGroup));
|
||||||
|
|
||||||
tcm.section("Step 3: Alice receives vg-request, sends vg-auth-required");
|
tcm.section("Step 3: Alice receives vc-request-pubkey, sends vc-pubkey");
|
||||||
alice.recv_msg_trash(&sent).await;
|
alice.recv_msg_trash(&sent).await;
|
||||||
|
|
||||||
let sent = alice.pop_sent_msg().await;
|
let sent = alice.pop_sent_msg().await;
|
||||||
assert!(sent.payload.contains("Auto-Submitted: auto-replied"));
|
assert!(sent.payload.contains("Auto-Submitted: auto-replied"));
|
||||||
let msg = bob.parse_msg(&sent).await;
|
let msg = bob.parse_msg(&sent).await;
|
||||||
assert!(msg.was_encrypted());
|
assert!(msg.was_encrypted());
|
||||||
assert_eq!(
|
assert_eq!(msg.get_header(HeaderDef::SecureJoin).unwrap(), "vc-pubkey");
|
||||||
msg.get_header(HeaderDef::SecureJoin).unwrap(),
|
|
||||||
"vg-auth-required"
|
|
||||||
);
|
|
||||||
|
|
||||||
tcm.section("Step 4: Bob receives vg-auth-required, sends vg-request-with-auth");
|
tcm.section("Step 4: Bob receives vc-pubkey, sends vg-request-with-auth");
|
||||||
bob.recv_msg_trash(&sent).await;
|
bob.recv_msg_trash(&sent).await;
|
||||||
let sent = bob.pop_sent_msg().await;
|
let sent = bob.pop_sent_msg().await;
|
||||||
|
|
||||||
@@ -579,13 +576,12 @@ async fn test_secure_join() -> Result<()> {
|
|||||||
{
|
{
|
||||||
// Now Alice's chat with Bob should still be hidden, the verified message should
|
// Now Alice's chat with Bob should still be hidden, the verified message should
|
||||||
// appear in the group chat.
|
// appear in the group chat.
|
||||||
|
assert!(
|
||||||
let chat = alice.get_chat(&bob).await;
|
ChatIdBlocked::lookup_by_contact(&alice, contact_bob.id)
|
||||||
assert_eq!(
|
.await?
|
||||||
chat.blocked,
|
.is_none()
|
||||||
Blocked::Yes,
|
|
||||||
"Alice's 1:1 chat with Bob is not hidden"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// There should be 2 messages in the chat:
|
// There should be 2 messages in the chat:
|
||||||
// - The ChatProtectionEnabled message
|
// - The ChatProtectionEnabled message
|
||||||
// - You added member bob@example.net
|
// - You added member bob@example.net
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Single#Chat#1002: bob@example.net [KEY bob@example.net]
|
Single#Chat#1002: bob@example.net [KEY bob@example.net]
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
Msg#1003: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
|
Msg#1007: info (Contact#Contact#Info): Messages are end-to-end encrypted. [NOTICED][INFO]
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user