Fix : manage the 'null' for inheritance.
[shinken.git] / test / test_notification_warning.py
blob82f331407f011bac89ceafb4ac2fb3377976d1e9
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):
30 #setUp is in shinken_test
32 #Change ME :)
33 def test_raise_warning_on_notification_errors(self):
34 host = self.sched.hosts.find_by_name("test_host_0")
35 host.checks_in_progress = []
36 host.act_depend_of = [] # ignore the router
37 cmd = "/error/pl"
38 #Create a dummy notif
39 n = Notification('PROBLEM', 'scheduled', 'BADCOMMAND', cmd, host, None, 0)
40 n.execute()
41 self.sched.actions[n.id] = n
42 self.sched.put_results(n)
43 #Should have raised something like "Warning : the notification command 'BADCOMMAND' raised an error (exit code=2) : '[Errno 2] No such file or directory'"
44 self.assert_(self.log_match(1, 'BADCOMMAND'))
47 if __name__ == '__main__':
48 unittest.main()