2007-01-21 22:19:57 +00:00
|
|
|
#!/usr/bin/python
|
2006-06-26 20:05:00 +00:00
|
|
|
# This file is part of Fail2Ban.
|
|
|
|
#
|
|
|
|
# Fail2Ban is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# Fail2Ban is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Fail2Ban; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
|
|
|
# Author: Cyril Jaquier
|
|
|
|
#
|
2007-10-16 21:01:21 +00:00
|
|
|
# $Revision: 522 $
|
2006-06-26 20:05:00 +00:00
|
|
|
|
|
|
|
__author__ = "Cyril Jaquier"
|
2007-10-16 21:01:21 +00:00
|
|
|
__version__ = "$Revision: 522 $"
|
|
|
|
__date__ = "$Date: 2007-01-21 23:19:57 +0100 (Sun, 21 Jan 2007) $"
|
2006-06-26 20:05:00 +00:00
|
|
|
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
|
|
|
__license__ = "GPL"
|
|
|
|
|
|
|
|
|
|
|
|
import unittest, logging, sys
|
|
|
|
|
2006-11-16 21:07:42 +00:00
|
|
|
from common.version import version
|
2006-08-06 21:56:01 +00:00
|
|
|
from testcases import banmanagertestcase
|
|
|
|
from testcases import clientreadertestcase
|
|
|
|
from testcases import failmanagertestcase
|
2006-06-26 20:05:00 +00:00
|
|
|
from testcases import filtertestcase
|
|
|
|
from testcases import servertestcase
|
2006-09-05 21:16:28 +00:00
|
|
|
from testcases import datedetectortestcase
|
2006-10-23 20:13:21 +00:00
|
|
|
from testcases import actiontestcase
|
2006-10-18 22:35:32 +00:00
|
|
|
from server.mytime import MyTime
|
|
|
|
|
|
|
|
# Set the time to a fixed, known value
|
|
|
|
# Sun Aug 14 12:00:00 CEST 2005
|
|
|
|
MyTime.setTime(1124013600)
|
2006-06-26 20:05:00 +00:00
|
|
|
|
|
|
|
# Gets the instance of the logger.
|
|
|
|
logSys = logging.getLogger("fail2ban")
|
|
|
|
# Add the default logging handler
|
|
|
|
stdout = logging.StreamHandler(sys.stdout)
|
|
|
|
logSys.addHandler(stdout)
|
|
|
|
logSys.setLevel(logging.FATAL)
|
|
|
|
|
2006-07-08 16:51:14 +00:00
|
|
|
print "Fail2ban " + version + " test suite. Please wait..."
|
2006-06-26 20:05:00 +00:00
|
|
|
|
|
|
|
tests = unittest.TestSuite()
|
|
|
|
|
|
|
|
# Filter
|
|
|
|
tests.addTest(unittest.makeSuite(filtertestcase.IgnoreIP))
|
|
|
|
tests.addTest(unittest.makeSuite(filtertestcase.LogFile))
|
2006-10-18 22:35:32 +00:00
|
|
|
tests.addTest(unittest.makeSuite(filtertestcase.GetFailures))
|
2009-02-04 20:38:37 +00:00
|
|
|
tests.addTest(unittest.makeSuite(filtertestcase.DNSUtilsTests))
|
2006-06-26 20:05:00 +00:00
|
|
|
# Server
|
|
|
|
#tests.addTest(unittest.makeSuite(servertestcase.StartStop))
|
|
|
|
#tests.addTest(unittest.makeSuite(servertestcase.Transmitter))
|
2006-10-23 20:13:21 +00:00
|
|
|
tests.addTest(unittest.makeSuite(actiontestcase.ExecuteAction))
|
2006-06-26 20:05:00 +00:00
|
|
|
# FailManager
|
|
|
|
tests.addTest(unittest.makeSuite(failmanagertestcase.AddFailure))
|
|
|
|
# BanManager
|
|
|
|
tests.addTest(unittest.makeSuite(banmanagertestcase.AddFailure))
|
2006-08-06 21:56:01 +00:00
|
|
|
# ClientReader
|
|
|
|
tests.addTest(unittest.makeSuite(clientreadertestcase.JailReaderTest))
|
2006-09-05 21:16:28 +00:00
|
|
|
# DateDetector
|
|
|
|
tests.addTest(unittest.makeSuite(datedetectortestcase.DateDetectorTest))
|
2006-06-26 20:05:00 +00:00
|
|
|
|
|
|
|
# Tests runner
|
|
|
|
testRunner = unittest.TextTestRunner()
|
|
|
|
testRunner.run(tests)
|