|
@@ -34,7 +34,8 @@ class TestSettingLoader(unittest.TestCase):
|
|
'text_to_speech': [
|
|
'text_to_speech': [
|
|
{'pico2wave': {'cache': True, 'language': 'fr-FR'}},
|
|
{'pico2wave': {'cache': True, 'language': 'fr-FR'}},
|
|
{'voxygen': {'voice': 'Agnes', 'cache': True}}
|
|
{'voxygen': {'voice': 'Agnes', 'cache': True}}
|
|
- ]
|
|
|
|
|
|
+ ],
|
|
|
|
+ 'default_synapse': 'Default-synapse'
|
|
}
|
|
}
|
|
|
|
|
|
def tearDown(self):
|
|
def tearDown(self):
|
|
@@ -46,14 +47,10 @@ class TestSettingLoader(unittest.TestCase):
|
|
|
|
|
|
self.assertTrue(s1.settings is s2.settings)
|
|
self.assertTrue(s1.settings is s2.settings)
|
|
|
|
|
|
- del s1
|
|
|
|
- del s2
|
|
|
|
-
|
|
|
|
def test_get_yaml_config(self):
|
|
def test_get_yaml_config(self):
|
|
|
|
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
self.assertEqual(sl.yaml_config, self.settings_dict)
|
|
self.assertEqual(sl.yaml_config, self.settings_dict)
|
|
- del sl
|
|
|
|
|
|
|
|
def test_get_settings(self):
|
|
def test_get_settings(self):
|
|
settings_object = Settings()
|
|
settings_object = Settings()
|
|
@@ -73,57 +70,50 @@ class TestSettingLoader(unittest.TestCase):
|
|
settings_object.rest_api = RestAPI(password_protected=True, active=True,
|
|
settings_object.rest_api = RestAPI(password_protected=True, active=True,
|
|
login="admin", password="secret", port=5000)
|
|
login="admin", password="secret", port=5000)
|
|
settings_object.cache_path = '/tmp/kalliope_tts_cache'
|
|
settings_object.cache_path = '/tmp/kalliope_tts_cache'
|
|
|
|
+ settings_object.default_synapse = 'Default-synapse'
|
|
settings_object.machine = platform.machine()
|
|
settings_object.machine = platform.machine()
|
|
|
|
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
|
|
|
|
self.assertEqual(settings_object, sl.settings)
|
|
self.assertEqual(settings_object, sl.settings)
|
|
- del sl
|
|
|
|
|
|
|
|
def test_get_default_speech_to_text(self):
|
|
def test_get_default_speech_to_text(self):
|
|
expected_default_speech_to_text = "google"
|
|
expected_default_speech_to_text = "google"
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
|
|
|
|
self.assertEqual(expected_default_speech_to_text, sl._get_default_speech_to_text(self.settings_dict))
|
|
self.assertEqual(expected_default_speech_to_text, sl._get_default_speech_to_text(self.settings_dict))
|
|
- del sl
|
|
|
|
|
|
|
|
def test_get_default_text_to_speech(self):
|
|
def test_get_default_text_to_speech(self):
|
|
expected_default_text_to_speech = "pico2wave"
|
|
expected_default_text_to_speech = "pico2wave"
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
self.assertEqual(expected_default_text_to_speech, sl._get_default_text_to_speech(self.settings_dict))
|
|
self.assertEqual(expected_default_text_to_speech, sl._get_default_text_to_speech(self.settings_dict))
|
|
- del sl
|
|
|
|
|
|
|
|
def test_get_default_trigger(self):
|
|
def test_get_default_trigger(self):
|
|
expected_default_trigger = "snowboy"
|
|
expected_default_trigger = "snowboy"
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
self.assertEqual(expected_default_trigger, sl._get_default_trigger(self.settings_dict))
|
|
self.assertEqual(expected_default_trigger, sl._get_default_trigger(self.settings_dict))
|
|
- del sl
|
|
|
|
|
|
|
|
def test_get_stts(self):
|
|
def test_get_stts(self):
|
|
stt = Stt(name="google", parameters={'language': 'fr-FR'})
|
|
stt = Stt(name="google", parameters={'language': 'fr-FR'})
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
self.assertEqual([stt], sl._get_stts(self.settings_dict))
|
|
self.assertEqual([stt], sl._get_stts(self.settings_dict))
|
|
- del sl
|
|
|
|
|
|
|
|
def test_get_ttss(self):
|
|
def test_get_ttss(self):
|
|
tts1 = Tts(name="pico2wave", parameters={'cache': True, 'language': 'fr-FR'})
|
|
tts1 = Tts(name="pico2wave", parameters={'cache': True, 'language': 'fr-FR'})
|
|
tts2 = Tts(name="voxygen", parameters={'voice': 'Agnes', 'cache': True})
|
|
tts2 = Tts(name="voxygen", parameters={'voice': 'Agnes', 'cache': True})
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
self.assertEqual([tts1, tts2], sl._get_ttss(self.settings_dict))
|
|
self.assertEqual([tts1, tts2], sl._get_ttss(self.settings_dict))
|
|
- del sl
|
|
|
|
|
|
|
|
def test_get_triggers(self):
|
|
def test_get_triggers(self):
|
|
trigger1 = Trigger(name="snowboy",
|
|
trigger1 = Trigger(name="snowboy",
|
|
parameters={'pmdl_file': 'trigger/snowboy/resources/kalliope-FR-6samples.pmdl'})
|
|
parameters={'pmdl_file': 'trigger/snowboy/resources/kalliope-FR-6samples.pmdl'})
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
self.assertEqual([trigger1], sl._get_triggers(self.settings_dict))
|
|
self.assertEqual([trigger1], sl._get_triggers(self.settings_dict))
|
|
- del sl
|
|
|
|
|
|
|
|
def test_get_random_wake_up_answers(self):
|
|
def test_get_random_wake_up_answers(self):
|
|
expected_random_wake_up_answers = ['Oui monsieur?']
|
|
expected_random_wake_up_answers = ['Oui monsieur?']
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
self.assertEqual(expected_random_wake_up_answers, sl._get_random_wake_up_answers(self.settings_dict))
|
|
self.assertEqual(expected_random_wake_up_answers, sl._get_random_wake_up_answers(self.settings_dict))
|
|
- del sl
|
|
|
|
|
|
|
|
def test_get_rest_api(self):
|
|
def test_get_rest_api(self):
|
|
expected_rest_api = RestAPI(password_protected=True, active=True,
|
|
expected_rest_api = RestAPI(password_protected=True, active=True,
|
|
@@ -131,13 +121,16 @@ class TestSettingLoader(unittest.TestCase):
|
|
|
|
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
self.assertEqual(expected_rest_api, sl._get_rest_api(self.settings_dict))
|
|
self.assertEqual(expected_rest_api, sl._get_rest_api(self.settings_dict))
|
|
- del sl
|
|
|
|
|
|
|
|
def test_get_cache_path(self):
|
|
def test_get_cache_path(self):
|
|
expected_cache_path = '/tmp/kalliope_tts_cache'
|
|
expected_cache_path = '/tmp/kalliope_tts_cache'
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
self.assertEqual(expected_cache_path, sl._get_cache_path(self.settings_dict))
|
|
self.assertEqual(expected_cache_path, sl._get_cache_path(self.settings_dict))
|
|
- del sl
|
|
|
|
|
|
+
|
|
|
|
+ def test_get_default_synapse(self):
|
|
|
|
+ expected_default_synapse = 'Default-synapse'
|
|
|
|
+ sl = SettingLoader(file_path=self.settings_file_to_test)
|
|
|
|
+ self.assertEqual(expected_default_synapse, sl._get_default_synapse(self.settings_dict))
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if __name__ == '__main__':
|
|
unittest.main()
|
|
unittest.main()
|