mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
test_utils: set message state to OutDelivered on .pop_sent_msg()
Also remove SentMessage.id. It was set to foreign_id of the job, which is a MsgId, not ChatId, so tests using it were not correct anyway.
This commit is contained in:
committed by
link2xt
parent
93e038e056
commit
00a223b574
@@ -1117,10 +1117,9 @@ mod tests {
|
||||
.unwrap();
|
||||
|
||||
// Bob scans QR-code, sends vc-request
|
||||
let bob_chatid = dc_join_securejoin(&bob.ctx, &qr).await.unwrap();
|
||||
dc_join_securejoin(&bob.ctx, &qr).await.unwrap();
|
||||
|
||||
let sent = bob.pop_sent_msg().await;
|
||||
assert_eq!(sent.id(), bob_chatid);
|
||||
assert_eq!(sent.recipient(), "alice@example.com".parse().unwrap());
|
||||
let msg = alice.parse_msg(&sent).await;
|
||||
assert!(!msg.was_encrypted());
|
||||
|
||||
@@ -17,7 +17,7 @@ use crate::dc_receive_imf::dc_receive_imf;
|
||||
use crate::dc_tools::EmailAddress;
|
||||
use crate::job::Action;
|
||||
use crate::key::{self, DcKey};
|
||||
use crate::message::Message;
|
||||
use crate::message::{update_msg_state, Message, MessageState, MsgId};
|
||||
use crate::mimeparser::MimeMessage;
|
||||
use crate::param::{Param, Params};
|
||||
|
||||
@@ -146,7 +146,7 @@ impl TestContext {
|
||||
panic!("no sent message found in jobs table");
|
||||
}
|
||||
};
|
||||
let id = ChatId::new(foreign_id as u32);
|
||||
let id = MsgId::new(foreign_id as u32);
|
||||
let params = Params::from_str(&raw_params).unwrap();
|
||||
let blob_path = params
|
||||
.get_blob(Param::File, &self.ctx, false)
|
||||
@@ -159,11 +159,8 @@ impl TestContext {
|
||||
.execute("DELETE FROM jobs WHERE id=?;", paramsv![rowid])
|
||||
.await
|
||||
.expect("failed to remove job");
|
||||
SentMessage {
|
||||
id,
|
||||
params,
|
||||
blob_path,
|
||||
}
|
||||
update_msg_state(&self.ctx, id, MessageState::OutDelivered).await;
|
||||
SentMessage { params, blob_path }
|
||||
}
|
||||
|
||||
/// Parse a message.
|
||||
@@ -210,17 +207,11 @@ impl TestContext {
|
||||
/// passed through a SMTP-IMAP pipeline.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SentMessage {
|
||||
id: ChatId,
|
||||
params: Params,
|
||||
blob_path: PathBuf,
|
||||
}
|
||||
|
||||
impl SentMessage {
|
||||
/// The ChatId the message belonged to.
|
||||
pub fn id(&self) -> ChatId {
|
||||
self.id
|
||||
}
|
||||
|
||||
/// A recipient the message was destined for.
|
||||
///
|
||||
/// If there are multiple recipients this is just a random one, so is not very useful.
|
||||
|
||||
Reference in New Issue
Block a user