mirror of https://github.com/fail2ban/fail2ban
Merge branch '0.10' into 0.10-full
commit
5ff63b66a0
|
@ -61,6 +61,7 @@ if sys.version_info >= (2,7): # pragma: no cover - may be unavailable
|
||||||
# Must cancel timer!
|
# Must cancel timer!
|
||||||
if self.action._timer:
|
if self.action._timer:
|
||||||
self.action._timer.cancel()
|
self.action._timer.cancel()
|
||||||
|
super(BadIPsActionTest, self).tearDown()
|
||||||
|
|
||||||
def testCategory(self):
|
def testCategory(self):
|
||||||
categories = self.action.getCategories()
|
categories = self.action.getCategories()
|
||||||
|
|
|
@ -81,6 +81,7 @@ class SMTPActionTest(unittest.TestCase):
|
||||||
self.smtpd.close()
|
self.smtpd.close()
|
||||||
self._active = False
|
self._active = False
|
||||||
self._loop_thread.join()
|
self._loop_thread.join()
|
||||||
|
super(SMTPActionTest, self).tearDown()
|
||||||
|
|
||||||
def _exec_and_wait(self, doaction, timeout=3, short=False):
|
def _exec_and_wait(self, doaction, timeout=3, short=False):
|
||||||
if short: timeout /= 25
|
if short: timeout /= 25
|
||||||
|
|
|
@ -41,6 +41,7 @@ class AddFailure(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Call after every test case."""
|
"""Call after every test case."""
|
||||||
|
super(AddFailure, self).tearDown()
|
||||||
tearDownMyTime()
|
tearDownMyTime()
|
||||||
|
|
||||||
def testAdd(self):
|
def testAdd(self):
|
||||||
|
@ -169,6 +170,7 @@ class StatusExtendedCymruInfo(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Call after every test case."""
|
"""Call after every test case."""
|
||||||
|
super(StatusExtendedCymruInfo, self).tearDown()
|
||||||
tearDownMyTime()
|
tearDownMyTime()
|
||||||
|
|
||||||
available = True, None
|
available = True, None
|
||||||
|
|
|
@ -37,6 +37,7 @@ class BeautifierTest(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
""" Call after every test case """
|
""" Call after every test case """
|
||||||
|
super(BeautifierTest, self).tearDown()
|
||||||
|
|
||||||
def testGetInputCmd(self):
|
def testGetInputCmd(self):
|
||||||
cmd = ["test"]
|
cmd = ["test"]
|
||||||
|
|
|
@ -42,7 +42,8 @@ class AddFailure(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Call after every test case."""
|
"""Call after every test case."""
|
||||||
|
super(AddFailure, self).tearDown()
|
||||||
|
|
||||||
def _addDefItems(self):
|
def _addDefItems(self):
|
||||||
self.__items = [[u'193.168.0.128', 1167605999.0],
|
self.__items = [[u'193.168.0.128', 1167605999.0],
|
||||||
[u'193.168.0.128', 1167605999.0],
|
[u'193.168.0.128', 1167605999.0],
|
||||||
|
|
|
@ -478,7 +478,7 @@ class LogFileFilterPoll(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Call after every test case."""
|
"""Call after every test case."""
|
||||||
pass
|
super(LogFileFilterPoll, self).tearDown()
|
||||||
|
|
||||||
#def testOpen(self):
|
#def testOpen(self):
|
||||||
# self.filter.openLogFile(LogFile.FILENAME)
|
# self.filter.openLogFile(LogFile.FILENAME)
|
||||||
|
@ -861,7 +861,7 @@ def get_monitor_failures_testcase(Filter_):
|
||||||
#print "D: KILLING THE FILE"
|
#print "D: KILLING THE FILE"
|
||||||
_killfile(self.file, self.name)
|
_killfile(self.file, self.name)
|
||||||
#time.sleep(0.2) # Give FS time to ack the removal
|
#time.sleep(0.2) # Give FS time to ack the removal
|
||||||
pass
|
super(MonitorFailures, self).tearDown()
|
||||||
|
|
||||||
def _sleep_4_poll(self):
|
def _sleep_4_poll(self):
|
||||||
# Since FilterPoll relies on time stamps and some
|
# Since FilterPoll relies on time stamps and some
|
||||||
|
@ -1076,7 +1076,7 @@ def get_monitor_failures_journal_testcase(Filter_): # pragma: systemd no cover
|
||||||
if self.filter and self.filter.active:
|
if self.filter and self.filter.active:
|
||||||
self.filter.stop()
|
self.filter.stop()
|
||||||
self.filter.join() # wait for the thread to terminate
|
self.filter.join() # wait for the thread to terminate
|
||||||
pass
|
super(MonitorJournalFailures, self).tearDown()
|
||||||
|
|
||||||
def _getRuntimeJournal(self):
|
def _getRuntimeJournal(self):
|
||||||
# retrieve current system journal path
|
# retrieve current system journal path
|
||||||
|
|
|
@ -54,6 +54,7 @@ class FilterSamplesRegex(unittest.TestCase):
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
"""Call after every test case."""
|
"""Call after every test case."""
|
||||||
|
super(FilterSamplesRegex, self).tearDown()
|
||||||
tearDownMyTime()
|
tearDownMyTime()
|
||||||
|
|
||||||
def testFiltersPresent(self):
|
def testFiltersPresent(self):
|
||||||
|
|
|
@ -79,7 +79,7 @@ class TransmitterBase(unittest.TestCase):
|
||||||
"""Call after every test case."""
|
"""Call after every test case."""
|
||||||
# stop jails, etc.
|
# stop jails, etc.
|
||||||
self.server.quit()
|
self.server.quit()
|
||||||
#super(TransmitterBase, self).tearDown()
|
super(TransmitterBase, self).tearDown()
|
||||||
|
|
||||||
def setGetTest(self, cmd, inValue, outValue=(None,), outCode=0, jail=None, repr_=False):
|
def setGetTest(self, cmd, inValue, outValue=(None,), outCode=0, jail=None, repr_=False):
|
||||||
"""Process set/get commands and compare both return values
|
"""Process set/get commands and compare both return values
|
||||||
|
|
|
@ -535,12 +535,21 @@ if True: ## if not hasattr(unittest.TestCase, 'assertIn'):
|
||||||
_org_setUp = unittest.TestCase.setUp
|
_org_setUp = unittest.TestCase.setUp
|
||||||
def _customSetUp(self):
|
def _customSetUp(self):
|
||||||
# print('=='*10, self)
|
# print('=='*10, self)
|
||||||
if unittest.F2B.log_level <= logging.DEBUG: # so if DEBUG etc -- show them (and log it in travis)!
|
# so if DEBUG etc -- show them (and log it in travis)!
|
||||||
print("")
|
if unittest.F2B.log_level <= logging.DEBUG: # pragma: no cover
|
||||||
|
sys.stderr.write("\n")
|
||||||
logSys.debug('='*10 + ' %s ' + '='*20, self.id())
|
logSys.debug('='*10 + ' %s ' + '='*20, self.id())
|
||||||
_org_setUp(self)
|
_org_setUp(self)
|
||||||
|
if unittest.F2B.verbosity > 2: # pragma: no cover
|
||||||
|
self.__startTime = time.time()
|
||||||
|
|
||||||
|
_org_tearDown = unittest.TestCase.tearDown
|
||||||
|
def _customTearDown(self):
|
||||||
|
if unittest.F2B.verbosity > 2: # pragma: no cover
|
||||||
|
sys.stderr.write(" %.3fs -- " % (time.time() - self.__startTime,))
|
||||||
|
|
||||||
unittest.TestCase.setUp = _customSetUp
|
unittest.TestCase.setUp = _customSetUp
|
||||||
|
unittest.TestCase.tearDown = _customTearDown
|
||||||
|
|
||||||
|
|
||||||
class LogCaptureTestCase(unittest.TestCase):
|
class LogCaptureTestCase(unittest.TestCase):
|
||||||
|
|
Loading…
Reference in New Issue