mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 12:56:30 +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();
|
.unwrap();
|
||||||
|
|
||||||
// Bob scans QR-code, sends vc-request
|
// 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;
|
let sent = bob.pop_sent_msg().await;
|
||||||
assert_eq!(sent.id(), bob_chatid);
|
|
||||||
assert_eq!(sent.recipient(), "alice@example.com".parse().unwrap());
|
assert_eq!(sent.recipient(), "alice@example.com".parse().unwrap());
|
||||||
let msg = alice.parse_msg(&sent).await;
|
let msg = alice.parse_msg(&sent).await;
|
||||||
assert!(!msg.was_encrypted());
|
assert!(!msg.was_encrypted());
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use crate::dc_receive_imf::dc_receive_imf;
|
|||||||
use crate::dc_tools::EmailAddress;
|
use crate::dc_tools::EmailAddress;
|
||||||
use crate::job::Action;
|
use crate::job::Action;
|
||||||
use crate::key::{self, DcKey};
|
use crate::key::{self, DcKey};
|
||||||
use crate::message::Message;
|
use crate::message::{update_msg_state, Message, MessageState, MsgId};
|
||||||
use crate::mimeparser::MimeMessage;
|
use crate::mimeparser::MimeMessage;
|
||||||
use crate::param::{Param, Params};
|
use crate::param::{Param, Params};
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ impl TestContext {
|
|||||||
panic!("no sent message found in jobs table");
|
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 params = Params::from_str(&raw_params).unwrap();
|
||||||
let blob_path = params
|
let blob_path = params
|
||||||
.get_blob(Param::File, &self.ctx, false)
|
.get_blob(Param::File, &self.ctx, false)
|
||||||
@@ -159,11 +159,8 @@ impl TestContext {
|
|||||||
.execute("DELETE FROM jobs WHERE id=?;", paramsv![rowid])
|
.execute("DELETE FROM jobs WHERE id=?;", paramsv![rowid])
|
||||||
.await
|
.await
|
||||||
.expect("failed to remove job");
|
.expect("failed to remove job");
|
||||||
SentMessage {
|
update_msg_state(&self.ctx, id, MessageState::OutDelivered).await;
|
||||||
id,
|
SentMessage { params, blob_path }
|
||||||
params,
|
|
||||||
blob_path,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parse a message.
|
/// Parse a message.
|
||||||
@@ -210,17 +207,11 @@ impl TestContext {
|
|||||||
/// passed through a SMTP-IMAP pipeline.
|
/// passed through a SMTP-IMAP pipeline.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct SentMessage {
|
pub struct SentMessage {
|
||||||
id: ChatId,
|
|
||||||
params: Params,
|
params: Params,
|
||||||
blob_path: PathBuf,
|
blob_path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SentMessage {
|
impl SentMessage {
|
||||||
/// The ChatId the message belonged to.
|
|
||||||
pub fn id(&self) -> ChatId {
|
|
||||||
self.id
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A recipient the message was destined for.
|
/// A recipient the message was destined for.
|
||||||
///
|
///
|
||||||
/// If there are multiple recipients this is just a random one, so is not very useful.
|
/// If there are multiple recipients this is just a random one, so is not very useful.
|
||||||
|
|||||||
Reference in New Issue
Block a user