Merge branch 'master' of ssh://naparuba@shinken.git.sourceforge.net/gitroot/shinken...
[shinken.git] / test / test_timeperiod_inheritance.py
blob1b47340a92eb10ae1dbdda9eedd6d679b917679d
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 TestConfig(ShinkenTest):
31 def setUp(self):
32 self.setup_with_file('etc/nagios_timeperiod_inheritance.cfg')
35 #Change ME :)
36 def test_dummy(self):
38 # Config is not correct because of a wrong relative path
39 # in the main config file
41 print "Get the Timeperiods"
42 now = time.time()
43 tp = self.sched.timeperiods.find_by_name("24x7")
44 print "TP", tp.__dict__
46 #sunday should be inherited from templates
47 print "Check for sunday in the timeperiod"
48 got_sunday = False
49 for dr in tp.dateranges:
50 print dr.__dict__
51 if hasattr(dr, 'day') and dr.day == 'sunday':
52 got_sunday = True
53 self.assert_(got_sunday == True)
56 if __name__ == '__main__':
57 unittest.main()