diff --git a/fail2ban/tests/misctestcase.py b/fail2ban/tests/misctestcase.py index adf7886b..5f0e70e4 100644 --- a/fail2ban/tests/misctestcase.py +++ b/fail2ban/tests/misctestcase.py @@ -304,8 +304,10 @@ class TestsUtilsTest(LogCaptureTestCase): ## assertLogged, assertNotLogged negative case: self.pruneLog() logSys.debug('test "xyz"') - self._testAssertionErrorRE(r"All of the .* were found present in the log", + self._testAssertionErrorRE(r".* was found in the log", self.assertNotLogged, 'test "xyz"') + self._testAssertionErrorRE(r"All of the .* were found present in the log", + self.assertNotLogged, 'test "xyz"', 'test') self._testAssertionErrorRE(r"was found in the log", self.assertNotLogged, 'test', 'xyz', all=True) self._testAssertionErrorRE(r"was not found in the log", diff --git a/fail2ban/tests/utils.py b/fail2ban/tests/utils.py index 27229b69..5c398ca9 100644 --- a/fail2ban/tests/utils.py +++ b/fail2ban/tests/utils.py @@ -807,7 +807,7 @@ class LogCaptureTestCase(unittest.TestCase): all : boolean (default False) if True should fail if any of s logged """ logged = self._log.getvalue() - if not kwargs.get('all', False): + if len(s) > 1 and not kwargs.get('all', False): for s_ in s: if s_ not in logged: return