Fix : fix hot module under windows test. (at leat I hope...)
[shinken.git] / test / test_command.py
blob7a7cee34605bc794e4bf5331bccf89fd18c324a1
1 #!/usr/bin/env python2.6
2 #Copyright (C) 2009-2010 :
3 # Gabes Jean, naparuba@gmail.com
4 # Gerhard Lausser, Gerhard.Lausser@consol.de
6 #This file is part of Shinken.
8 #Shinken is free software: you can redistribute it and/or modify
9 #it under the terms of the GNU Affero General Public License as published by
10 #the Free Software Foundation, either version 3 of the License, or
11 #(at your option) any later version.
13 #Shinken is distributed in the hope that it will be useful,
14 #but WITHOUT ANY WARRANTY; without even the implied warranty of
15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 #GNU Affero General Public License for more details.
18 #You should have received a copy of the GNU Affero General Public License
19 #along with Shinken. If not, see <http://www.gnu.org/licenses/>.
22 # This file is used to test reading and processing of config files
25 #It's ugly I know....
26 from shinken_test import *
27 from shinken.objects.command import CommandCall, Command, Commands
29 class TestConfig(ShinkenTest):
30 #setUp is in shinken_test
32 #Change ME :)
33 def test_command(self):
34 t = {'command_name' : 'check_command_test',
35 'command_line' : '/tmp/dummy_command.sh $ARG1$ $ARG2$',
36 'poller_tag' : 'DMZ'
38 c = Command(t)
39 self.assert_(c.command_name == 'check_command_test')
40 b = c.get_initial_status_brok()
41 self.assert_(b.type == 'initial_command_status')
43 #now create a commands packs
44 cs = Commands([c])
45 dummy_call = "check_command_test!titi!toto"
46 cc = CommandCall(cs, dummy_call)
47 self.assert_(cc.is_valid() == True)
48 self.assert_(cc.command == c)
49 self.assert_(cc.poller_tag == 'DMZ')
53 if __name__ == '__main__':
54 unittest.main()