()
| 634 | |
| 635 | #[tokio::test(flavor = "multi_thread", worker_threads = 2)] |
| 636 | async fn test_set_html() { |
| 637 | let mut tcm = TestContextManager::new(); |
| 638 | let alice = &tcm.alice().await; |
| 639 | let bob = &tcm.bob().await; |
| 640 | |
| 641 | // alice sends a message with html-part to bob |
| 642 | let chat_id = alice.create_chat(bob).await.id; |
| 643 | let mut msg = Message::new_text("plain text".to_string()); |
| 644 | msg.set_html(Some("<b>html</b> text".to_string())); |
| 645 | assert!(msg.mime_modified); |
| 646 | chat::send_msg(alice, chat_id, &mut msg).await.unwrap(); |
| 647 | |
| 648 | // check the message is written correctly to alice's db |
| 649 | let msg = alice.get_last_msg_in(chat_id).await; |
| 650 | assert_eq!(msg.get_text(), "plain text"); |
| 651 | assert!(!msg.is_forwarded()); |
| 652 | assert!(msg.mime_modified); |
| 653 | let html = msg.get_id().get_html(alice).await.unwrap().unwrap(); |
| 654 | assert!(html.contains("<b>html</b> text")); |
| 655 | |
| 656 | // let bob receive the message |
| 657 | let chat_id = bob.create_chat(alice).await.id; |
| 658 | let msg = bob.recv_msg(&alice.pop_sent_msg().await).await; |
| 659 | assert_eq!(msg.chat_id, chat_id); |
| 660 | assert_eq!(msg.get_text(), "plain text"); |
| 661 | assert!(!msg.is_forwarded()); |
| 662 | assert!(msg.mime_modified); |
| 663 | let html = msg.get_id().get_html(bob).await.unwrap().unwrap(); |
| 664 | assert!(html.contains("<b>html</b> text")); |
| 665 | } |
| 666 | |
| 667 | #[tokio::test(flavor = "multi_thread", worker_threads = 2)] |
| 668 | async fn test_cp1252_html() -> Result<()> { |
nothing calls this directly
no test coverage detected