test: add TestContext.allow_unencrypted()

This commit is contained in:
link2xt
2026-05-07 07:10:17 +02:00
parent e122bdf5fc
commit 93ac040194
20 changed files with 155 additions and 1 deletions

View File

@@ -1386,6 +1386,7 @@ async fn test_markfresh_chat() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_archive_fresh_msgs() -> Result<()> { async fn test_archive_fresh_msgs() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
async fn msg_from(t: &TestContext, name: &str, num: u32) -> Result<()> { async fn msg_from(t: &TestContext, name: &str, num: u32) -> Result<()> {
receive_imf( receive_imf(
@@ -1919,6 +1920,7 @@ async fn test_marknoticed_chat() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_contact_request_fresh_messages() -> Result<()> { async fn test_contact_request_fresh_messages() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
let chats = Chatlist::try_load(&t, 0, None, None).await?; let chats = Chatlist::try_load(&t, 0, None, None).await?;
assert_eq!(chats.len(), 0); assert_eq!(chats.len(), 0);
@@ -2014,6 +2016,7 @@ async fn test_contact_request_archive() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_classic_email_chat() -> Result<()> { async fn test_classic_email_chat() -> Result<()> {
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await?;
// Alice receives a classic (non-chat) message from Bob. // Alice receives a classic (non-chat) message from Bob.
receive_imf( receive_imf(
@@ -2567,6 +2570,7 @@ async fn test_forward_encrypted_to_unencrypted() -> Result<()> {
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
let charlie = &tcm.charlie().await; let charlie = &tcm.charlie().await;
bob.allow_unencrypted().await?;
let txt = "This should be encrypted"; let txt = "This should be encrypted";
let sent = alice.send_text(alice.create_chat(bob).await.id, txt).await; let sent = alice.send_text(alice.create_chat(bob).await.id, txt).await;
@@ -4706,6 +4710,7 @@ async fn test_sync_adhoc_grp() -> Result<()> {
let alice1 = &tcm.alice().await; let alice1 = &tcm.alice().await;
for a in [alice0, alice1] { for a in [alice0, alice1] {
a.set_config_bool(Config::SyncMsgs, true).await?; a.set_config_bool(Config::SyncMsgs, true).await?;
a.allow_unencrypted().await?;
} }
let mut chat_ids = Vec::new(); let mut chat_ids = Vec::new();
@@ -5642,6 +5647,7 @@ async fn test_restore_backup_after_60_days() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_one_to_one_chat_no_group_member_timestamps() { async fn test_one_to_one_chat_no_group_member_timestamps() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
let chat = t.create_chat_with_contact("bob", "bob@example.com").await; let chat = t.create_chat_with_contact("bob", "bob@example.com").await;
let sent = t.send_text(chat.id, "Hi!").await; let sent = t.send_text(chat.id, "Hi!").await;
let payload = sent.payload; let payload = sent.payload;
@@ -5855,6 +5861,7 @@ async fn test_send_delete_request_no_encryption() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
alice.allow_unencrypted().await?;
let alice_chat = alice.create_email_chat(bob).await; let alice_chat = alice.create_email_chat(bob).await;
// Alice sends a message, then tries to send a deletion request which fails. // Alice sends a message, then tries to send a deletion request which fails.
@@ -6073,6 +6080,7 @@ async fn test_no_key_contacts_in_adhoc_chats() -> Result<()> {
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
let charlie = &tcm.charlie().await; let charlie = &tcm.charlie().await;
alice.allow_unencrypted().await?;
let chat_id = receive_imf( let chat_id = receive_imf(
alice, alice,
@@ -6108,6 +6116,7 @@ async fn test_no_key_contacts_in_adhoc_chats() -> Result<()> {
async fn test_create_unencrypted_group_chat() -> Result<()> { async fn test_create_unencrypted_group_chat() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.allow_unencrypted().await?;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
let charlie = &tcm.charlie().await; let charlie = &tcm.charlie().await;

View File

@@ -665,6 +665,7 @@ mod tests {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_search_single_chat() -> anyhow::Result<()> { async fn test_search_single_chat() -> anyhow::Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
// receive a one-to-one-message // receive a one-to-one-message
receive_imf( receive_imf(
@@ -725,6 +726,7 @@ mod tests {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_search_single_chat_without_authname() -> anyhow::Result<()> { async fn test_search_single_chat_without_authname() -> anyhow::Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
// receive a one-to-one-message without authname set // receive a one-to-one-message without authname set
receive_imf( receive_imf(

View File

@@ -335,6 +335,7 @@ async fn test_add_or_lookup() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_contact_name_changes() -> Result<()> { async fn test_contact_name_changes() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
// first message creates contact and one-to-one-chat without name set // first message creates contact and one-to-one-chat without name set
receive_imf( receive_imf(
@@ -927,9 +928,12 @@ async fn test_synchronize_status() -> Result<()> {
// Alice has two devices. // Alice has two devices.
let alice1 = &tcm.alice().await; let alice1 = &tcm.alice().await;
let alice2 = &tcm.alice().await; let alice2 = &tcm.alice().await;
alice1.allow_unencrypted().await?;
alice2.allow_unencrypted().await?;
// Bob has one device. // Bob has one device.
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
bob.allow_unencrypted().await?;
let default_status = alice1.get_config(Config::Selfstatus).await?; let default_status = alice1.get_config(Config::Selfstatus).await?;
@@ -1083,6 +1087,7 @@ async fn test_was_seen_recently_event() -> Result<()> {
async fn test_lookup_id_by_addr_recent_ex(accept_unencrypted_chat: bool) -> Result<()> { async fn test_lookup_id_by_addr_recent_ex(accept_unencrypted_chat: bool) -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
bob.allow_unencrypted().await?;
let raw = include_bytes!("../../test-data/message/thunderbird_with_autocrypt.eml"); let raw = include_bytes!("../../test-data/message/thunderbird_with_autocrypt.eml");
assert!(std::str::from_utf8(raw)?.contains("Date: Thu, 24 Nov 2022 20:05:57 +0100")); assert!(std::str::from_utf8(raw)?.contains("Date: Thu, 24 Nov 2022 20:05:57 +0100"));

View File

@@ -54,6 +54,7 @@ async fn receive_msg(t: &TestContext, chat: &Chat) {
async fn test_get_fresh_msgs_and_muted_chats() { async fn test_get_fresh_msgs_and_muted_chats() {
// receive various mails in 3 chats // receive various mails in 3 chats
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
let bob = t.create_chat_with_contact("", "bob@g.it").await; let bob = t.create_chat_with_contact("", "bob@g.it").await;
let claire = t.create_chat_with_contact("", "claire@g.it").await; let claire = t.create_chat_with_contact("", "claire@g.it").await;
let dave = t.create_chat_with_contact("", "dave@g.it").await; let dave = t.create_chat_with_contact("", "dave@g.it").await;
@@ -103,6 +104,7 @@ async fn test_get_fresh_msgs_and_muted_chats() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_get_fresh_msgs_and_muted_until() { async fn test_get_fresh_msgs_and_muted_until() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
let bob = t.create_chat_with_contact("", "bob@g.it").await; let bob = t.create_chat_with_contact("", "bob@g.it").await;
receive_msg(&t, &bob).await; receive_msg(&t, &bob).await;
assert_eq!(get_chat_msgs(&t, bob.id).await.unwrap().len(), 1); assert_eq!(get_chat_msgs(&t, bob.id).await.unwrap().len(), 1);
@@ -158,6 +160,7 @@ async fn test_get_fresh_msgs_and_muted_until() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_muted_context() -> Result<()> { async fn test_muted_context() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
assert_eq!(t.get_fresh_msgs().await.unwrap().len(), 0); assert_eq!(t.get_fresh_msgs().await.unwrap().len(), 0);
t.set_config(Config::IsMuted, Some("1")).await?; t.set_config(Config::IsMuted, Some("1")).await?;
let chat = t.create_chat_with_contact("", "bob@g.it").await; let chat = t.create_chat_with_contact("", "bob@g.it").await;
@@ -324,6 +327,7 @@ async fn test_get_info_completeness() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_search_msgs() -> Result<()> { async fn test_search_msgs() -> Result<()> {
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await?;
let self_talk = ChatId::create_for_contact(&alice, ContactId::SELF).await?; let self_talk = ChatId::create_for_contact(&alice, ContactId::SELF).await?;
let chat = alice let chat = alice
.create_chat_with_contact("Bob", "bob@example.org") .create_chat_with_contact("Bob", "bob@example.org")
@@ -430,6 +434,7 @@ async fn test_search_unaccepted_requests() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_limit_search_msgs() -> Result<()> { async fn test_limit_search_msgs() -> Result<()> {
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await?;
let chat = alice let chat = alice
.create_chat_with_contact("Bob", "bob@example.org") .create_chat_with_contact("Bob", "bob@example.org")
.await; .await;

View File

@@ -402,6 +402,7 @@ mod tests {
assert!(get_attachment_mime(&mail).is_some()); assert!(get_attachment_mime(&mail).is_some());
let bob = TestContext::new_bob().await; let bob = TestContext::new_bob().await;
bob.allow_unencrypted().await?;
receive_imf(&bob, attachment_mime, false).await?; receive_imf(&bob, attachment_mime, false).await?;
let msg = bob.get_last_msg().await; let msg = bob.get_last_msg().await;
// Subject should be prepended because the attachment doesn't have "Chat-Version". // Subject should be prepended because the attachment doesn't have "Chat-Version".
@@ -416,6 +417,7 @@ mod tests {
// Desktop via MS Exchange (actually made with TB though). // Desktop via MS Exchange (actually made with TB though).
let mixed_up_mime = include_bytes!("../test-data/message/mixed-up-long.eml"); let mixed_up_mime = include_bytes!("../test-data/message/mixed-up-long.eml");
let bob = TestContext::new_bob().await; let bob = TestContext::new_bob().await;
bob.allow_unencrypted().await?;
receive_imf(&bob, mixed_up_mime, false).await?; receive_imf(&bob, mixed_up_mime, false).await?;
let msg = bob.get_last_msg().await; let msg = bob.get_last_msg().await;
assert!(!msg.get_text().is_empty()); assert!(!msg.get_text().is_empty());

View File

@@ -160,6 +160,7 @@ Sent with my Delta Chat Messenger: https://delta.chat";
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
bob.set_config_bool(Config::IsChatmail, true).await?; bob.set_config_bool(Config::IsChatmail, true).await?;
bob.allow_unencrypted().await?;
let bob_chat_id = receive_imf( let bob_chat_id = receive_imf(
bob, bob,
b"From: alice@example.org\n\ b"From: alice@example.org\n\

View File

@@ -521,6 +521,7 @@ mod test_chatlist_events {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_adhoc_group() -> Result<()> { async fn test_adhoc_group() -> Result<()> {
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await?;
let mime = br#"Subject: First thread let mime = br#"Subject: First thread
Message-ID: first@example.org Message-ID: first@example.org
To: Alice <alice@example.org>, Bob <bob@example.net> To: Alice <alice@example.org>, Bob <bob@example.net>

View File

@@ -451,6 +451,7 @@ test some special html-characters as &lt; &gt; and &amp; but also &quot; and &#x
// alice receives a non-delta html-message // alice receives a non-delta html-message
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.allow_unencrypted().await?;
let chat = alice let chat = alice
.create_chat_with_contact("", "sender@testrun.org") .create_chat_with_contact("", "sender@testrun.org")
.await; .await;
@@ -484,6 +485,7 @@ test some special html-characters as &lt; &gt; and &amp; but also &quot; and &#x
// bob: check that bob also got the html-part of the forwarded message // bob: check that bob also got the html-part of the forwarded message
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
bob.allow_unencrypted().await?;
let chat_bob = bob.create_chat_with_contact("", "alice@example.org").await; let chat_bob = bob.create_chat_with_contact("", "alice@example.org").await;
async fn check_receiver(ctx: &TestContext, chat: &Chat, sender: &TestContext) { async fn check_receiver(ctx: &TestContext, chat: &Chat, sender: &TestContext) {
let msg = ctx.recv_msg(&sender.pop_sent_msg().await).await; let msg = ctx.recv_msg(&sender.pop_sent_msg().await).await;
@@ -523,6 +525,7 @@ test some special html-characters as &lt; &gt; and &amp; but also &quot; and &#x
async fn test_html_save_msg() -> Result<()> { async fn test_html_save_msg() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.allow_unencrypted().await?;
// Alice receives a non-delta html-message // Alice receives a non-delta html-message
let chat = alice let chat = alice
.create_chat_with_contact("", "sender@testrun.org") .create_chat_with_contact("", "sender@testrun.org")
@@ -554,6 +557,7 @@ test some special html-characters as &lt; &gt; and &amp; but also &quot; and &#x
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
// Alice receives a non-delta html-message // Alice receives a non-delta html-message
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.allow_unencrypted().await.unwrap();
let chat = alice let chat = alice
.create_chat_with_contact("", "sender@testrun.org") .create_chat_with_contact("", "sender@testrun.org")
.await; .await;
@@ -619,6 +623,7 @@ test some special html-characters as &lt; &gt; and &amp; but also &quot; and &#x
async fn test_cp1252_html() -> Result<()> { async fn test_cp1252_html() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.allow_unencrypted().await?;
receive_imf( receive_imf(
alice, alice,
include_bytes!("../test-data/message/cp1252-html.eml"), include_bytes!("../test-data/message/cp1252-html.eml"),

View File

@@ -108,6 +108,8 @@ async fn test_unencrypted_quote_encrypted_message() -> Result<()> {
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
alice.allow_unencrypted().await?;
bob.allow_unencrypted().await?;
tcm.section("Bob sends encrypted message to Alice"); tcm.section("Bob sends encrypted message to Alice");
let alice_chat = alice.create_chat(bob).await; let alice_chat = alice.create_chat(bob).await;
@@ -455,6 +457,7 @@ async fn test_get_state() -> Result<()> {
async fn test_is_bot() -> Result<()> { async fn test_is_bot() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.allow_unencrypted().await?;
// Alice receives an auto-generated non-chat message. // Alice receives an auto-generated non-chat message.
// //

View File

@@ -115,6 +115,7 @@ fn test_header_encoding() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_manually_set_subject() -> Result<()> { async fn test_manually_set_subject() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
let chat = t.create_chat_with_contact("bob", "bob@example.org").await; let chat = t.create_chat_with_contact("bob", "bob@example.org").await;
let mut msg = Message::new(Viewtype::Text); let mut msg = Message::new(Viewtype::Text);
@@ -183,10 +184,12 @@ async fn test_subject_from_dc() {
async fn test_subject_outgoing() { async fn test_subject_outgoing() {
// 3. Send the first message to a new contact // 3. Send the first message to a new contact
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
assert_eq!(first_subject_str(t).await, "Message from alice@example.org"); assert_eq!(first_subject_str(t).await, "Message from alice@example.org");
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
t.set_config(Config::Displayname, Some("Alice")) t.set_config(Config::Displayname, Some("Alice"))
.await .await
.unwrap(); .unwrap();
@@ -229,6 +232,7 @@ async fn test_subject_mdn() {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let t = &tcm.alice().await; let t = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
t.allow_unencrypted().await.unwrap();
receive_imf( receive_imf(
t, t,
b"From: alice@example.org\r\n\ b"From: alice@example.org\r\n\
@@ -280,10 +284,12 @@ async fn test_subject_mdn() {
async fn test_mdn_create_encrypted() -> Result<()> { async fn test_mdn_create_encrypted() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = tcm.alice().await; let alice = tcm.alice().await;
alice.allow_unencrypted().await?;
alice alice
.set_config(Config::Displayname, Some("Alice Exampleorg")) .set_config(Config::Displayname, Some("Alice Exampleorg"))
.await?; .await?;
let bob = tcm.bob().await; let bob = tcm.bob().await;
bob.allow_unencrypted().await?;
bob.set_config(Config::Displayname, Some("Bob Examplenet")) bob.set_config(Config::Displayname, Some("Bob Examplenet"))
.await?; .await?;
bob.set_config(Config::Selfstatus, Some("Bob Examplenet")) bob.set_config(Config::Selfstatus, Some("Bob Examplenet"))
@@ -577,6 +583,7 @@ async fn test_render_reply() {
async fn test_selfavatar_unencrypted() -> anyhow::Result<()> { async fn test_selfavatar_unencrypted() -> anyhow::Result<()> {
// create chat with bob, set selfavatar // create chat with bob, set selfavatar
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
let chat = t.create_chat_with_contact("bob", "bob@example.org").await; let chat = t.create_chat_with_contact("bob", "bob@example.org").await;
let file = t.dir.path().join("avatar.png"); let file = t.dir.path().join("avatar.png");
@@ -622,6 +629,7 @@ async fn test_remove_member_bcc() -> Result<()> {
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
let charlie = &tcm.charlie().await; let charlie = &tcm.charlie().await;
alice.allow_unencrypted().await?;
let alice_addr = alice.get_config(Config::Addr).await?.unwrap(); let alice_addr = alice.get_config(Config::Addr).await?.unwrap();
let bob_addr = bob.get_config(Config::Addr).await?.unwrap(); let bob_addr = bob.get_config(Config::Addr).await?.unwrap();
@@ -665,6 +673,7 @@ async fn test_remove_member_bcc() -> Result<()> {
async fn test_from_before_autocrypt() -> Result<()> { async fn test_from_before_autocrypt() -> Result<()> {
// create chat with bob // create chat with bob
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
let chat = t.create_chat_with_contact("bob", "bob@example.org").await; let chat = t.create_chat_with_contact("bob", "bob@example.org").await;
// send message to bob: that should get multipart/mixed because of the avatar moved to inner header; // send message to bob: that should get multipart/mixed because of the avatar moved to inner header;
@@ -808,6 +817,7 @@ async fn test_new_member_is_first_recipient() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_no_empty_to_header() -> Result<()> { async fn test_no_empty_to_header() -> Result<()> {
let alice = &TestContext::new_alice().await; let alice = &TestContext::new_alice().await;
alice.allow_unencrypted().await?;
let mut self_chat = alice.get_self_chat().await; let mut self_chat = alice.get_self_chat().await;
self_chat.param.remove(Param::Selftalk); self_chat.param.remove(Param::Selftalk);
self_chat.update_param(alice).await?; self_chat.update_param(alice).await?;

View File

@@ -1185,6 +1185,7 @@ async fn test_allinkl_blockquote() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_add_subj_to_multimedia_msg() { async fn test_add_subj_to_multimedia_msg() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf( receive_imf(
&t.ctx, &t.ctx,
include_bytes!("../../test-data/message/subj_with_multimedia_msg.eml"), include_bytes!("../../test-data/message/subj_with_multimedia_msg.eml"),
@@ -1461,6 +1462,7 @@ async fn test_intended_recipient_fingerprint() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_long_in_reply_to() -> Result<()> { async fn test_long_in_reply_to() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
// A message with a long Message-ID. // A message with a long Message-ID.
// Long message-IDs are generated by Mailjet. // Long message-IDs are generated by Mailjet.
@@ -1599,6 +1601,7 @@ async fn test_ignore_read_receipt_to_self() -> Result<()> {
async fn test_ms_exchange_mdn() -> Result<()> { async fn test_ms_exchange_mdn() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let t = tcm.alice().await; let t = tcm.alice().await;
t.allow_unencrypted().await?;
let original = let original =
include_bytes!("../../test-data/message/ms_exchange_report_original_message.eml"); include_bytes!("../../test-data/message/ms_exchange_report_original_message.eml");
@@ -1985,6 +1988,8 @@ async fn test_chat_edit_imf_header() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
alice.allow_unencrypted().await?;
bob.allow_unencrypted().await?;
let alice_chat = alice.create_email_chat(bob).await; let alice_chat = alice.create_email_chat(bob).await;
// Alice sends a message, then sends an invalid edit request. // Alice sends a message, then sends an invalid edit request.
@@ -2049,6 +2054,7 @@ async fn test_multiple_autocrypt_hdrs() -> Result<()> {
async fn test_receive_signed_only() -> Result<()> { async fn test_receive_signed_only() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
bob.allow_unencrypted().await?;
let imf_raw = include_bytes!("../../test-data/message/unencrypted_signed_simple.eml"); let imf_raw = include_bytes!("../../test-data/message/unencrypted_signed_simple.eml");
let msg = receive_imf(bob, imf_raw, false).await?.unwrap(); let msg = receive_imf(bob, imf_raw, false).await?.unwrap();

View File

@@ -811,6 +811,7 @@ Content-Disposition: reaction\n\
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_reaction_forwarded_summary() -> Result<()> { async fn test_reaction_forwarded_summary() -> Result<()> {
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await?;
// Alice adds a message to "Saved Messages" // Alice adds a message to "Saved Messages"
let self_chat = alice.get_self_chat().await; let self_chat = alice.get_self_chat().await;

View File

@@ -81,6 +81,7 @@ static GRP_MAIL: &[u8] =
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_adhoc_group_is_shown() { async fn test_adhoc_group_is_shown() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap(); let chats = Chatlist::try_load(&t, 0, None, None).await.unwrap();
assert_eq!(chats.len(), 0); assert_eq!(chats.len(), 0);
@@ -101,6 +102,7 @@ async fn test_adhoc_group_is_shown() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_adhoc_group_show_accepted_contact_accepted() { async fn test_adhoc_group_show_accepted_contact_accepted() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
// accept Bob by accepting a delta-message from Bob // accept Bob by accepting a delta-message from Bob
receive_imf(&t, MSGRMSG, false).await.unwrap(); receive_imf(&t, MSGRMSG, false).await.unwrap();
@@ -136,6 +138,7 @@ async fn test_adhoc_group_show_accepted_contact_accepted() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_adhoc_group_show_all() { async fn test_adhoc_group_show_all() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf(&t, GRP_MAIL, false).await.unwrap(); receive_imf(&t, GRP_MAIL, false).await.unwrap();
// adhoc-group with unknown contacts with show_emails=all will show up in a single chat // adhoc-group with unknown contacts with show_emails=all will show up in a single chat
@@ -155,6 +158,7 @@ async fn test_adhoc_group_show_all() {
async fn test_adhoc_groups_merge() -> Result<()> { async fn test_adhoc_groups_merge() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.allow_unencrypted().await?;
receive_imf( receive_imf(
alice, alice,
b"From: bob@example.net\n\ b"From: bob@example.net\n\
@@ -355,6 +359,7 @@ async fn test_no_message_id_header() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_escaped_from() { async fn test_escaped_from() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
let contact_id = Contact::create(&t, "foobar", "foobar@example.com") let contact_id = Contact::create(&t, "foobar", "foobar@example.com")
.await .await
.unwrap(); .unwrap();
@@ -388,6 +393,7 @@ async fn test_escaped_from() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_escaped_recipients() { async fn test_escaped_recipients() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
Contact::create(&t, "foobar", "foobar@example.com") Contact::create(&t, "foobar", "foobar@example.com")
.await .await
.unwrap(); .unwrap();
@@ -435,6 +441,7 @@ async fn test_escaped_recipients() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_cc_to_contact() { async fn test_cc_to_contact() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
Contact::create(&t, "foobar", "foobar@example.com") Contact::create(&t, "foobar", "foobar@example.com")
.await .await
.unwrap(); .unwrap();
@@ -591,6 +598,7 @@ async fn test_parse_ndn(
) -> (TestContext, MsgId) { ) -> (TestContext, MsgId) {
let t = TestContext::new().await; let t = TestContext::new().await;
t.configure_addr(self_addr).await; t.configure_addr(self_addr).await;
t.allow_unencrypted().await.unwrap();
receive_imf( receive_imf(
&t, &t,
@@ -675,6 +683,7 @@ async fn test_resend_after_ndn() -> Result<()> {
async fn test_parse_ndn_group_msg() -> Result<()> { async fn test_parse_ndn_group_msg() -> Result<()> {
let t = TestContext::new().await; let t = TestContext::new().await;
t.configure_addr("alice@gmail.com").await; t.configure_addr("alice@gmail.com").await;
t.allow_unencrypted().await?;
receive_imf( receive_imf(
&t, &t,
@@ -716,6 +725,7 @@ async fn test_parse_ndn_group_msg() -> Result<()> {
async fn test_concat_multiple_ndns() -> Result<()> { async fn test_concat_multiple_ndns() -> Result<()> {
let t = TestContext::new().await; let t = TestContext::new().await;
t.configure_addr("alice@posteo.org").await; t.configure_addr("alice@posteo.org").await;
t.allow_unencrypted().await?;
let mid = "1234@mail.gmail.com"; let mid = "1234@mail.gmail.com";
receive_imf( receive_imf(
&t, &t,
@@ -773,6 +783,7 @@ async fn load_imf_email(context: &Context, imf_raw: &[u8]) -> Message {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_html_only_mail() { async fn test_html_only_mail() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
let msg = load_imf_email(&t, include_bytes!("../../test-data/message/wrong-html.eml")).await; let msg = load_imf_email(&t, include_bytes!("../../test-data/message/wrong-html.eml")).await;
assert_eq!( assert_eq!(
msg.text, msg.text,
@@ -808,6 +819,7 @@ static GH_MAILINGLIST2: &str = "Received: (Postfix, from userid 1000); Mon, 4 De
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_github_mailing_list() -> Result<()> { async fn test_github_mailing_list() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
receive_imf(&t.ctx, GH_MAILINGLIST, false).await?; receive_imf(&t.ctx, GH_MAILINGLIST, false).await?;
@@ -881,6 +893,8 @@ static DC_MAILINGLIST2: &[u8] = b"Received: (Postfix, from userid 1000); Mon, 4
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_classic_mailing_list() -> Result<()> { async fn test_classic_mailing_list() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
receive_imf(&t.ctx, DC_MAILINGLIST, false).await.unwrap(); receive_imf(&t.ctx, DC_MAILINGLIST, false).await.unwrap();
let chats = Chatlist::try_load(&t.ctx, 0, None, None).await.unwrap(); let chats = Chatlist::try_load(&t.ctx, 0, None, None).await.unwrap();
let chat_id = chats.get_chat_id(0).unwrap(); let chat_id = chats.get_chat_id(0).unwrap();
@@ -922,6 +936,8 @@ Hello mailinglist!\r\n"
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_other_device_writes_to_mailinglist() -> Result<()> { async fn test_other_device_writes_to_mailinglist() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
receive_imf(&t, DC_MAILINGLIST, false).await.unwrap(); receive_imf(&t, DC_MAILINGLIST, false).await.unwrap();
let first_msg = t.get_last_msg().await; let first_msg = t.get_last_msg().await;
let first_chat = Chat::load_from_db(&t, first_msg.chat_id).await?; let first_chat = Chat::load_from_db(&t, first_msg.chat_id).await?;
@@ -972,6 +988,7 @@ async fn test_other_device_writes_to_mailinglist() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_block_mailing_list() { async fn test_block_mailing_list() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf(&t.ctx, DC_MAILINGLIST, false).await.unwrap(); receive_imf(&t.ctx, DC_MAILINGLIST, false).await.unwrap();
t.evtracker.wait_next_incoming_message().await; t.evtracker.wait_next_incoming_message().await;
@@ -1006,6 +1023,7 @@ async fn test_block_mailing_list() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mailing_list_decide_block_then_unblock() { async fn test_mailing_list_decide_block_then_unblock() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf(&t, DC_MAILINGLIST, false).await.unwrap(); receive_imf(&t, DC_MAILINGLIST, false).await.unwrap();
let blocked = Contact::get_all_blocked(&t).await.unwrap(); let blocked = Contact::get_all_blocked(&t).await.unwrap();
@@ -1036,6 +1054,7 @@ async fn test_mailing_list_decide_block_then_unblock() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mailing_list_decide_not_now() { async fn test_mailing_list_decide_not_now() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf(&t.ctx, DC_MAILINGLIST, false).await.unwrap(); receive_imf(&t.ctx, DC_MAILINGLIST, false).await.unwrap();
@@ -1063,6 +1082,7 @@ async fn test_mailing_list_decide_not_now() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mailing_list_decide_accept() { async fn test_mailing_list_decide_accept() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf(&t.ctx, DC_MAILINGLIST, false).await.unwrap(); receive_imf(&t.ctx, DC_MAILINGLIST, false).await.unwrap();
@@ -1085,6 +1105,8 @@ async fn test_mailing_list_decide_accept() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mailing_list_multiple_names_in_subject() -> Result<()> { async fn test_mailing_list_multiple_names_in_subject() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
receive_imf( receive_imf(
&t, &t,
b"From: Foo Bar <foo@bar.org>\n\ b"From: Foo Bar <foo@bar.org>\n\
@@ -1109,6 +1131,7 @@ async fn test_mailing_list_multiple_names_in_subject() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_majordomo_mailing_list() -> Result<()> { async fn test_majordomo_mailing_list() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
// test mailing lists not having a `ListId:`-header // test mailing lists not having a `ListId:`-header
receive_imf( receive_imf(
@@ -1161,6 +1184,7 @@ async fn test_majordomo_mailing_list() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mailchimp_mailing_list() -> Result<()> { async fn test_mailchimp_mailing_list() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
receive_imf( receive_imf(
&t, &t,
@@ -1194,6 +1218,7 @@ async fn test_mailchimp_mailing_list() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_dhl_mailing_list() -> Result<()> { async fn test_dhl_mailing_list() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
receive_imf( receive_imf(
&t, &t,
@@ -1219,6 +1244,7 @@ async fn test_dhl_mailing_list() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_dpd_mailing_list() -> Result<()> { async fn test_dpd_mailing_list() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
receive_imf( receive_imf(
&t, &t,
@@ -1244,6 +1270,7 @@ async fn test_dpd_mailing_list() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_xt_local_mailing_list() -> Result<()> { async fn test_xt_local_mailing_list() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
receive_imf( receive_imf(
&t, &t,
@@ -1277,6 +1304,7 @@ async fn test_xt_local_mailing_list() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_xing_mailing_list() -> Result<()> { async fn test_xing_mailing_list() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
receive_imf( receive_imf(
&t, &t,
@@ -1299,6 +1327,7 @@ async fn test_xing_mailing_list() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_ttline_mailing_list() -> Result<()> { async fn test_ttline_mailing_list() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
receive_imf( receive_imf(
&t, &t,
@@ -1319,6 +1348,7 @@ async fn test_ttline_mailing_list() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mailing_list_with_mimepart_footer() { async fn test_mailing_list_with_mimepart_footer() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
// the mailing list message contains two top-level texts. // the mailing list message contains two top-level texts.
// the second text is a footer that is added by some mailing list software // the second text is a footer that is added by some mailing list software
@@ -1346,6 +1376,7 @@ async fn test_mailing_list_with_mimepart_footer() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mailing_list_with_mimepart_footer_signed() { async fn test_mailing_list_with_mimepart_footer_signed() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf( receive_imf(
&t, &t,
@@ -1370,6 +1401,7 @@ async fn test_mailing_list_with_mimepart_footer_signed() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_apply_mailinglist_changes_assigned_by_reply() { async fn test_apply_mailinglist_changes_assigned_by_reply() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf(&t, GH_MAILINGLIST, false).await.unwrap(); receive_imf(&t, GH_MAILINGLIST, false).await.unwrap();
@@ -1408,6 +1440,7 @@ async fn test_apply_mailinglist_changes_assigned_by_reply() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mailing_list_chat_message() { async fn test_mailing_list_chat_message() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf( receive_imf(
&t, &t,
@@ -1430,6 +1463,7 @@ async fn test_mailing_list_chat_message() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mailing_list_bot() { async fn test_mailing_list_bot() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
t.set_config(Config::Bot, Some("1")).await.unwrap(); t.set_config(Config::Bot, Some("1")).await.unwrap();
receive_imf( receive_imf(
@@ -1462,6 +1496,8 @@ async fn test_dont_show_noreply_in_contacts_list() {
async fn check_dont_show_in_contacts_list(addr: &str) { async fn check_dont_show_in_contacts_list(addr: &str) {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf( receive_imf(
&t, &t,
format!( format!(
@@ -1491,6 +1527,7 @@ YEAAAAAA!.
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_pdf_filename_simple() { async fn test_pdf_filename_simple() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
let msg = load_imf_email( let msg = load_imf_email(
&t, &t,
include_bytes!("../../test-data/message/pdf_filename_simple.eml"), include_bytes!("../../test-data/message/pdf_filename_simple.eml"),
@@ -1511,6 +1548,7 @@ async fn test_pdf_filename_simple() {
async fn test_pdf_filename_continuation() { async fn test_pdf_filename_continuation() {
// test filenames split across multiple header lines, see rfc 2231 // test filenames split across multiple header lines, see rfc 2231
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
let msg = load_imf_email( let msg = load_imf_email(
&t, &t,
include_bytes!("../../test-data/message/pdf_filename_continuation.eml"), include_bytes!("../../test-data/message/pdf_filename_continuation.eml"),
@@ -1536,6 +1574,7 @@ async fn test_pdf_filename_continuation() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_many_images() { async fn test_many_images() {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf( receive_imf(
&t, &t,
@@ -1556,6 +1595,7 @@ async fn test_many_images() {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_in_reply_to() { async fn test_in_reply_to() {
let t = TestContext::new().await; let t = TestContext::new().await;
t.allow_unencrypted().await.unwrap();
t.configure_addr("bob@example.com").await; t.configure_addr("bob@example.com").await;
// Receive message from Alice about group "foo". // Receive message from Alice about group "foo".
@@ -1631,6 +1671,7 @@ async fn test_save_mime_headers_off() -> anyhow::Result<()> {
async fn check_alias_reply(from_dc: bool, chat_request: bool, group_request: bool) { async fn check_alias_reply(from_dc: bool, chat_request: bool, group_request: bool) {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = tcm.alice().await; let alice = tcm.alice().await;
alice.allow_unencrypted().await.unwrap();
// Claire, a customer, sends a support request // Claire, a customer, sends a support request
// to the alias address <support@example.org>. // to the alias address <support@example.org>.
@@ -1697,6 +1738,8 @@ async fn check_alias_reply(from_dc: bool, chat_request: bool, group_request: boo
let claire = tcm.unconfigured().await; let claire = tcm.unconfigured().await;
claire.configure_addr("claire@example.org").await; claire.configure_addr("claire@example.org").await;
claire.allow_unencrypted().await.unwrap();
receive_imf(&claire, claire_request.as_bytes(), false) receive_imf(&claire, claire_request.as_bytes(), false)
.await .await
.unwrap(); .unwrap();
@@ -1895,6 +1938,7 @@ async fn test_dont_show_all_outgoing_msgs_in_self_chat() {
// be shown in the self-chat. // be shown in the self-chat.
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let t = &tcm.alice().await; let t = &tcm.alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf( receive_imf(
t, t,
@@ -1922,6 +1966,7 @@ Message content",
async fn test_unencrypted_doesnt_goto_self_chat() -> Result<()> { async fn test_unencrypted_doesnt_goto_self_chat() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let t = &tcm.alice().await; let t = &tcm.alice().await;
t.allow_unencrypted().await?;
let mut chat_id = None; let mut chat_id = None;
for (i, to) in [ for (i, to) in [
@@ -2003,6 +2048,7 @@ async fn test_no_smtp_job_for_self_chat() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_outgoing_classic_mail_creates_chat() { async fn test_outgoing_classic_mail_creates_chat() {
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await.unwrap();
// Alice downloads outgoing classic email. // Alice downloads outgoing classic email.
receive_imf( receive_imf(
@@ -2028,6 +2074,7 @@ Message content",
async fn test_duplicate_message() -> Result<()> { async fn test_duplicate_message() -> Result<()> {
// Test that duplicate messages are ignored based on the Message-ID // Test that duplicate messages are ignored based on the Message-ID
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await?;
let bob_contact_id = Contact::add_or_lookup( let bob_contact_id = Contact::add_or_lookup(
&alice, &alice,
@@ -2086,6 +2133,8 @@ Second signature";
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_ignore_footer_status_from_mailinglist() -> Result<()> { async fn test_ignore_footer_status_from_mailinglist() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
let bob_id = Contact::add_or_lookup( let bob_id = Contact::add_or_lookup(
&t, &t,
"", "",
@@ -2165,6 +2214,8 @@ Original signature updated",
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_ignore_old_status_updates() -> Result<()> { async fn test_ignore_old_status_updates() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
let bob_id = Contact::add_or_lookup( let bob_id = Contact::add_or_lookup(
&t, &t,
"", "",
@@ -2237,6 +2288,7 @@ async fn test_chat_assignment_private_classical_reply() {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
for outgoing_is_classical in &[true, false] { for outgoing_is_classical in &[true, false] {
let t = &tcm.alice().await; let t = &tcm.alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf( receive_imf(
t, t,
@@ -2323,6 +2375,7 @@ async fn test_chat_assignment_private_chat_reply() {
&[(true, true), (false, true), (false, false)] &[(true, true), (false, true), (false, false)]
{ {
let t = &tcm.alice().await; let t = &tcm.alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf( receive_imf(
t, t,
@@ -2416,6 +2469,7 @@ async fn test_chat_assignment_nonprivate_classical_reply() {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
for outgoing_is_classical in &[true, false] { for outgoing_is_classical in &[true, false] {
let t = &tcm.alice().await; let t = &tcm.alice().await;
t.allow_unencrypted().await.unwrap();
receive_imf( receive_imf(
t, t,
@@ -2526,6 +2580,9 @@ async fn test_chat_assignment_adhoc() -> Result<()> {
let alice = tcm.alice().await; let alice = tcm.alice().await;
let bob = tcm.bob().await; let bob = tcm.bob().await;
let fiona = tcm.fiona().await; let fiona = tcm.fiona().await;
alice.allow_unencrypted().await?;
bob.allow_unencrypted().await?;
fiona.allow_unencrypted().await?;
let first_thread_mime = br#"Subject: First thread let first_thread_mime = br#"Subject: First thread
Message-ID: first@example.org Message-ID: first@example.org
@@ -2670,6 +2727,7 @@ async fn test_read_receipts_dont_unmark_bots() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_gmx_forwarded_msg() -> Result<()> { async fn test_gmx_forwarded_msg() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
receive_imf( receive_imf(
&t, &t,
@@ -3040,6 +3098,7 @@ async fn test_auto_accept_for_bots() -> Result<()> {
async fn test_auto_accept_group_for_bots() -> Result<()> { async fn test_auto_accept_group_for_bots() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.set_config_bool(Config::Bot, true).await.unwrap(); t.set_config_bool(Config::Bot, true).await.unwrap();
t.allow_unencrypted().await.unwrap();
let msg = load_imf_email(&t, GRP_MAIL).await; let msg = load_imf_email(&t, GRP_MAIL).await;
let chat = chat::Chat::load_from_db(&t, msg.chat_id).await?; let chat = chat::Chat::load_from_db(&t, msg.chat_id).await?;
@@ -3268,6 +3327,7 @@ async fn test_blocked_contact_creates_group() -> Result<()> {
async fn test_outgoing_undecryptable() -> Result<()> { async fn test_outgoing_undecryptable() -> Result<()> {
let alice = &TestContext::new().await; let alice = &TestContext::new().await;
alice.configure_addr("alice@example.org").await; alice.configure_addr("alice@example.org").await;
alice.allow_unencrypted().await?;
let raw = include_bytes!("../../test-data/message/thunderbird_with_autocrypt.eml"); let raw = include_bytes!("../../test-data/message/thunderbird_with_autocrypt.eml");
receive_imf(alice, raw, false).await?; receive_imf(alice, raw, false).await?;
@@ -3304,6 +3364,7 @@ async fn test_outgoing_undecryptable() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_thunderbird_autocrypt() -> Result<()> { async fn test_thunderbird_autocrypt() -> Result<()> {
let t = TestContext::new_bob().await; let t = TestContext::new_bob().await;
t.allow_unencrypted().await?;
let raw = include_bytes!("../../test-data/message/thunderbird_with_autocrypt.eml"); let raw = include_bytes!("../../test-data/message/thunderbird_with_autocrypt.eml");
let received_msg = receive_imf(&t, raw, false).await?.unwrap(); let received_msg = receive_imf(&t, raw, false).await?.unwrap();
@@ -3351,6 +3412,7 @@ async fn test_issuer_fingerprint() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_prefer_encrypt_mutual_if_encrypted() -> Result<()> { async fn test_prefer_encrypt_mutual_if_encrypted() -> Result<()> {
let t = TestContext::new_bob().await; let t = TestContext::new_bob().await;
t.allow_unencrypted().await?;
// The message has public key attached *and* Autocrypt header. // The message has public key attached *and* Autocrypt header.
// //
@@ -3403,6 +3465,7 @@ async fn test_prefer_encrypt_mutual_if_encrypted() -> Result<()> {
async fn test_forged_from_and_no_valid_signatures() -> Result<()> { async fn test_forged_from_and_no_valid_signatures() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let t = &tcm.bob().await; let t = &tcm.bob().await;
t.allow_unencrypted().await?;
let raw = include_bytes!("../../test-data/message/thunderbird_encrypted_signed.eml"); let raw = include_bytes!("../../test-data/message/thunderbird_encrypted_signed.eml");
let received_msg = receive_imf(t, raw, false).await?.unwrap(); let received_msg = receive_imf(t, raw, false).await?.unwrap();
@@ -3413,6 +3476,7 @@ async fn test_forged_from_and_no_valid_signatures() -> Result<()> {
assert!(!msg.get_showpadlock()); assert!(!msg.get_showpadlock());
let t = &tcm.bob().await; let t = &tcm.bob().await;
t.allow_unencrypted().await?;
let raw = String::from_utf8(raw.to_vec())?.replace("alice@example.org", "clarice@example.org"); let raw = String::from_utf8(raw.to_vec())?.replace("alice@example.org", "clarice@example.org");
let received_msg = receive_imf(t, raw.as_bytes(), false).await?.unwrap(); let received_msg = receive_imf(t, raw.as_bytes(), false).await?.unwrap();
assert!(received_msg.chat_id.is_trash()); assert!(received_msg.chat_id.is_trash());
@@ -3423,6 +3487,8 @@ async fn test_forged_from_and_no_valid_signatures() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_wrong_from_name_and_no_valid_signatures() -> Result<()> { async fn test_wrong_from_name_and_no_valid_signatures() -> Result<()> {
let t = &TestContext::new_bob().await; let t = &TestContext::new_bob().await;
t.allow_unencrypted().await?;
let raw = include_bytes!("../../test-data/message/thunderbird_encrypted_signed.eml"); let raw = include_bytes!("../../test-data/message/thunderbird_encrypted_signed.eml");
let raw = String::from_utf8(raw.to_vec())?.replace("From: Alice", "From: A"); let raw = String::from_utf8(raw.to_vec())?.replace("From: Alice", "From: A");
receive_imf(t, raw.as_bytes(), false).await?.unwrap(); receive_imf(t, raw.as_bytes(), false).await?.unwrap();
@@ -3437,6 +3503,7 @@ async fn test_wrong_from_name_and_no_valid_signatures() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_thunderbird_autocrypt_unencrypted() -> Result<()> { async fn test_thunderbird_autocrypt_unencrypted() -> Result<()> {
let bob = &TestContext::new_bob().await; let bob = &TestContext::new_bob().await;
bob.allow_unencrypted().await?;
// Thunderbird message with Autocrypt header and a signature, // Thunderbird message with Autocrypt header and a signature,
// but not encrypted. // but not encrypted.
@@ -3475,6 +3542,7 @@ async fn test_thunderbird_autocrypt_unencrypted() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_thunderbird_unsigned() -> Result<()> { async fn test_thunderbird_unsigned() -> Result<()> {
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await.unwrap();
// Alice receives an unsigned message from Bob. // Alice receives an unsigned message from Bob.
let raw = include_bytes!("../../test-data/message/thunderbird_encrypted_unsigned.eml"); let raw = include_bytes!("../../test-data/message/thunderbird_encrypted_unsigned.eml");
@@ -3494,6 +3562,7 @@ async fn test_thunderbird_unsigned() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_thunderbird_unsigned_with_unencrypted_subject() -> Result<()> { async fn test_thunderbird_unsigned_with_unencrypted_subject() -> Result<()> {
let bob = TestContext::new_bob().await; let bob = TestContext::new_bob().await;
bob.allow_unencrypted().await.unwrap();
let raw = include_bytes!( let raw = include_bytes!(
"../../test-data/message/thunderbird_encrypted_unsigned_with_unencrypted_subject.eml" "../../test-data/message/thunderbird_encrypted_unsigned_with_unencrypted_subject.eml"
@@ -3586,6 +3655,7 @@ async fn test_big_forwarded_with_big_attachment() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mua_user_adds_member() -> Result<()> { async fn test_mua_user_adds_member() -> Result<()> {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await?;
receive_imf( receive_imf(
&t, &t,
@@ -3637,6 +3707,7 @@ async fn test_mua_user_adds_member() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mua_user_adds_recipient_to_single_chat() -> Result<()> { async fn test_mua_user_adds_recipient_to_single_chat() -> Result<()> {
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await?;
// Alice sends a 1:1 message to Bob, creating a 1:1 chat. // Alice sends a 1:1 message to Bob, creating a 1:1 chat.
let msg = receive_imf( let msg = receive_imf(
@@ -4073,6 +4144,7 @@ async fn test_dont_readd_with_normal_msg() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mua_cant_remove() -> Result<()> { async fn test_mua_cant_remove() -> Result<()> {
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await?;
let now = time(); let now = time();
@@ -4165,6 +4237,7 @@ async fn test_mua_cant_remove() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mua_can_add() -> Result<()> { async fn test_mua_can_add() -> Result<()> {
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await?;
let now = time(); let now = time();
@@ -4224,6 +4297,7 @@ async fn test_mua_can_add() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_mua_can_readd() -> Result<()> { async fn test_mua_can_readd() -> Result<()> {
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await?;
// Alice creates chat with 3 contacts. // Alice creates chat with 3 contacts.
let msg = receive_imf( let msg = receive_imf(
@@ -4387,6 +4461,8 @@ async fn test_keep_member_list_if_possibly_nomember() -> Result<()> {
async fn test_adhoc_grp_name_no_prefix() -> Result<()> { async fn test_adhoc_grp_name_no_prefix() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.allow_unencrypted().await?;
let chat_id = receive_imf( let chat_id = receive_imf(
alice, alice,
b"Subject: Re: Once upon a time this was with the only Re: here\n\ b"Subject: Re: Once upon a time this was with the only Re: here\n\
@@ -4534,6 +4610,7 @@ async fn test_protected_group_add_remove_member_missing_key() -> Result<()> {
async fn test_older_message_from_2nd_device() -> Result<()> { async fn test_older_message_from_2nd_device() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.allow_unencrypted().await?;
let chat_id = alice let chat_id = alice
.create_chat_with_contact("", "bob@example.net") .create_chat_with_contact("", "bob@example.net")
.await .await
@@ -4669,6 +4746,7 @@ async fn test_forged_from() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_multiline_iso_8859_1_subject() -> Result<()> { async fn test_multiline_iso_8859_1_subject() -> Result<()> {
let t = &TestContext::new_alice().await; let t = &TestContext::new_alice().await;
t.allow_unencrypted().await?;
let mail = b"Received: (Postfix, from userid 1000); Mon, 4 Dec 2006 14:51:39 +0100 (CET)\n\ let mail = b"Received: (Postfix, from userid 1000); Mon, 4 Dec 2006 14:51:39 +0100 (CET)\n\
From: bob@example.com\n\ From: bob@example.com\n\
To: alice@example.org, claire@example.com\n\ To: alice@example.org, claire@example.com\n\
@@ -4733,6 +4811,7 @@ async fn test_references() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_list_from() -> Result<()> { async fn test_list_from() -> Result<()> {
let t = &TestContext::new_alice().await; let t = &TestContext::new_alice().await;
t.allow_unencrypted().await?;
let raw = include_bytes!("../../test-data/message/list-from.eml"); let raw = include_bytes!("../../test-data/message/list-from.eml");
let received = receive_imf(t, raw, false).await?.unwrap(); let received = receive_imf(t, raw, false).await?.unwrap();
@@ -4862,6 +4941,7 @@ async fn test_make_n_send_vcard() -> Result<()> {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_unencrypted_group_id_no_recipients() -> Result<()> { async fn test_unencrypted_group_id_no_recipients() -> Result<()> {
let t = &TestContext::new_alice().await; let t = &TestContext::new_alice().await;
t.allow_unencrypted().await?;
let raw = "From: alice@example.org let raw = "From: alice@example.org
Subject: Group Subject: Group
Chat-Version: 1.0 Chat-Version: 1.0
@@ -5293,6 +5373,7 @@ async fn test_outgoing_unencrypted_chat_assignment() {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
alice.allow_unencrypted().await.unwrap();
tcm.section("Alice receives unencrypted message from Bob"); tcm.section("Alice receives unencrypted message from Bob");
receive_imf( receive_imf(
@@ -5337,6 +5418,7 @@ async fn test_outgoing_unencrypted_chat_assignment() {
async fn test_incoming_reply_with_date_in_past() -> Result<()> { async fn test_incoming_reply_with_date_in_past() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.allow_unencrypted().await?;
let msg0 = receive_imf( let msg0 = receive_imf(
alice, alice,
@@ -5478,6 +5560,8 @@ async fn test_small_unencrypted_group() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
alice.allow_unencrypted().await?;
bob.allow_unencrypted().await?;
let alice_chat_id = chat::create_group_unencrypted(alice, "Unencrypted group").await?; let alice_chat_id = chat::create_group_unencrypted(alice, "Unencrypted group").await?;
let alice_bob_id = alice.add_or_lookup_address_contact_id(bob).await; let alice_bob_id = alice.add_or_lookup_address_contact_id(bob).await;
@@ -5510,6 +5594,7 @@ async fn test_small_unencrypted_group() -> Result<()> {
async fn test_bcc_not_a_group() -> Result<()> { async fn test_bcc_not_a_group() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.allow_unencrypted().await.unwrap();
let received = receive_imf( let received = receive_imf(
alice, alice,
@@ -5557,6 +5642,7 @@ async fn test_lookup_key_contact_by_address_self() -> Result<()> {
async fn test_calendar_alternative() -> Result<()> { async fn test_calendar_alternative() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let t = &tcm.alice().await; let t = &tcm.alice().await;
t.allow_unencrypted().await?;
let raw = include_bytes!("../../test-data/message/calendar-alternative.eml"); let raw = include_bytes!("../../test-data/message/calendar-alternative.eml");
let msg = receive_imf(t, raw, false).await?.unwrap(); let msg = receive_imf(t, raw, false).await?.unwrap();
assert_eq!(msg.msg_ids.len(), 1); assert_eq!(msg.msg_ids.len(), 1);

View File

@@ -772,6 +772,7 @@ fn manipulate_qr(v3: bool, remove_invite: bool, qr: &mut String) {
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_adhoc_group_no_qr() -> Result<()> { async fn test_adhoc_group_no_qr() -> Result<()> {
let alice = TestContext::new_alice().await; let alice = TestContext::new_alice().await;
alice.allow_unencrypted().await?;
let mime = br#"Subject: First thread let mime = br#"Subject: First thread
Message-ID: first@example.org Message-ID: first@example.org
@@ -1415,6 +1416,7 @@ async fn test_vc_request_encrypted_at_rest() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
alice.allow_unencrypted().await?;
let qr = get_securejoin_qr(alice, None).await?; let qr = get_securejoin_qr(alice, None).await?;

View File

@@ -151,6 +151,7 @@ async fn test_message_stats() -> Result<()> {
alice alice
.set_config_internal(Config::StatsSending, Some("1")) .set_config_internal(Config::StatsSending, Some("1"))
.await?; .await?;
alice.allow_unencrypted().await?;
let email_chat = alice.create_email_chat(bob).await; let email_chat = alice.create_email_chat(bob).await;
let encrypted_chat = alice.create_chat(bob).await; let encrypted_chat = alice.create_chat(bob).await;

View File

@@ -1229,6 +1229,13 @@ ORDER BY id"
.await .await
.unwrap(); .unwrap();
} }
/// Allow reception of unencrypted messages.
#[expect(clippy::unused_async)]
pub async fn allow_unencrypted(&self) -> Result<()> {
// Does nothing for now.
Ok(())
}
} }
pub async fn encrypt_raw_message( pub async fn encrypt_raw_message(

View File

@@ -180,9 +180,10 @@ async fn test_selfavatar_and_autocrypt_gossip_goto_pre_message() -> Result<()> {
} }
#[tokio::test(flavor = "multi_thread", worker_threads = 2)] #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_unecrypted_gets_no_pre_message() -> Result<()> { async fn test_unencrypted_gets_no_pre_message() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.allow_unencrypted().await?;
let chat = alice let chat = alice
.create_chat_with_contact("example", "email@example.org") .create_chat_with_contact("example", "email@example.org")

View File

@@ -175,6 +175,7 @@ async fn test_degrade_verified_oneonone_chat() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
alice.allow_unencrypted().await?;
mark_as_verified(alice, bob).await; mark_as_verified(alice, bob).await;
@@ -272,6 +273,7 @@ async fn test_outgoing_mua_msg() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
alice.allow_unencrypted().await?;
mark_as_verified(alice, bob).await; mark_as_verified(alice, bob).await;
mark_as_verified(bob, alice).await; mark_as_verified(bob, alice).await;
@@ -333,6 +335,7 @@ async fn test_reply() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = tcm.alice().await; let alice = tcm.alice().await;
let bob = tcm.bob().await; let bob = tcm.bob().await;
alice.allow_unencrypted().await?;
if verified { if verified {
mark_as_verified(&alice, &bob).await; mark_as_verified(&alice, &bob).await;

View File

@@ -60,6 +60,7 @@ Hop: From: hq5.example.org; By: hq5.example.org; Date: Mon, 27 Dec 2021 11:21:22
async fn check_parse_receive_headers_integration(raw: &[u8], expected: &str) { async fn check_parse_receive_headers_integration(raw: &[u8], expected: &str) {
let t = TestContext::new_alice().await; let t = TestContext::new_alice().await;
t.allow_unencrypted().await.unwrap();
let received = receive_imf(&t, raw, false).await.unwrap().unwrap(); let received = receive_imf(&t, raw, false).await.unwrap().unwrap();
assert_eq!(received.msg_ids.len(), 1); assert_eq!(received.msg_ids.len(), 1);

View File

@@ -687,7 +687,9 @@ async fn test_send_webxdc_status_update() -> Result<()> {
let mut tcm = TestContextManager::new(); let mut tcm = TestContextManager::new();
let alice = &tcm.alice().await; let alice = &tcm.alice().await;
alice.set_config_bool(Config::BccSelf, true).await?; alice.set_config_bool(Config::BccSelf, true).await?;
alice.allow_unencrypted().await?;
let bob = &tcm.bob().await; let bob = &tcm.bob().await;
bob.allow_unencrypted().await?;
// Alice sends an webxdc instance and a status update // Alice sends an webxdc instance and a status update
let alice_chat = alice.create_email_chat(bob).await; let alice_chat = alice.create_email_chat(bob).await;
@@ -753,6 +755,7 @@ async fn test_send_webxdc_status_update() -> Result<()> {
// Alice has a second device and also receives messages there // Alice has a second device and also receives messages there
let alice2 = &tcm.alice().await; let alice2 = &tcm.alice().await;
alice2.allow_unencrypted().await?;
alice2.recv_msg(sent1).await; alice2.recv_msg(sent1).await;
alice2.recv_msg_trash(sent2).await; alice2.recv_msg_trash(sent2).await;
let alice2_instance = alice2.get_last_msg().await; let alice2_instance = alice2.get_last_msg().await;