mirror of https://github.com/fail2ban/fail2ban
NF: adding unittests for previous commit
parent
b54290affb
commit
441318eba9
|
@ -57,6 +57,7 @@ tests = unittest.TestSuite()
|
|||
tests.addTest(unittest.makeSuite(filtertestcase.IgnoreIP))
|
||||
tests.addTest(unittest.makeSuite(filtertestcase.LogFile))
|
||||
tests.addTest(unittest.makeSuite(filtertestcase.GetFailures))
|
||||
tests.addTest(unittest.makeSuite(filtertestcase.DNSUtilsTests))
|
||||
# Server
|
||||
#tests.addTest(unittest.makeSuite(servertestcase.StartStop))
|
||||
#tests.addTest(unittest.makeSuite(servertestcase.Transmitter))
|
||||
|
|
|
@ -26,7 +26,7 @@ __license__ = "GPL"
|
|||
|
||||
import unittest
|
||||
from server.filterpoll import FilterPoll
|
||||
from server.filter import FileFilter
|
||||
from server.filter import FileFilter, DNSUtils
|
||||
from server.failmanager import FailManager
|
||||
from server.failmanager import FailManagerEmpty
|
||||
|
||||
|
@ -195,3 +195,15 @@ class GetFailures(unittest.TestCase):
|
|||
self.__filter.getFailures(GetFailures.FILENAME_02)
|
||||
|
||||
self.assertRaises(FailManagerEmpty, self.__filter.failManager.toBan)
|
||||
|
||||
class DNSUtilsTests(unittest.TestCase):
|
||||
|
||||
def testTextToIp(self):
|
||||
bogus = [
|
||||
'doh1.2.3.4.buga.xxxxx.yyy',
|
||||
'1.2.3.4.buga.xxxxx.yyy',
|
||||
]
|
||||
"""Really bogus addresses which should have no matches"""
|
||||
for s in bogus:
|
||||
res = DNSUtils.textToIp(s)
|
||||
self.assertEqual(res, [])
|
||||
|
|
Loading…
Reference in New Issue