From 10957731fa9ffa411fe26dded4b32f0429710d1b Mon Sep 17 00:00:00 2001
From: Nicolas KAROLAK <nicolas.karolak@ubicast.eu>
Date: Mon, 23 Sep 2019 17:50:23 +0200
Subject: [PATCH] fix check_listen & and maillog support

---
 tests/test_email.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/test_email.py b/tests/test_email.py
index 402d2244..ac86b665 100755
--- a/tests/test_email.py
+++ b/tests/test_email.py
@@ -37,8 +37,8 @@ def check_listen() -> tuple:
     if status != 0 or ("127.0.0.1:25" not in out and "[::1]:25" not in out):
         u.error("Postfix is not listening on localhost:25")
         errors += 1
-
-    u.success("Postfix is listening on localhost:25")
+    else:
+        u.success("Postfix is listening on localhost:25")
 
     return warnings, errors
 
@@ -126,10 +126,10 @@ def check_send(sender: str) -> tuple:
     out = ""
 
     # find logs
-    if Path("/var/log/mail.log").is_file():
-        cmd = "grep '{}' /var/log/mail.log".format(email)
-    elif Path("/var/log/maillog").is_file():
+    if Path("/var/log/maillog").is_file():
         cmd = "grep '{}' /var/log/maillog".format(email)
+    elif Path("/var/log/mail.log").is_file():
+        cmd = "grep '{}' /var/log/mail.log".format(email)
     else:
         u.info("/var/log/mail.log not found, trying journalctl")
         cmd = "journalctl -t postfix/smtp | grep {}".format(email)
-- 
GitLab