From 02acce2dd8082bb56e0bec802bcfe4cb3d9a8655 Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 14 May 2021 10:39:29 +0200 Subject: [PATCH] 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 --- proxmox/src/tools/email.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/proxmox/src/tools/email.rs b/proxmox/src/tools/email.rs index 0b92a5b3..fc69488c 100644 --- a/proxmox/src/tools/email.rs +++ b/proxmox/src/tools/email.rs @@ -113,20 +113,20 @@ mod test { use crate::tools::email::sendmail; #[test] - fn test1() { + fn send_email_to_root_localhost() { let result = sendmail( - &["somenotvalidemail!", "somealmostvalid email"], + &["root@localhost"], "Subject1", Some("TEXT"), Some("HTML"), - Some("bim@bam.bum"), + Some("root@localhost"), Some("test1"), ); - assert!(result.is_err()); + assert!(result.is_ok()); } #[test] - fn test2() { + fn email_without_recipients() { let result = sendmail( &[], "Subject2", @@ -139,15 +139,15 @@ mod test { } #[test] - fn test3() { + fn email_with_non_existant_recipient() { let result = sendmail( - &["a@b.c"], + &["some-nonexistant-proxmox-user"], "Subject3", None, Some("HTML"), - Some("notv@lid.com!"), + None, Some("test1"), ); - assert!(result.is_err()); + assert!(result.is_ok()); } }