MCPcopy Create free account
hub / github.com/chatmail/core / test_html_forwarding_encrypted

Function test_html_forwarding_encrypted

src/html.rs:601–633  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

599
600 #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
601 async fn test_html_forwarding_encrypted() {
602 let mut tcm = TestContextManager::new();
603 // Alice receives a non-delta html-message
604 let alice = &tcm.alice().await;
605 alice.allow_unencrypted().await.unwrap();
606 let chat = alice
607 .create_chat_with_contact("", "sender@testrun.org")
608 .await;
609 let raw = include_bytes!("../test-data/message/text_alt_plain_html.eml");
610 receive_imf(alice, raw, false).await.unwrap();
611 let msg = alice.get_last_msg_in(chat.get_id()).await;
612
613 // forward the message to saved-messages,
614 // this will encrypt the message as new_alice() has set up keys
615 let chat = alice.get_self_chat().await;
616 forward_msgs(alice, &[msg.get_id()], chat.get_id())
617 .await
618 .unwrap();
619 let msg = alice.pop_sent_msg().await;
620
621 // receive the message on another device
622 let alice = &tcm.alice().await;
623 let msg = alice.recv_msg(&msg).await;
624 assert_eq!(msg.chat_id, alice.get_self_chat().await.id);
625 assert_eq!(msg.get_from_id(), ContactId::SELF);
626 assert_eq!(msg.is_dc_message, MessengerMessage::Yes);
627 assert!(msg.get_showpadlock());
628 assert!(msg.is_forwarded());
629 assert!(msg.get_text().contains("this is plain"));
630 assert!(msg.has_html());
631 let html = msg.get_id().get_html(alice).await.unwrap().unwrap();
632 assert!(html.contains("this is <b>html</b>"));
633 }
634
635 #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
636 async fn test_set_html() {

Callers

nothing calls this directly

Calls 11

receive_imfFunction · 0.85
forward_msgsFunction · 0.85
aliceMethod · 0.80
allow_unencryptedMethod · 0.80
get_last_msg_inMethod · 0.80
get_self_chatMethod · 0.80
pop_sent_msgMethod · 0.80
recv_msgMethod · 0.80
get_htmlMethod · 0.80
get_idMethod · 0.45

Tested by

no test coverage detected