Beispiel #1
0
    def test_load_conf_default(self):
        conf_file = 'conf/nut.default.conf'
        conf_content = """
{
	"paths": {
		"scan": ["./"]
	},
	"server": {
		"hostname": "127.0.0.1",
		"port": 9005
	}
}
"""
        self.fs.create_file(conf_file, contents=conf_content)
        Config.load(conf_file)
        self.assertListEqual(Config.paths.scan, ['./'])
        self.assertEqual(Config.server.hostname, '127.0.0.1')
        self.assertEqual(Config.server.port, 9005)
Beispiel #2
0
 def test_load_non_existing_file(self):
     with self.assertRaises(OSError):
         Config.load(_get_default_config_path())
     self.assertListEqual(Config.paths.scan, ['.'])
     self.assertEqual(Config.server.hostname, '0.0.0.0')
     self.assertEqual(Config.server.port, 9000)