mirror of https://github.com/fail2ban/fail2ban
Fix PEP8 E303 too many blank lines
parent
60c5c6951c
commit
fbeee8bb28
|
@ -271,7 +271,6 @@ class BanManager:
|
||||||
finally:
|
finally:
|
||||||
self.__lock.release()
|
self.__lock.release()
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Get the size of the ban list.
|
# Get the size of the ban list.
|
||||||
#
|
#
|
||||||
|
|
|
@ -94,7 +94,6 @@ class Regex:
|
||||||
except ValueError:
|
except ValueError:
|
||||||
self._matchLineEnd = len(self._matchCache.string)
|
self._matchLineEnd = len(self._matchCache.string)
|
||||||
|
|
||||||
|
|
||||||
lineCount1 = self._matchCache.string.count(
|
lineCount1 = self._matchCache.string.count(
|
||||||
"\n", 0, self._matchLineStart)
|
"\n", 0, self._matchLineStart)
|
||||||
lineCount2 = self._matchCache.string.count(
|
lineCount2 = self._matchCache.string.count(
|
||||||
|
|
|
@ -86,7 +86,6 @@ class Filter(JailThread):
|
||||||
self.dateDetector.addDefaultTemplate()
|
self.dateDetector.addDefaultTemplate()
|
||||||
logSys.debug("Created %s" % self)
|
logSys.debug("Created %s" % self)
|
||||||
|
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "%s(%r)" % (self.__class__.__name__, self.jail)
|
return "%s(%r)" % (self.__class__.__name__, self.jail)
|
||||||
|
|
||||||
|
@ -109,7 +108,6 @@ class Filter(JailThread):
|
||||||
logSys.error(e)
|
logSys.error(e)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
def delFailRegex(self, index):
|
def delFailRegex(self, index):
|
||||||
try:
|
try:
|
||||||
del self.__failRegex[index]
|
del self.__failRegex[index]
|
||||||
|
@ -395,7 +393,6 @@ class Filter(JailThread):
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def processLine(self, line, date=None, returnRawHost=False,
|
def processLine(self, line, date=None, returnRawHost=False,
|
||||||
checkAllRegex=False):
|
checkAllRegex=False):
|
||||||
"""Split the time portion from log msg and return findFailures on them
|
"""Split the time portion from log msg and return findFailures on them
|
||||||
|
@ -581,7 +578,6 @@ class FileFilter(Filter):
|
||||||
# to be overridden by backends
|
# to be overridden by backends
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Delete a log path
|
# Delete a log path
|
||||||
#
|
#
|
||||||
|
|
|
@ -61,7 +61,6 @@ class FilterGamin(FileFilter):
|
||||||
fcntl.fcntl(fd, fcntl.F_SETFD, flags|fcntl.FD_CLOEXEC)
|
fcntl.fcntl(fd, fcntl.F_SETFD, flags|fcntl.FD_CLOEXEC)
|
||||||
logSys.debug("Created FilterGamin")
|
logSys.debug("Created FilterGamin")
|
||||||
|
|
||||||
|
|
||||||
def callback(self, path, event):
|
def callback(self, path, event):
|
||||||
logSys.debug("Got event: " + repr(event) + " for " + path)
|
logSys.debug("Got event: " + repr(event) + " for " + path)
|
||||||
if event in (gamin.GAMCreated, gamin.GAMChanged, gamin.GAMExists):
|
if event in (gamin.GAMCreated, gamin.GAMChanged, gamin.GAMExists):
|
||||||
|
@ -70,7 +69,6 @@ class FilterGamin(FileFilter):
|
||||||
|
|
||||||
self._process_file(path)
|
self._process_file(path)
|
||||||
|
|
||||||
|
|
||||||
def _process_file(self, path):
|
def _process_file(self, path):
|
||||||
"""Process a given file
|
"""Process a given file
|
||||||
|
|
||||||
|
@ -122,7 +120,6 @@ class FilterGamin(FileFilter):
|
||||||
logSys.debug(self.jail.name + ": filter terminated")
|
logSys.debug(self.jail.name + ": filter terminated")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
super(FilterGamin, self).stop()
|
super(FilterGamin, self).stop()
|
||||||
self.__cleanup()
|
self.__cleanup()
|
||||||
|
|
|
@ -73,7 +73,6 @@ class FilterPyinotify(FileFilter):
|
||||||
self.__watches = dict()
|
self.__watches = dict()
|
||||||
logSys.debug("Created FilterPyinotify")
|
logSys.debug("Created FilterPyinotify")
|
||||||
|
|
||||||
|
|
||||||
def callback(self, event, origin=''):
|
def callback(self, event, origin=''):
|
||||||
logSys.debug("%sCallback for Event: %s", origin, event)
|
logSys.debug("%sCallback for Event: %s", origin, event)
|
||||||
path = event.pathname
|
path = event.pathname
|
||||||
|
@ -95,7 +94,6 @@ class FilterPyinotify(FileFilter):
|
||||||
|
|
||||||
self._process_file(path)
|
self._process_file(path)
|
||||||
|
|
||||||
|
|
||||||
def _process_file(self, path):
|
def _process_file(self, path):
|
||||||
"""Process a given file
|
"""Process a given file
|
||||||
|
|
||||||
|
@ -112,7 +110,6 @@ class FilterPyinotify(FileFilter):
|
||||||
self.dateDetector.sortTemplate()
|
self.dateDetector.sortTemplate()
|
||||||
self.__modified = False
|
self.__modified = False
|
||||||
|
|
||||||
|
|
||||||
def _addFileWatcher(self, path):
|
def _addFileWatcher(self, path):
|
||||||
wd = self.__monitor.add_watch(path, pyinotify.IN_MODIFY)
|
wd = self.__monitor.add_watch(path, pyinotify.IN_MODIFY)
|
||||||
self.__watches.update(wd)
|
self.__watches.update(wd)
|
||||||
|
@ -144,7 +141,6 @@ class FilterPyinotify(FileFilter):
|
||||||
self._addFileWatcher(path)
|
self._addFileWatcher(path)
|
||||||
self._process_file(path)
|
self._process_file(path)
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Delete a log path
|
# Delete a log path
|
||||||
#
|
#
|
||||||
|
@ -163,7 +159,6 @@ class FilterPyinotify(FileFilter):
|
||||||
self.__monitor.rm_watch(wdInt)
|
self.__monitor.rm_watch(wdInt)
|
||||||
logSys.debug("Removed monitor for the parent directory %s", path_dir)
|
logSys.debug("Removed monitor for the parent directory %s", path_dir)
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Main loop.
|
# Main loop.
|
||||||
#
|
#
|
||||||
|
|
|
@ -61,7 +61,6 @@ class FilterSystemd(JournalFilter): # pragma: systemd no cover
|
||||||
self.setDatePattern(None)
|
self.setDatePattern(None)
|
||||||
logSys.debug("Created FilterSystemd")
|
logSys.debug("Created FilterSystemd")
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Add a journal match filters from list structure
|
# Add a journal match filters from list structure
|
||||||
#
|
#
|
||||||
|
|
|
@ -116,7 +116,6 @@ class Jail:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Failed to initialize any backend for Jail %r" % self.name)
|
"Failed to initialize any backend for Jail %r" % self.name)
|
||||||
|
|
||||||
|
|
||||||
def _initPolling(self):
|
def _initPolling(self):
|
||||||
from filterpoll import FilterPoll
|
from filterpoll import FilterPoll
|
||||||
logSys.info("Jail '%s' uses poller" % self.name)
|
logSys.info("Jail '%s' uses poller" % self.name)
|
||||||
|
|
|
@ -71,7 +71,6 @@ class Server:
|
||||||
self.setLogTarget("STDOUT")
|
self.setLogTarget("STDOUT")
|
||||||
self.setSyslogSocket("auto")
|
self.setSyslogSocket("auto")
|
||||||
|
|
||||||
|
|
||||||
def __sigTERMhandler(self, signum, frame):
|
def __sigTERMhandler(self, signum, frame):
|
||||||
logSys.debug("Caught signal %d. Exiting" % signum)
|
logSys.debug("Caught signal %d. Exiting" % signum)
|
||||||
self.quit()
|
self.quit()
|
||||||
|
@ -144,7 +143,6 @@ class Server:
|
||||||
finally:
|
finally:
|
||||||
self.__loggingLock.release()
|
self.__loggingLock.release()
|
||||||
|
|
||||||
|
|
||||||
def addJail(self, name, backend):
|
def addJail(self, name, backend):
|
||||||
self.__jails.add(name, backend, self.__db)
|
self.__jails.add(name, backend, self.__db)
|
||||||
if self.__db is not None:
|
if self.__db is not None:
|
||||||
|
@ -521,7 +519,6 @@ class Server:
|
||||||
def getDatabase(self):
|
def getDatabase(self):
|
||||||
return self.__db
|
return self.__db
|
||||||
|
|
||||||
|
|
||||||
def __createDaemon(self): # pragma: no cover
|
def __createDaemon(self): # pragma: no cover
|
||||||
""" Detach a process from the controlling terminal and run it in the
|
""" Detach a process from the controlling terminal and run it in the
|
||||||
background as a daemon.
|
background as a daemon.
|
||||||
|
|
|
@ -76,7 +76,6 @@ class ExecuteActions(LogCaptureTestCase):
|
||||||
self.assertEqual(self.__actions.getBanTime(),127)
|
self.assertEqual(self.__actions.getBanTime(),127)
|
||||||
self.assertRaises(ValueError, self.__actions.removeBannedIP, '127.0.0.1')
|
self.assertRaises(ValueError, self.__actions.removeBannedIP, '127.0.0.1')
|
||||||
|
|
||||||
|
|
||||||
def testActionsOutput(self):
|
def testActionsOutput(self):
|
||||||
self.defaultActions()
|
self.defaultActions()
|
||||||
self.__actions.start()
|
self.__actions.start()
|
||||||
|
@ -89,7 +88,6 @@ class ExecuteActions(LogCaptureTestCase):
|
||||||
self.assertEqual(self.__actions.status(),[("Currently banned", 0 ),
|
self.assertEqual(self.__actions.status(),[("Currently banned", 0 ),
|
||||||
("Total banned", 0 ), ("Banned IP list", [] )])
|
("Total banned", 0 ), ("Banned IP list", [] )])
|
||||||
|
|
||||||
|
|
||||||
def testAddActionPython(self):
|
def testAddActionPython(self):
|
||||||
self.__actions.add(
|
self.__actions.add(
|
||||||
"Action", os.path.join(TEST_FILES_DIR, "action.d/action.py"),
|
"Action", os.path.join(TEST_FILES_DIR, "action.d/action.py"),
|
||||||
|
|
|
@ -110,7 +110,6 @@ class CommandActionTest(LogCaptureTestCase):
|
||||||
{'ipjailmatches': "some >char< should \< be[ escap}ed&\n"}),
|
{'ipjailmatches': "some >char< should \< be[ escap}ed&\n"}),
|
||||||
"some \\>char\\< should \\\\\\< be\\[ escap\\}ed\\&\n")
|
"some \\>char\\< should \\\\\\< be\\[ escap\\}ed\\&\n")
|
||||||
|
|
||||||
|
|
||||||
# Recursive
|
# Recursive
|
||||||
aInfo["ABC"] = "<xyz>"
|
aInfo["ABC"] = "<xyz>"
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
|
|
@ -77,12 +77,10 @@ option = %s
|
||||||
os.unlink("%s/%s" % (self.d, fname))
|
os.unlink("%s/%s" % (self.d, fname))
|
||||||
self.assertTrue(self.c.read('c')) # we still should have some
|
self.assertTrue(self.c.read('c')) # we still should have some
|
||||||
|
|
||||||
|
|
||||||
def _getoption(self, f='c'):
|
def _getoption(self, f='c'):
|
||||||
self.assertTrue(self.c.read(f)) # we got some now
|
self.assertTrue(self.c.read(f)) # we got some now
|
||||||
return self.c.getOptions('section', [("int", 'option')])['option']
|
return self.c.getOptions('section', [("int", 'option')])['option']
|
||||||
|
|
||||||
|
|
||||||
def testInaccessibleFile(self):
|
def testInaccessibleFile(self):
|
||||||
f = os.path.join(self.d, "d.conf") # inaccessible file
|
f = os.path.join(self.d, "d.conf") # inaccessible file
|
||||||
self._write('d.conf', 0)
|
self._write('d.conf', 0)
|
||||||
|
@ -97,7 +95,6 @@ option = %s
|
||||||
# raise unittest.SkipTest("Skipping on %s -- access rights are not enforced" % platform)
|
# raise unittest.SkipTest("Skipping on %s -- access rights are not enforced" % platform)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def testOptionalDotDDir(self):
|
def testOptionalDotDDir(self):
|
||||||
self.assertFalse(self.c.read('c')) # nothing is there yet
|
self.assertFalse(self.c.read('c')) # nothing is there yet
|
||||||
self._write("c.conf", "1")
|
self._write("c.conf", "1")
|
||||||
|
@ -194,7 +191,6 @@ class JailReaderTest(LogCaptureTestCase):
|
||||||
self.assertTrue(self._is_logged('Error in action definition joho[foo'))
|
self.assertTrue(self._is_logged('Error in action definition joho[foo'))
|
||||||
self.assertTrue(self._is_logged('Caught exception: While reading action joho[foo we should have got 1 or 2 groups. Got: 0'))
|
self.assertTrue(self._is_logged('Caught exception: While reading action joho[foo we should have got 1 or 2 groups. Got: 0'))
|
||||||
|
|
||||||
|
|
||||||
if STOCK:
|
if STOCK:
|
||||||
def testStockSSHJail(self):
|
def testStockSSHJail(self):
|
||||||
jail = JailReader('sshd', basedir=CONFIG_DIR, share_config = self.__share_cfg) # we are running tests from root project dir atm
|
jail = JailReader('sshd', basedir=CONFIG_DIR, share_config = self.__share_cfg) # we are running tests from root project dir atm
|
||||||
|
@ -224,7 +220,6 @@ class JailReaderTest(LogCaptureTestCase):
|
||||||
|
|
||||||
#self.assertRaises(ValueError, JailReader.extractOptions ,'mail-how[')
|
#self.assertRaises(ValueError, JailReader.extractOptions ,'mail-how[')
|
||||||
|
|
||||||
|
|
||||||
# Empty option
|
# Empty option
|
||||||
option = "abc[]"
|
option = "abc[]"
|
||||||
expected = ('abc', {})
|
expected = ('abc', {})
|
||||||
|
@ -318,7 +313,6 @@ class FilterReaderTest(unittest.TestCase):
|
||||||
output[-1][-1] = "5"
|
output[-1][-1] = "5"
|
||||||
self.assertEqual(sorted(filterReader.convert()), sorted(output))
|
self.assertEqual(sorted(filterReader.convert()), sorted(output))
|
||||||
|
|
||||||
|
|
||||||
def testFilterReaderSubstitionDefault(self):
|
def testFilterReaderSubstitionDefault(self):
|
||||||
output = [['set', 'jailname', 'addfailregex', 'to=sweet@example.com fromip=<IP>']]
|
output = [['set', 'jailname', 'addfailregex', 'to=sweet@example.com fromip=<IP>']]
|
||||||
filterReader = FilterReader('substition', "jailname", {})
|
filterReader = FilterReader('substition', "jailname", {})
|
||||||
|
@ -480,7 +474,6 @@ class JailsReaderTest(LogCaptureTestCase):
|
||||||
self.assertTrue('Init' in actionReader.sections(),
|
self.assertTrue('Init' in actionReader.sections(),
|
||||||
msg="Action file %r is lacking [Init] section" % actionConfig)
|
msg="Action file %r is lacking [Init] section" % actionConfig)
|
||||||
|
|
||||||
|
|
||||||
def testReadStockJailConf(self):
|
def testReadStockJailConf(self):
|
||||||
jails = JailsReader(basedir=CONFIG_DIR, share_config=self.__share_cfg) # we are running tests from root project dir atm
|
jails = JailsReader(basedir=CONFIG_DIR, share_config=self.__share_cfg) # we are running tests from root project dir atm
|
||||||
self.assertTrue(jails.read()) # opens fine
|
self.assertTrue(jails.read()) # opens fine
|
||||||
|
@ -607,7 +600,6 @@ class JailsReaderTest(LogCaptureTestCase):
|
||||||
msg="Found no %s command among %s"
|
msg="Found no %s command among %s"
|
||||||
% (target_command, str(commands)) )
|
% (target_command, str(commands)) )
|
||||||
|
|
||||||
|
|
||||||
def testStockConfigurator(self):
|
def testStockConfigurator(self):
|
||||||
configurator = Configurator()
|
configurator = Configurator()
|
||||||
configurator.setBaseDir(CONFIG_DIR)
|
configurator.setBaseDir(CONFIG_DIR)
|
||||||
|
|
|
@ -317,7 +317,6 @@ class DatabaseTest(LogCaptureTestCase):
|
||||||
actions._Actions__checkBan()
|
actions._Actions__checkBan()
|
||||||
self.assertTrue(self._is_logged("ban ainfo %s, %s, %s, %s" % (True, True, True, True)))
|
self.assertTrue(self._is_logged("ban ainfo %s, %s, %s, %s" % (True, True, True, True)))
|
||||||
|
|
||||||
|
|
||||||
def testPurge(self):
|
def testPurge(self):
|
||||||
if Fail2BanDb is None: # pragma: no cover
|
if Fail2BanDb is None: # pragma: no cover
|
||||||
return
|
return
|
||||||
|
|
|
@ -494,7 +494,6 @@ def get_monitor_failures_testcase(Filter_):
|
||||||
self._sleep_4_poll()
|
self._sleep_4_poll()
|
||||||
#print "D: started filter %s" % self.filter
|
#print "D: started filter %s" % self.filter
|
||||||
|
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
tearDownMyTime()
|
tearDownMyTime()
|
||||||
#print "D: SLEEPING A BIT"
|
#print "D: SLEEPING A BIT"
|
||||||
|
@ -533,7 +532,6 @@ def get_monitor_failures_testcase(Filter_):
|
||||||
self.assertTrue(self.isFilled(20)) # give Filter a chance to react
|
self.assertTrue(self.isFilled(20)) # give Filter a chance to react
|
||||||
_assert_correct_last_attempt(self, self.jail, failures, count=count)
|
_assert_correct_last_attempt(self, self.jail, failures, count=count)
|
||||||
|
|
||||||
|
|
||||||
def test_grow_file(self):
|
def test_grow_file(self):
|
||||||
# suck in lines from this sample log file
|
# suck in lines from this sample log file
|
||||||
self.assertRaises(FailManagerEmpty, self.filter.failManager.toBan)
|
self.assertRaises(FailManagerEmpty, self.filter.failManager.toBan)
|
||||||
|
@ -577,7 +575,6 @@ def get_monitor_failures_testcase(Filter_):
|
||||||
skip=3, mode='w')
|
skip=3, mode='w')
|
||||||
self.assert_correct_last_attempt(GetFailures.FAILURES_01)
|
self.assert_correct_last_attempt(GetFailures.FAILURES_01)
|
||||||
|
|
||||||
|
|
||||||
def test_move_file(self):
|
def test_move_file(self):
|
||||||
# if we move file into a new location while it has been open already
|
# if we move file into a new location while it has been open already
|
||||||
self.file.close()
|
self.file.close()
|
||||||
|
@ -602,7 +599,6 @@ def get_monitor_failures_testcase(Filter_):
|
||||||
self.assert_correct_last_attempt(GetFailures.FAILURES_01)
|
self.assert_correct_last_attempt(GetFailures.FAILURES_01)
|
||||||
self.assertEqual(self.filter.failManager.getFailTotal(), 6)
|
self.assertEqual(self.filter.failManager.getFailTotal(), 6)
|
||||||
|
|
||||||
|
|
||||||
def _test_move_into_file(self, interim_kill=False):
|
def _test_move_into_file(self, interim_kill=False):
|
||||||
# if we move a new file into the location of an old (monitored) file
|
# if we move a new file into the location of an old (monitored) file
|
||||||
_copy_lines_between_files(GetFailures.FILENAME_01, self.name,
|
_copy_lines_between_files(GetFailures.FILENAME_01, self.name,
|
||||||
|
@ -628,7 +624,6 @@ def get_monitor_failures_testcase(Filter_):
|
||||||
self.assert_correct_last_attempt(GetFailures.FAILURES_01)
|
self.assert_correct_last_attempt(GetFailures.FAILURES_01)
|
||||||
self.assertEqual(self.filter.failManager.getFailTotal(), 9)
|
self.assertEqual(self.filter.failManager.getFailTotal(), 9)
|
||||||
|
|
||||||
|
|
||||||
def test_move_into_file(self):
|
def test_move_into_file(self):
|
||||||
self._test_move_into_file(interim_kill=False)
|
self._test_move_into_file(interim_kill=False)
|
||||||
|
|
||||||
|
@ -637,7 +632,6 @@ def get_monitor_failures_testcase(Filter_):
|
||||||
# to test against possible drop-out of the file from monitoring
|
# to test against possible drop-out of the file from monitoring
|
||||||
self._test_move_into_file(interim_kill=True)
|
self._test_move_into_file(interim_kill=True)
|
||||||
|
|
||||||
|
|
||||||
def test_new_bogus_file(self):
|
def test_new_bogus_file(self):
|
||||||
# to make sure that watching whole directory does not effect
|
# to make sure that watching whole directory does not effect
|
||||||
_copy_lines_between_files(GetFailures.FILENAME_01, self.name, n=100).close()
|
_copy_lines_between_files(GetFailures.FILENAME_01, self.name, n=100).close()
|
||||||
|
@ -650,7 +644,6 @@ def get_monitor_failures_testcase(Filter_):
|
||||||
self.assertEqual(self.filter.failManager.getFailTotal(), 6)
|
self.assertEqual(self.filter.failManager.getFailTotal(), 6)
|
||||||
_killfile(None, self.name + '.bak2')
|
_killfile(None, self.name + '.bak2')
|
||||||
|
|
||||||
|
|
||||||
def test_delLogPath(self):
|
def test_delLogPath(self):
|
||||||
# Smoke test for removing of the path from being watched
|
# Smoke test for removing of the path from being watched
|
||||||
|
|
||||||
|
@ -863,7 +856,6 @@ class GetFailures(unittest.TestCase):
|
||||||
self.testGetFailures01(filename=fname)
|
self.testGetFailures01(filename=fname)
|
||||||
_killfile(fout, fname)
|
_killfile(fout, fname)
|
||||||
|
|
||||||
|
|
||||||
def testGetFailures02(self):
|
def testGetFailures02(self):
|
||||||
output = ('141.3.81.106', 4, 1124013539.0,
|
output = ('141.3.81.106', 4, 1124013539.0,
|
||||||
[u'Aug 14 11:%d:59 i60p295 sshd[12365]: Failed publickey for roehl from ::ffff:141.3.81.106 port 51332 ssh2'
|
[u'Aug 14 11:%d:59 i60p295 sshd[12365]: Failed publickey for roehl from ::ffff:141.3.81.106 port 51332 ssh2'
|
||||||
|
@ -922,8 +914,6 @@ class GetFailures(unittest.TestCase):
|
||||||
filter_.getFailures(GetFailures.FILENAME_USEDNS)
|
filter_.getFailures(GetFailures.FILENAME_USEDNS)
|
||||||
_assert_correct_last_attempt(self, filter_, output)
|
_assert_correct_last_attempt(self, filter_, output)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def testGetFailuresMultiRegex(self):
|
def testGetFailuresMultiRegex(self):
|
||||||
output = ('141.3.81.106', 8, 1124013541.0)
|
output = ('141.3.81.106', 8, 1124013541.0)
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,6 @@ class TestsUtilsTest(unittest.TestCase):
|
||||||
self.assertFalse('>' in s, msg="'>' present in %r" % s) # There is only "fail2ban-testcases" in this case, no true traceback
|
self.assertFalse('>' in s, msg="'>' present in %r" % s) # There is only "fail2ban-testcases" in this case, no true traceback
|
||||||
self.assertTrue(':' in s, msg="no ':' in %r" % s)
|
self.assertTrue(':' in s, msg="no ':' in %r" % s)
|
||||||
|
|
||||||
|
|
||||||
def testFormatterWithTraceBack(self):
|
def testFormatterWithTraceBack(self):
|
||||||
strout = StringIO()
|
strout = StringIO()
|
||||||
Formatter = FormatterWithTraceBack
|
Formatter = FormatterWithTraceBack
|
||||||
|
|
|
@ -125,7 +125,6 @@ def testSampleRegexsFactory(name):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
jsonTimeLocal = datetime.datetime.strptime(t, "%Y-%m-%dT%H:%M:%S.%f")
|
jsonTimeLocal = datetime.datetime.strptime(t, "%Y-%m-%dT%H:%M:%S.%f")
|
||||||
|
|
||||||
|
|
||||||
jsonTime = time.mktime(jsonTimeLocal.timetuple())
|
jsonTime = time.mktime(jsonTimeLocal.timetuple())
|
||||||
|
|
||||||
jsonTime += jsonTimeLocal.microsecond / 1000000
|
jsonTime += jsonTimeLocal.microsecond / 1000000
|
||||||
|
|
|
@ -559,7 +559,6 @@ class Transmitter(TransmitterBase):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def testAction(self):
|
def testAction(self):
|
||||||
action = "TestCaseAction"
|
action = "TestCaseAction"
|
||||||
cmdList = [
|
cmdList = [
|
||||||
|
|
|
@ -191,7 +191,6 @@ def gatherTests(regexps=None, no_network=False):
|
||||||
except Exception, e: # pragma: no cover
|
except Exception, e: # pragma: no cover
|
||||||
logSys.warning("I: Skipping systemd backend testing. Got exception '%s'" % e)
|
logSys.warning("I: Skipping systemd backend testing. Got exception '%s'" % e)
|
||||||
|
|
||||||
|
|
||||||
# Server test for logging elements which break logging used to support
|
# Server test for logging elements which break logging used to support
|
||||||
# testcases analysis
|
# testcases analysis
|
||||||
tests.addTest(unittest.makeSuite(servertestcase.TransmitterLogging))
|
tests.addTest(unittest.makeSuite(servertestcase.TransmitterLogging))
|
||||||
|
|
Loading…
Reference in New Issue