diff --git a/fail2ban/tests/filtertestcase.py b/fail2ban/tests/filtertestcase.py index 5f7fba23..b17bf363 100644 --- a/fail2ban/tests/filtertestcase.py +++ b/fail2ban/tests/filtertestcase.py @@ -36,7 +36,7 @@ except ImportError: from fail2ban.server.jail import Jail from fail2ban.server.filterpoll import FilterPoll -from fail2ban.server.filter import FileFilter, DNSUtils +from fail2ban.server.filter import Filter, FileFilter, DNSUtils from fail2ban.server.failmanager import FailManager from fail2ban.server.failmanager import FailManagerEmpty from fail2ban.server.mytime import MyTime @@ -202,6 +202,12 @@ class BasicFilter(unittest.TestCase): self.filter.setUseDns(False) self.assertEqual(self.filter.getUseDns(), 'no') + def testGetSetDatePattern(self): + self.assertEqual(self.filter.getDatePattern(), None) + self.filter.setDatePattern("^%Y-%m-%d-%H%M%S.%f %z") + self.assertEqual(self.filter.getDatePattern(), + ("^%Y-%m-%d-%H%M%S.%f %z", + "Year-Month-Day-24hourMinuteSecond.Microseconds Zone offset")) class IgnoreIP(LogCaptureTestCase): diff --git a/fail2ban/tests/utils.py b/fail2ban/tests/utils.py index 5e181d02..38db7866 100644 --- a/fail2ban/tests/utils.py +++ b/fail2ban/tests/utils.py @@ -191,11 +191,12 @@ def gatherTests(regexps=None, no_network=False): tests.addTest(unittest.makeSuite(databasetestcase.DatabaseTest)) # Filter - if not no_network: - tests.addTest(unittest.makeSuite(filtertestcase.IgnoreIP)) + tests.addTest(unittest.makeSuite(filtertestcase.IgnoreIP)) + tests.addTest(unittest.makeSuite(filtertestcase.BasicFilter)) tests.addTest(unittest.makeSuite(filtertestcase.LogFile)) tests.addTest(unittest.makeSuite(filtertestcase.LogFileMonitor)) if not no_network: + tests.addTest(unittest.makeSuite(filtertestcase.IgnoreIPDNS)) tests.addTest(unittest.makeSuite(filtertestcase.GetFailures)) tests.addTest(unittest.makeSuite(filtertestcase.DNSUtilsTests)) tests.addTest(unittest.makeSuite(filtertestcase.JailTests))