mirror of https://github.com/fail2ban/fail2ban
improve failure-message of assertNotLogged in case of single match given
parent
7c9146feb3
commit
48c2cbfa0b
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue