Add : receiver launching scripts.
[shinken.git] / test / test_customs_on_service_hosgroups.py
blob4e60f4f7740707782be98dd1a608146c07ed2bd2
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 TestCustomsonservicehosgroups(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_customs_on_service_hosgroups.cfg')
36 # We look for 3 services : on defined as direct on 1 hosts, on other
37 # on 2 hsots, and a last one on a hostgroup
38 def test_check_for_custom_copy_on_serice_hostgroups(self):
39 # The one host service
40 svc_one_host = self.sched.services.find_srv_by_name_and_hostname("test_host_0", "test_on_1_host")
41 self.assert_(svc_one_host is not None)
42 # The 2 hosts service(s)
43 svc_two_hosts_1 = self.sched.services.find_srv_by_name_and_hostname("test_host_0", "test_on_2_hosts")
44 self.assert_(svc_two_hosts_1 is not None)
45 svc_two_hosts_2 = self.sched.services.find_srv_by_name_and_hostname("test_router_0", "test_on_2_hosts")
46 self.assert_(svc_two_hosts_2 is not None)
47 # Then the one defined on a hostgroup
48 svc_on_group = self.sched.services.find_srv_by_name_and_hostname("test_router_0", "test_on_group")
49 self.assert_(svc_on_group is not None)
51 # Each one should have customs
52 self.assert_(svc_one_host.customs['_CUSTNAME'] == 'custvalue')
53 self.assert_(svc_two_hosts_1.customs['_CUSTNAME'] == 'custvalue')
54 self.assert_(svc_two_hosts_2.customs['_CUSTNAME'] == 'custvalue')
55 self.assert_(svc_on_group.customs['_CUSTNAME'] == 'custvalue')
62 if __name__ == '__main__':
63 unittest.main()