mirror of
https://git.proxmox.com/git/proxmox
synced 2025-05-17 11:15:46 +00:00
proxmox/tools/email: adapt tests to changes to sendmail
with test1/3 we only tested the regex, which is now gone transform the tests to valid emails, so we test this also and rename them to know what they should test Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
a7f4002306
commit
02acce2dd8
@ -113,20 +113,20 @@ mod test {
|
|||||||
use crate::tools::email::sendmail;
|
use crate::tools::email::sendmail;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test1() {
|
fn send_email_to_root_localhost() {
|
||||||
let result = sendmail(
|
let result = sendmail(
|
||||||
&["somenotvalidemail!", "somealmostvalid email"],
|
&["root@localhost"],
|
||||||
"Subject1",
|
"Subject1",
|
||||||
Some("TEXT"),
|
Some("TEXT"),
|
||||||
Some("<b>HTML</b>"),
|
Some("<b>HTML</b>"),
|
||||||
Some("bim@bam.bum"),
|
Some("root@localhost"),
|
||||||
Some("test1"),
|
Some("test1"),
|
||||||
);
|
);
|
||||||
assert!(result.is_err());
|
assert!(result.is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test2() {
|
fn email_without_recipients() {
|
||||||
let result = sendmail(
|
let result = sendmail(
|
||||||
&[],
|
&[],
|
||||||
"Subject2",
|
"Subject2",
|
||||||
@ -139,15 +139,15 @@ mod test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test3() {
|
fn email_with_non_existant_recipient() {
|
||||||
let result = sendmail(
|
let result = sendmail(
|
||||||
&["a@b.c"],
|
&["some-nonexistant-proxmox-user"],
|
||||||
"Subject3",
|
"Subject3",
|
||||||
None,
|
None,
|
||||||
Some("<b>HTML</b>"),
|
Some("<b>HTML</b>"),
|
||||||
Some("notv@lid.com!"),
|
None,
|
||||||
Some("test1"),
|
Some("test1"),
|
||||||
);
|
);
|
||||||
assert!(result.is_err());
|
assert!(result.is_ok());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user