actiontestcase.py

Go to the documentation of this file.
00001 # This file is part of Fail2Ban.
00002 #
00003 # Fail2Ban is free software; you can redistribute it and/or modify
00004 # it under the terms of the GNU General Public License as published by
00005 # the Free Software Foundation; either version 2 of the License, or
00006 # (at your option) any later version.
00007 #
00008 # Fail2Ban is distributed in the hope that it will be useful,
00009 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 # GNU General Public License for more details.
00012 #
00013 # You should have received a copy of the GNU General Public License
00014 # along with Fail2Ban; if not, write to the Free Software
00015 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00016 
00017 # Author: Cyril Jaquier
00018 # 
00019 # $Revision: 686 $
00020 
00021 __author__ = "Cyril Jaquier"
00022 __version__ = "$Revision: 686 $"
00023 __date__ = "$Date: 2008-04-13 19:48:52 +0200 (Sun, 13 Apr 2008) $"
00024 __copyright__ = "Copyright (c) 2004 Cyril Jaquier"
00025 __license__ = "GPL"
00026 
00027 import unittest, time
00028 from server.action import Action
00029 
00030 class ExecuteAction(unittest.TestCase):
00031 
00032     def setUp(self):
00033         """Call before every test case."""
00034         self.__action = Action("Test")
00035 
00036     def tearDown(self):
00037         """Call after every test case."""
00038         self.__action.execActionStop()
00039     
00040     def testExecuteActionBan(self):
00041         self.__action.setActionStart("touch /tmp/fail2ban.test")
00042         self.__action.setActionStop("rm -f /tmp/fail2ban.test")
00043         self.__action.setActionBan("echo -n")
00044         self.__action.setActionCheck("[ -e /tmp/fail2ban.test ]")
00045         
00046         self.assertTrue(self.__action.execActionBan(None))
00047         
Generated on Sun May 19 03:01:59 2013 for Fail2Ban by  doxygen 1.6.3