Ejemplo n.º 1
0
    def test_init_locations(self):
        locations = [DEFAULT_CONFIG, SYSTEM_CONFIG, USER_CONFIG]
        self.assertEquals(ConfigurationLoader.init_locations(), locations)

        locations = [self.config_path]
        self.assertEquals(ConfigurationLoader.init_locations(locations),
                          locations)
Ejemplo n.º 2
0
    def test_load_with_extra_custom(self):
        my_config = {'key': 'value'}
        config = ConfigurationLoader.load(my_config)
        self.assert_config(config)

        value = config.get('key', None)
        self.assertIsNotNone(value)
        self.assertEquals(value, my_config.get('key'))
Ejemplo n.º 3
0
    def test_load_with_extra_custom(self):
        my_config = {'key': 'value'}
        config = ConfigurationLoader.load(my_config)
        self.assert_config(config)

        value = config.get('key', None)
        self.assertIsNotNone(value)
        self.assertEquals(value, my_config.get('key'))
Ejemplo n.º 4
0
 def test_load(self):
     self.assert_config(ConfigurationLoader.load())
Ejemplo n.º 5
0
 def test_validate_data(self):
     try:
         ConfigurationLoader.validate({}, [])
     except TypeError:
         self.fail()
Ejemplo n.º 6
0
 def test_init_locations_with_new_location(self):
     locations = [self.config_path]
     self.assertEquals(ConfigurationLoader.init_locations(locations),
                       locations)
Ejemplo n.º 7
0
 def test_init_locations_with_defaults(self):
     locations = [DEFAULT_CONFIG, SYSTEM_CONFIG, USER_CONFIG]
     self.assertEquals(ConfigurationLoader.init_locations(), locations)
Ejemplo n.º 8
0
 def test_init_config_with_new_config(self):
     config = {'a': 'b'}
     self.assertEquals(ConfigurationLoader.init_config(config), config)
Ejemplo n.º 9
0
 def test_init_config_with_defaults(self):
     self.assertEquals(ConfigurationLoader.init_config(), {})
Ejemplo n.º 10
0
 def test_init_locations_with_defaults(self):
     locations = [DEFAULT_CONFIG, SYSTEM_CONFIG, USER_CONFIG]
     self.assertEquals(ConfigurationLoader.init_locations(), locations)
Ejemplo n.º 11
0
 def test_load_with_override_custom(self):
     config = self.create_config('pt-br', 'espeak')
     config = ConfigurationLoader.load(config)
     self.assert_config(config)
Ejemplo n.º 12
0
 def test_load_with_override_default(self):
     config = self.create_config()
     config = ConfigurationLoader.load(config, [self.config_path])
     self.assert_config(config, 'pt-br', 'espeak')
Ejemplo n.º 13
0
 def test_load(self):
     self.assert_config(ConfigurationLoader.load())
Ejemplo n.º 14
0
 def test_validate_data(self):
     try:
         ConfigurationLoader.validate_data({}, [])
     except TypeError:
         self.fail()
Ejemplo n.º 15
0
 def test_init_locations_with_new_location(self):
     locations = [self.config_path]
     self.assertEquals(ConfigurationLoader.init_locations(locations),
                       locations)
Ejemplo n.º 16
0
 def test_load_with_override_custom(self):
     config = self.create_config('pt-br', 'espeak', 'f1')
     config = ConfigurationLoader.load(config)
     self.assert_config(config)
Ejemplo n.º 17
0
 def test_init_config_with_defaults(self):
     self.assertEquals(ConfigurationLoader.init_config(), {})
Ejemplo n.º 18
0
 def test_load_with_override_default(self):
     config = self.create_config()
     config = ConfigurationLoader.load(config, [self.config_path])
     self.assert_config(config, 'pt-br', 'espeak', 'f1')
Ejemplo n.º 19
0
 def test_init_config_with_new_config(self):
     config = {'a': 'b'}
     self.assertEquals(ConfigurationLoader.init_config(config), config)
Ejemplo n.º 20
0
 def test_load_with_invalid_locations_path(self):
     locations = ['./invalid/mycroft.conf', './invalid_mycroft.conf']
     config = ConfigurationLoader.load(None, locations, False)
     self.assertEquals(config, {})
Ejemplo n.º 21
0
 def test_load_with_invalid_locations_path(self):
     locations = ['./invalid/mycroft.ini', './invalid_mycroft.ini']
     config = ConfigurationLoader.load(None, locations, False)
     self.assertEquals(config, {})