Home | Trees | Indices | Help |
---|
|
1 # Elisa - Home multimedia server 2 # Copyright (C) 2006-2008 Fluendo Embedded S.L. (www.fluendo.com). 3 # All rights reserved. 4 # 5 # This file is available under one of two license agreements. 6 # 7 # This file is licensed under the GPL version 3. 8 # See "LICENSE.GPL" in the root of this distribution including a special 9 # exception to use Elisa with Fluendo's plugins. 10 # 11 # The GPL part of Elisa is also available under a commercial licensing 12 # agreement from Fluendo. 13 # See "LICENSE.Elisa" in the root directory of this distribution package 14 # for details on that license. 15 16 from elisa.core.tests.elisa_test_case import ElisaTestCase 17 from elisa.core import config, plugin_registry 18 from elisa.core.application import Application 19 from elisa.core.application import DEFAULT_CONFIG, CONFIG_DIR, CONFIG_FILE 20 import os 2123 test_conf = "test.conf" 24 2895 106 107 restarted.called = False 108 109 dfr = self.app.restart() 110 111 # FIXME: restore this if app.stop() one day returns a Deferred 112 restarted(True) 113 self.check_called(restarted) 114 ## dfr.addCallback(restarted) 115 ## dfr.addCallback(self.check_called, restarted) 116 ## return dfr 117 test_restart.skip = "should go in a integration test" 11830 """ Load the default config file 31 """ 32 try: 33 os.unlink('test.conf') 34 except: 35 pass 36 37 default_config = DEFAULT_CONFIG % {'version': 'test', 38 'install_date': 'none'} 39 c = config.Config('test.conf', default_config) 40 self.assertEqual(c.get_filename(), 'test.conf') 41 self.assertEqual(c.get_config_dir(), os.getcwd()) 42 c.write() 43 f = open('test.conf') 44 self.assertEqual(f.read(), default_config)4547 """ 48 """ 49 default = CONFIG_DIR 50 self.failUnless(os.path.exists(default)) 51 52 # pity this doesn't work! 53 # os.renames(default, '.elisa.bak') 54 os.system('mv %s %s' % (default, '.elisa.bak')) 55 56 57 f = os.path.join(CONFIG_DIR,CONFIG_FILE) 58 os.makedirs(CONFIG_DIR) 59 c = config.Config(f) 60 c.write() 61 62 self.failUnless(os.path.exists(default)) 63 64 #os.renames('.elisa.bak', default) 65 os.system('mv %s %s' % ('.elisa.bak/*', default)) 66 os.system('rm -fr %s' % '.elisa.bak')67 68 test_create_config_dir.skip = "Shall we really interact with the developer's filesystem ?" 69 7072 73 self.failUnless(isinstance(self.app.config, config.Config)) 74 self.failUnless(isinstance(self.app.plugin_registry, 75 plugin_registry.PluginRegistry))76 # TODO: test all other attributes: interface_controller, *_manager 77 7880 81 self.app.start() 82 83 self.assertEquals(self.app.running, True) 84 85 def stopped(r): 86 self.assertEquals(self.app.running, False) 87 stopped.called = True88 89 stopped.called = False 90 91 dfr = self.app.stop(stop_reactor=False) 92 dfr.addCallback(stopped) 93 dfr.addCallback(lambda r: self.check_called(stopped)) 94 return dfr
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0beta1 on Wed Jan 16 19:10:21 2008 | http://epydoc.sourceforge.net |