From 51cae63bf0cbdcfe1bdc142a65166e2002101b50 Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 9 Oct 2014 15:39:58 +0200 Subject: [PATCH] more precise by test --- fail2ban/tests/clientreadertestcase.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fail2ban/tests/clientreadertestcase.py b/fail2ban/tests/clientreadertestcase.py index a5fe7b6e..a24856da 100644 --- a/fail2ban/tests/clientreadertestcase.py +++ b/fail2ban/tests/clientreadertestcase.py @@ -378,22 +378,21 @@ class JailsReaderTestCache(LogCaptureTestCase): cnt = self._getLoggedReadCount('jail.local') # if cnt > 1: # self.printLog() - self.assertFalse(cnt > 1, "Too many times reading of jail files, cnt = %s" % cnt) - self.assertNotEqual(cnt, 0) + self.assertTrue(cnt == 1, "Unexpected count by reading of jail files, cnt = %s" % cnt) # read whole configuration like a file2ban-client, again ... # but this time force enable all jails, to check filter and action cached also: self._readWholeConf(basedir, force_enable=True) cnt = self._getLoggedReadCount(r'jail\.local') # still one (no more reads): - self.assertFalse(cnt > 1, "Too many times second reading of jail files, cnt = %s" % cnt) + self.assertTrue(cnt == 1, "Unexpected count by second reading of jail files, cnt = %s" % cnt) # same with filter: cnt = self._getLoggedReadCount(r'filter\.d/common\.conf') - self.assertFalse(cnt > 1, "Too many times reading of filter files, cnt = %s" % cnt) + self.assertTrue(cnt == 1, "Unexpected count by reading of filter files, cnt = %s" % cnt) # same with action: cnt = self._getLoggedReadCount(r'action\.d/iptables-common\.conf') - self.assertFalse(cnt > 1, "Too many times reading of action files, cnt = %s" % cnt) + self.assertTrue(cnt == 1, "Unexpected count by reading of action files, cnt = %s" % cnt) finally: shutil.rmtree(basedir)