From 3d80e881c55cc6032b1ebf0f18a67f6cb90b2b76 Mon Sep 17 00:00:00 2001 From: sebres Date: Fri, 26 Apr 2019 13:29:19 +0200 Subject: [PATCH] increase coverage (if python-systemd not available, so some tests may be skipped) --- fail2ban/tests/fail2banregextestcase.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fail2ban/tests/fail2banregextestcase.py b/fail2ban/tests/fail2banregextestcase.py index c8b0564a..8d6df537 100644 --- a/fail2ban/tests/fail2banregextestcase.py +++ b/fail2ban/tests/fail2banregextestcase.py @@ -218,6 +218,18 @@ class Fail2banRegexTest(LogCaptureTestCase): # test failure line and not-failure lines both presents: self.assertLogged("[29116]: User root not allowed because account is locked", "[29116]: Received disconnect from 1.2.3.4", all=True) + self.pruneLog() + # show real options: + (opts, args, fail2banRegex) = _Fail2banRegex( + "-l", "notice", # put down log-level, because of too many debug-messages + "-vv", "-c", CONFIG_DIR, + "Dec 31 11:59:59 [sshd] error: PAM: Authentication failure for kevin from 192.0.2.1", + "sshd[logtype=short]" + ) + self.assertTrue(fail2banRegex.start(args)) + # tet logtype is specified and set in real options: + self.assertLogged("Real filter options :", "'logtype': 'short'", all=True) + self.assertNotLogged("'logtype': 'file'", "'logtype': 'journal'", all=True) def testFastSshd(self): (opts, args, fail2banRegex) = _Fail2banRegex(