Fix : fix hot module under windows test. (at leat I hope...)
[shinken.git] / test / test_module_merlin_sqlite.py
blob117562e35753ae594d897bd42e01567c0c3bf4b2
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/>.
23 # This file is used to test reading and processing of config files
26 from shinken_test import unittest, ShinkenTest
28 from shinken.brok import Brok
29 from shinken.modules.merlindb_broker import get_instance
32 class TestConfig(ShinkenTest):
33 #setUp is in shinken_test
35 #Change ME :)
36 def test_simplelog(self):
37 print self.conf.modules
38 #get our modules
39 mod = None
40 for m in self.conf.modules:
41 if m.module_name == 'ToMerlindb_Sqlite':
42 mod = m
43 self.assert_(mod is not None)
44 self.assert_(mod.database_path == '/usr/local/shinken/var/merlindb.sqlite')
45 self.assert_(mod.module_type == 'merlindb')
46 self.assert_(mod.backend == 'sqlite')
49 md = get_instance(mod)
50 print "TOTO", md.db_backend.__dict__
52 md.init()
53 b = Brok('clean_all_my_instance_id', {'instance_id' : 0})
54 md.manage_brok(b)
55 r = md.db_backend.db_cursor.execute("SELECT count(*) from timeperiod WHERE instance_id = '0'")
56 self.assert_(r.fetchall() == [(0,)])
62 if __name__ == '__main__':
63 unittest.main()