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