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

Function test_html_save_msg

src/html.rs:570–598  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

568
569 #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
570 async fn test_html_save_msg() -> Result<()> {
571 let mut tcm = TestContextManager::new();
572 let alice = &tcm.alice().await;
573 alice.allow_unencrypted().await?;
574 // Alice receives a non-delta html-message
575 let chat = alice
576 .create_chat_with_contact("", "sender@testrun.org")
577 .await;
578 let raw = include_bytes!("../test-data/message/text_alt_plain_html.eml");
579 receive_imf(alice, raw, false).await?;
580 let msg = alice.get_last_msg_in(chat.get_id()).await;
581
582 // Alice saves the message
583 let self_chat = alice.get_self_chat().await;
584 save_msgs(alice, &[msg.id]).await?;
585 let saved_msg = alice.get_last_msg_in(self_chat.get_id()).await;
586 assert_ne!(saved_msg.id, msg.id);
587 assert_eq!(saved_msg.get_original_msg_id(alice).await?.unwrap(), msg.id);
588 assert!(!saved_msg.is_forwarded()); // UI should not flag "saved messages" as "forwarded"
589 assert_ne!(saved_msg.get_from_id(), ContactId::SELF);
590 assert_eq!(saved_msg.get_from_id(), msg.get_from_id());
591 assert_eq!(saved_msg.is_dc_message, MessengerMessage::No);
592 assert!(saved_msg.get_text().contains("this is plain"));
593 assert!(saved_msg.has_html());
594 let html = saved_msg.get_id().get_html(alice).await?.unwrap();
595 assert!(html.contains("this is <b>html</b>"));
596
597 Ok(())
598 }
599
600 #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
601 async fn test_html_forwarding_encrypted() {

Callers

nothing calls this directly

Calls 9

receive_imfFunction · 0.85
save_msgsFunction · 0.85
aliceMethod · 0.80
allow_unencryptedMethod · 0.80
get_last_msg_inMethod · 0.80
get_self_chatMethod · 0.80
get_htmlMethod · 0.80
get_idMethod · 0.45

Tested by

no test coverage detected