Beispiel #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)
Beispiel #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'))
Beispiel #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'))
Beispiel #4
0
 def test_load(self):
     self.assert_config(ConfigurationLoader.load())
Beispiel #5
0
 def test_validate_data(self):
     try:
         ConfigurationLoader.validate({}, [])
     except TypeError:
         self.fail()
Beispiel #6
0
 def test_init_locations_with_new_location(self):
     locations = [self.config_path]
     self.assertEquals(ConfigurationLoader.init_locations(locations),
                       locations)
Beispiel #7
0
 def test_init_locations_with_defaults(self):
     locations = [DEFAULT_CONFIG, SYSTEM_CONFIG, USER_CONFIG]
     self.assertEquals(ConfigurationLoader.init_locations(), locations)
Beispiel #8
0
 def test_init_config_with_new_config(self):
     config = {'a': 'b'}
     self.assertEquals(ConfigurationLoader.init_config(config), config)
Beispiel #9
0
 def test_init_config_with_defaults(self):
     self.assertEquals(ConfigurationLoader.init_config(), {})
Beispiel #10
0
 def test_init_locations_with_defaults(self):
     locations = [DEFAULT_CONFIG, SYSTEM_CONFIG, USER_CONFIG]
     self.assertEquals(ConfigurationLoader.init_locations(), locations)
Beispiel #11
0
 def test_load_with_override_custom(self):
     config = self.create_config('pt-br', 'espeak')
     config = ConfigurationLoader.load(config)
     self.assert_config(config)
Beispiel #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')
Beispiel #13
0
 def test_load(self):
     self.assert_config(ConfigurationLoader.load())
Beispiel #14
0
 def test_validate_data(self):
     try:
         ConfigurationLoader.validate_data({}, [])
     except TypeError:
         self.fail()
Beispiel #15
0
 def test_init_locations_with_new_location(self):
     locations = [self.config_path]
     self.assertEquals(ConfigurationLoader.init_locations(locations),
                       locations)
Beispiel #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)
Beispiel #17
0
 def test_init_config_with_defaults(self):
     self.assertEquals(ConfigurationLoader.init_config(), {})
Beispiel #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')
Beispiel #19
0
 def test_init_config_with_new_config(self):
     config = {'a': 'b'}
     self.assertEquals(ConfigurationLoader.init_config(config), config)
Beispiel #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, {})
Beispiel #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, {})