Add : orphaned test to all tests.
[shinken.git] / test / test_create_link_from_ext_cmd.py
bloba14599bd6d7bf2460e6999db44d24f8632b2dcce
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 *
29 class TestCreateLinkFromExtCmd(ShinkenTest):
30 #Uncomment this is you want to use a specific configuration
31 #for your test
32 #def setUp(self):
33 # self.setup_with_file('etc/nagios_1r_1h_1s.cfg')
36 #Change ME :)
37 def test_simple_host_link(self):
38 now = int(time.time())
39 h = self.sched.hosts.find_by_name('test_host_0')
40 self.assert_(h is not None)
41 h.act_depend_of = []
42 r = self.sched.hosts.find_by_name('test_router_0')
43 self.assert_(r is not None)
44 r.act_depend_of = []
45 e = ExternalCommandManager(self.conf, 'dispatcher')
46 cmd = "[%lu] ADD_SIMPLE_HOST_DEPENDENCY;test_host_0;test_router_0" % now
47 self.sched.run_external_command(cmd)
48 self.assert_(h.is_linked_with_host(r))
50 # Now we remove this link
51 cmd = "[%lu] DEL_HOST_DEPENDENCY;test_host_0;test_router_0" % now
52 self.sched.run_external_command(cmd)
53 self.assert_(not h.is_linked_with_host(r))
57 if __name__ == '__main__':
58 unittest.main()