actiontestcase.py
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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