mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
refactor: use SampleString
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
use rand::Rng;
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
@@ -20,6 +19,8 @@ use crate::test_utils::{
|
|||||||
};
|
};
|
||||||
use crate::tools::{SystemTime, time};
|
use crate::tools::{SystemTime, time};
|
||||||
|
|
||||||
|
use rand::distr::SampleString;
|
||||||
|
|
||||||
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
||||||
async fn test_outgoing() -> Result<()> {
|
async fn test_outgoing() -> Result<()> {
|
||||||
let context = TestContext::new_alice().await;
|
let context = TestContext::new_alice().await;
|
||||||
@@ -4339,11 +4340,8 @@ async fn test_download_later() -> Result<()> {
|
|||||||
let bob_chat = bob.create_chat(&alice).await;
|
let bob_chat = bob.create_chat(&alice).await;
|
||||||
|
|
||||||
// Generate a random string so OpenPGP does not compress it.
|
// Generate a random string so OpenPGP does not compress it.
|
||||||
let text: String = rand::rng()
|
let text =
|
||||||
.sample_iter(&rand::distr::Alphanumeric)
|
rand::distr::Alphanumeric.sample_string(&mut rand::rng(), MIN_DOWNLOAD_LIMIT as usize);
|
||||||
.take(MIN_DOWNLOAD_LIMIT as usize)
|
|
||||||
.map(char::from)
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let sent_msg = bob.send_text(bob_chat.id, &text).await;
|
let sent_msg = bob.send_text(bob_chat.id, &text).await;
|
||||||
let msg = alice.recv_msg(&sent_msg).await;
|
let msg = alice.recv_msg(&sent_msg).await;
|
||||||
|
|||||||
Reference in New Issue
Block a user