mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 05:46:29 +03:00
test: fix test_encrypt_decrypt_broadcast()
This commit is contained in:
@@ -5226,7 +5226,7 @@ impl Context {
|
||||
Blocked::Not,
|
||||
ProtectionStatus::Unprotected,
|
||||
None,
|
||||
create_smeared_timestamp(self),
|
||||
smeared_time(self),
|
||||
)
|
||||
.await?;
|
||||
save_broadcast_shared_secret(self, chat_id, shared_secret).await?;
|
||||
|
||||
@@ -3099,13 +3099,14 @@ async fn test_leave_broadcast_multidevice() -> Result<()> {
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||
async fn test_encrypt_decrypt_broadcast_integration() -> Result<()> {
|
||||
async fn test_encrypt_decrypt_broadcast() -> Result<()> {
|
||||
let mut tcm = TestContextManager::new();
|
||||
let alice = &tcm.alice().await;
|
||||
let bob = &tcm.bob().await;
|
||||
let bob_without_secret = &tcm.bob().await;
|
||||
|
||||
let secret = "secret";
|
||||
let grpid = "grpid";
|
||||
|
||||
let alice_bob_contact_id = alice.add_or_lookup_contact_id(bob).await;
|
||||
|
||||
@@ -3114,19 +3115,24 @@ async fn test_encrypt_decrypt_broadcast_integration() -> Result<()> {
|
||||
alice,
|
||||
Sync,
|
||||
"My Channel".to_string(),
|
||||
"grpid".to_string(),
|
||||
grpid.to_string(),
|
||||
secret.to_string(),
|
||||
)
|
||||
.await?;
|
||||
add_contact_to_chat(alice, alice_chat_id, alice_bob_contact_id).await?;
|
||||
add_to_chat_contacts_table(alice, time(), alice_chat_id, &[alice_bob_contact_id]).await?;
|
||||
|
||||
// TODO the chat_id 10 is magical here:
|
||||
bob.sql
|
||||
.execute(
|
||||
"INSERT INTO broadcasts_shared_secrets (chat_id, secret) VALUES (10, ?)",
|
||||
(secret,),
|
||||
)
|
||||
.await?;
|
||||
let bob_chat_id = ChatId::create_multiuser_record(
|
||||
bob,
|
||||
Chattype::InBroadcast,
|
||||
grpid,
|
||||
"My Channel",
|
||||
Blocked::Not,
|
||||
ProtectionStatus::Unprotected,
|
||||
None,
|
||||
time(),
|
||||
)
|
||||
.await?;
|
||||
save_broadcast_shared_secret(bob, bob_chat_id, secret).await?;
|
||||
|
||||
let sent = alice
|
||||
.send_text(alice_chat_id, "Symmetrically encrypted message")
|
||||
|
||||
@@ -19,7 +19,7 @@ use crate::param::Param;
|
||||
use crate::securejoin::{ContactId, encrypted_and_signed, verify_sender_by_fingerprint};
|
||||
use crate::stock_str;
|
||||
use crate::sync::Sync::*;
|
||||
use crate::tools::{create_smeared_timestamp, time};
|
||||
use crate::tools::{smeared_time, time};
|
||||
|
||||
/// Starts the securejoin protocol with the QR `invite`.
|
||||
///
|
||||
@@ -445,7 +445,7 @@ async fn joining_chat_id(
|
||||
Blocked::Not,
|
||||
ProtectionStatus::Unprotected, // protection is added later as needed
|
||||
None,
|
||||
create_smeared_timestamp(context),
|
||||
smeared_time(context),
|
||||
)
|
||||
.await?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user