mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
test: Profile data is attached to group leave messages
This commit is contained in:
@@ -1503,6 +1503,39 @@ async fn test_shall_attach_selfavatar() -> Result<()> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Tests that profile data is attached to group leave messages. There are some pros and cons of
|
||||||
|
/// doing this, but at least we don't want to complicate the code with this special case.
|
||||||
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||||
|
async fn test_profile_data_on_group_leave() -> Result<()> {
|
||||||
|
let mut tcm = TestContextManager::new();
|
||||||
|
let t = &tcm.alice().await;
|
||||||
|
let chat_id = create_group_chat(t, ProtectionStatus::Unprotected, "foo").await?;
|
||||||
|
|
||||||
|
let (contact_id, _) = Contact::add_or_lookup(
|
||||||
|
t,
|
||||||
|
"",
|
||||||
|
&ContactAddress::new("foo@bar.org")?,
|
||||||
|
Origin::IncomingUnknownTo,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
add_contact_to_chat(t, chat_id, contact_id).await?;
|
||||||
|
|
||||||
|
send_text_msg(t, chat_id, "populate".to_string()).await?;
|
||||||
|
t.pop_sent_msg().await;
|
||||||
|
|
||||||
|
let file = t.dir.path().join("avatar.png");
|
||||||
|
let bytes = include_bytes!("../../test-data/image/avatar64x64.png");
|
||||||
|
tokio::fs::write(&file, bytes).await?;
|
||||||
|
t.set_config(Config::Selfavatar, Some(file.to_str().unwrap()))
|
||||||
|
.await?;
|
||||||
|
assert!(shall_attach_selfavatar(t, chat_id).await?);
|
||||||
|
|
||||||
|
remove_contact_from_chat(t, chat_id, ContactId::SELF).await?;
|
||||||
|
let sent_msg = t.pop_sent_msg().await;
|
||||||
|
assert!(sent_msg.payload().contains("Chat-User-Avatar"));
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||||
async fn test_set_mute_duration() {
|
async fn test_set_mute_duration() {
|
||||||
let t = TestContext::new().await;
|
let t = TestContext::new().await;
|
||||||
|
|||||||
Reference in New Issue
Block a user