mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 08:56:29 +03:00
test: transfer vCards in TestContext.create_chat()
SecureJoin and importing a vCard are the primary ways we want to support for creating contacts. Typing in an email address and relying on Autocrypt results in sending the first message unencrypted and we want to clearly separate unencrypted and encrypted chats in the future. To make the tests more stable, we set up test contacts with vCards as this always immediately results in creating a single encrypted chat and this is not going to change.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use rand::Rng;
|
||||
use std::time::Duration;
|
||||
|
||||
use tokio::fs;
|
||||
@@ -1894,7 +1895,6 @@ async fn test_save_mime_headers_off() -> anyhow::Result<()> {
|
||||
|
||||
let msg = bob.recv_msg(&alice.pop_sent_msg().await).await;
|
||||
assert_eq!(msg.get_text(), "hi!");
|
||||
assert!(!msg.get_showpadlock());
|
||||
let mime = message::get_mime_headers(&bob, msg.id).await?;
|
||||
assert!(mime.is_empty());
|
||||
Ok(())
|
||||
@@ -4642,7 +4642,14 @@ async fn test_download_later() -> Result<()> {
|
||||
|
||||
let bob = tcm.bob().await;
|
||||
let bob_chat = bob.create_chat(&alice).await;
|
||||
let text = String::from_utf8(vec![b'a'; MIN_DOWNLOAD_LIMIT as usize])?;
|
||||
|
||||
// Generate a random string so OpenPGP does not compress it.
|
||||
let text: String = rand::thread_rng()
|
||||
.sample_iter(&rand::distributions::Alphanumeric)
|
||||
.take(MIN_DOWNLOAD_LIMIT as usize)
|
||||
.map(char::from)
|
||||
.collect();
|
||||
|
||||
let sent_msg = bob.send_text(bob_chat.id, &text).await;
|
||||
let msg = alice.recv_msg(&sent_msg).await;
|
||||
assert_eq!(msg.download_state, DownloadState::Available);
|
||||
|
||||
Reference in New Issue
Block a user