"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "fail2ban/tests/utils.py" between
fail2ban-0.10.5.tar.gz and fail2ban-0.11.1.tar.gz

About:

utils.py  (fail2ban-0.10.5):utils.py  (fail2ban-0.11.1)
skipping to change at line 375 skipping to change at line 375
from . import tickettestcase from . import tickettestcase
from . import failmanagertestcase from . import failmanagertestcase
from . import filtertestcase from . import filtertestcase
from . import servertestcase from . import servertestcase
from . import datedetectortestcase from . import datedetectortestcase
from . import actiontestcase from . import actiontestcase
from . import actionstestcase from . import actionstestcase
from . import sockettestcase from . import sockettestcase
from . import misctestcase from . import misctestcase
from . import databasetestcase from . import databasetestcase
from . import observertestcase
from . import samplestestcase from . import samplestestcase
from . import fail2banclienttestcase from . import fail2banclienttestcase
from . import fail2banregextestcase from . import fail2banregextestcase
if not regexps: # pragma: no cover if not regexps: # pragma: no cover
tests = unittest.TestSuite() tests = unittest.TestSuite()
else: # pragma: no cover else: # pragma: no cover
class FilteredTestSuite(unittest.TestSuite): class FilteredTestSuite(unittest.TestSuite):
_regexps = [re.compile(r) for r in regexps] _regexps = [re.compile(r) for r in regexps]
skipping to change at line 405 skipping to change at line 406
m = r.search(s) m = r.search(s)
if (m if not opts.negate_re else not m): if (m if not opts.negate_re else not m):
matched.append(test) matched.append(test)
break break
for test in matched: for test in matched:
super(FilteredTestSuite, self).addTest(te st) super(FilteredTestSuite, self).addTest(te st)
tests = FilteredTestSuite() tests = FilteredTestSuite()
# Server # Server
#tests.addTest(unittest.makeSuite(servertestcase.StartStop))
tests.addTest(unittest.makeSuite(servertestcase.Transmitter)) tests.addTest(unittest.makeSuite(servertestcase.Transmitter))
tests.addTest(unittest.makeSuite(servertestcase.JailTests)) tests.addTest(unittest.makeSuite(servertestcase.JailTests))
tests.addTest(unittest.makeSuite(servertestcase.RegexTests)) tests.addTest(unittest.makeSuite(servertestcase.RegexTests))
tests.addTest(unittest.makeSuite(servertestcase.LoggingTests)) tests.addTest(unittest.makeSuite(servertestcase.LoggingTests))
tests.addTest(unittest.makeSuite(servertestcase.ServerConfigReaderTests)) tests.addTest(unittest.makeSuite(servertestcase.ServerConfigReaderTests))
tests.addTest(unittest.makeSuite(actiontestcase.CommandActionTest)) tests.addTest(unittest.makeSuite(actiontestcase.CommandActionTest))
tests.addTest(unittest.makeSuite(actionstestcase.ExecuteActions)) tests.addTest(unittest.makeSuite(actionstestcase.ExecuteActions))
# Ticket, BanTicket, FailTicket # Ticket, BanTicket, FailTicket
tests.addTest(unittest.makeSuite(tickettestcase.TicketTests)) tests.addTest(unittest.makeSuite(tickettestcase.TicketTests))
# FailManager # FailManager
skipping to change at line 445 skipping to change at line 445
# CSocket and AsyncServer # CSocket and AsyncServer
tests.addTest(unittest.makeSuite(sockettestcase.Socket)) tests.addTest(unittest.makeSuite(sockettestcase.Socket))
tests.addTest(unittest.makeSuite(sockettestcase.ClientMisc)) tests.addTest(unittest.makeSuite(sockettestcase.ClientMisc))
# Misc helpers # Misc helpers
tests.addTest(unittest.makeSuite(misctestcase.HelpersTest)) tests.addTest(unittest.makeSuite(misctestcase.HelpersTest))
tests.addTest(unittest.makeSuite(misctestcase.SetupTest)) tests.addTest(unittest.makeSuite(misctestcase.SetupTest))
tests.addTest(unittest.makeSuite(misctestcase.TestsUtilsTest)) tests.addTest(unittest.makeSuite(misctestcase.TestsUtilsTest))
tests.addTest(unittest.makeSuite(misctestcase.MyTimeTest)) tests.addTest(unittest.makeSuite(misctestcase.MyTimeTest))
# Database # Database
tests.addTest(unittest.makeSuite(databasetestcase.DatabaseTest)) tests.addTest(unittest.makeSuite(databasetestcase.DatabaseTest))
# Observer
tests.addTest(unittest.makeSuite(observertestcase.ObserverTest))
tests.addTest(unittest.makeSuite(observertestcase.BanTimeIncr))
tests.addTest(unittest.makeSuite(observertestcase.BanTimeIncrDB))
# Filter # Filter
tests.addTest(unittest.makeSuite(filtertestcase.IgnoreIP)) tests.addTest(unittest.makeSuite(filtertestcase.IgnoreIP))
tests.addTest(unittest.makeSuite(filtertestcase.BasicFilter)) tests.addTest(unittest.makeSuite(filtertestcase.BasicFilter))
tests.addTest(unittest.makeSuite(filtertestcase.LogFile)) tests.addTest(unittest.makeSuite(filtertestcase.LogFile))
tests.addTest(unittest.makeSuite(filtertestcase.LogFileMonitor)) tests.addTest(unittest.makeSuite(filtertestcase.LogFileMonitor))
tests.addTest(unittest.makeSuite(filtertestcase.LogFileFilterPoll)) tests.addTest(unittest.makeSuite(filtertestcase.LogFileFilterPoll))
# each test case class self will check no network, and skip it (we see it in log) # each test case class self will check no network, and skip it (we see it in log)
tests.addTest(unittest.makeSuite(filtertestcase.IgnoreIPDNS)) tests.addTest(unittest.makeSuite(filtertestcase.IgnoreIPDNS))
tests.addTest(unittest.makeSuite(filtertestcase.GetFailures)) tests.addTest(unittest.makeSuite(filtertestcase.GetFailures))
skipping to change at line 742 skipping to change at line 746
def setUp(self): def setUp(self):
# For extended testing of what gets output into logging # For extended testing of what gets output into logging
# system, we will redirect it to a string # system, we will redirect it to a string
# Keep old settings # Keep old settings
self._old_level = logSys.level self._old_level = logSys.level
self._old_handlers = logSys.handlers self._old_handlers = logSys.handlers
# Let's log everything into a string # Let's log everything into a string
self._log = LogCaptureTestCase._MemHandler(unittest.F2B.log_lazy) self._log = LogCaptureTestCase._MemHandler(unittest.F2B.log_lazy)
logSys.handlers = [self._log] logSys.handlers = [self._log]
if self._old_level <= logging.DEBUG: # lowest log level to capture messages (expected in tests) is Lev
.9
if self._old_level <= logging.DEBUG: # pragma: no cover
logSys.handlers += self._old_handlers logSys.handlers += self._old_handlers
else: # lowest log level to capture messages if self._old_level > logging.DEBUG-1:
logSys.setLevel(logging.DEBUG) logSys.setLevel(logging.DEBUG-1)
super(LogCaptureTestCase, self).setUp() super(LogCaptureTestCase, self).setUp()
def tearDown(self): def tearDown(self):
"""Call after every test case.""" """Call after every test case."""
# print "O: >>%s<<" % self._log.getvalue() # print "O: >>%s<<" % self._log.getvalue()
self.pruneLog() self.pruneLog()
logSys.handlers = self._old_handlers logSys.handlers = self._old_handlers
logSys.level = self._old_level logSys.level = self._old_level
super(LogCaptureTestCase, self).tearDown() super(LogCaptureTestCase, self).tearDown()
 End of changes. 5 change blocks. 
4 lines changed or deleted 10 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)