def test_get_rest_api(self):
        expected_rest_api = RestAPI(password_protected=True, active=True,
                                    login="******", password="******", port=5000,
                                    allowed_cors_origin=False)

        sl = SettingLoader(file_path=self.settings_file_to_test)
        self.assertEqual(expected_rest_api, sl._get_rest_api(self.settings_dict))
 def test_get_players(self):
     player1 = Player(name="mplayer",
                      parameters={})
     player2 = Player(name="pyalsaaudio",
                      parameters={'device': 'default'})
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual([player1, player2], sl._get_players(self.settings_dict))
Esempio n. 3
0
 def test_get_players(self):
     player1 = Player(name="mplayer",
                      parameters={})
     player2 = Player(name="pyalsaaudio",
                      parameters={'device': 'default'})
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual([player1, player2], sl._get_players(self.settings_dict))
Esempio n. 4
0
    def test_get_rest_api(self):
        expected_rest_api = RestAPI(password_protected=True, active=True,
                                    login="******", password="******", port=5000,
                                    allowed_cors_origin=False)

        sl = SettingLoader(file_path=self.settings_file_to_test)
        self.assertEqual(expected_rest_api, sl._get_rest_api(self.settings_dict))
    def test_singleton(self):
        s1 = SettingLoader.Instance(file_path=self.settings_file_to_test)
        s2 = SettingLoader.Instance(file_path=self.settings_file_to_test)

        self.assertTrue(s1.settings is s2.settings)

        del s1
        del s2
    def test_get_resources(self):

        resources = Resources(neuron_folder="/tmp/kalliope/tests/kalliope_resources_dir/neurons",
                              stt_folder="/tmp/kalliope/tests/kalliope_resources_dir/stt",
                              tts_folder="/tmp/kalliope/tests/kalliope_resources_dir/tts",
                              trigger_folder="/tmp/kalliope/tests/kalliope_resources_dir/trigger")
        expected_resource = resources
        sl = SettingLoader(file_path=self.settings_file_to_test)
        self.assertEqual(expected_resource, sl._get_resources(self.settings_dict))
 def test_get_variables(self):
     expected_result = {
         "author": "Lamonf",
         "test_number": 60,
         "test": "kalliope"
     }
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual(expected_result,
                      sl._get_variables(self.settings_dict))
Esempio n. 8
0
    def test_get_resources(self):

        resources = Resources(neuron_folder="/tmp/kalliope/tests/kalliope_resources_dir/neurons",
                              stt_folder="/tmp/kalliope/tests/kalliope_resources_dir/stt",
                              tts_folder="/tmp/kalliope/tests/kalliope_resources_dir/tts",
                              trigger_folder="/tmp/kalliope/tests/kalliope_resources_dir/trigger")
        expected_resource = resources
        sl = SettingLoader(file_path=self.settings_file_to_test)
        self.assertEqual(expected_resource, sl._get_resources(self.settings_dict))
Esempio n. 9
0
 def test_get_triggers(self):
     trigger1 = Trigger(
         name="snowboy",
         parameters={
             'pmdl_file':
             'trigger/snowboy/resources/kalliope-FR-6samples.pmdl'
         })
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual([trigger1], sl._get_triggers(self.settings_dict))
Esempio n. 10
0
 def test_get_variables(self):
     expected_result = {
         "author": "Lamonf",
         "test_number": 60,
         "test": "kalliope"
     }
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual(expected_result,
                      sl._get_variables(self.settings_dict))
Esempio n. 11
0
 def set_stts(new_stt):
     """
     Add or update the speak to text list defined in the settings.
     :param new_stt: The new stt instance.
     """
     settings = SettingLoader().settings
     list_no_duplicate_stt = [stt for stt in settings.stts if stt.name != new_stt.name]
     list_no_duplicate_stt.append(new_stt)
     settings.stts = list_no_duplicate_stt
Esempio n. 12
0
 def set_default_player(cls, default_player_name):
     """
     Set dynamically a new default_player in the settings
     :param default_player_name: string value
     """
     settings = SettingLoader().settings
     if cls._check_name_in_list_settings_entry(default_player_name, settings.players):
         settings.default_player_name = default_player_name
     else:
         logger.debug("[Settings] default_player %s is not defined in settings file ", default_player_name)
Esempio n. 13
0
 def set_trigger(new_trigger):
     """
     Update the list of triggers with a new trigger instance.
     If the trigger name already exists then it will be updated otherwise it will be added.
     :param new_trigger: the new trigger instance
     """
     settings = SettingLoader().settings
     list_no_duplicate_triggers = [trigger for trigger in settings.triggers if trigger.name != new_trigger.name]
     list_no_duplicate_triggers.append(new_trigger)
     settings.triggers = list_no_duplicate_triggers
Esempio n. 14
0
 def set_ttss(new_tts):
     """
     Add a new TTS object in the list of tts in the settings.
     If TTS already exists in settings, it will be updated with the new tts provided values.
     :param new_tts: the new TTS object to add in the settings.
     """
     settings = SettingLoader().settings
     list_no_duplicate_tts = [tts for tts in settings.ttss if tts.name != new_tts.name]
     list_no_duplicate_tts.append(new_tts)
     settings.ttss = list_no_duplicate_tts
Esempio n. 15
0
 def set_players(new_player):
     """
     Add a new Player object in the list of players in the settings.
     If PLayer already exists in settings, it will be updated with the new player provided values.
     :param new_player: the new PLayer object to add in the settings.
     """
     settings = SettingLoader().settings
     list_no_duplicate_player = [player for player in settings.players if player.name != new_player.name]
     list_no_duplicate_player.append(new_player)
     settings.players = list_no_duplicate_player
Esempio n. 16
0
 def test_get_options(self):
     expected_result = Options(
         recognizer_multiplier=1.0,
         recognizer_energy_ratio=1.5,
         recognizer_recording_timeout=15.0,
         recognizer_recording_timeout_with_silence=3.0,
         deaf=True,
         mute=False)
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual(expected_result, sl._get_options(self.settings_dict))
Esempio n. 17
0
 def set_default_tts(cls, default_tts_name):
     """
     Set dynamically a new default_tts_name in the settings
     :param default_tts_name: string value
     """
     settings = SettingLoader().settings
     # Verify that the default name exists in the settings list
     if cls._check_name_in_list_settings_entry(default_tts_name, settings.ttss):
         settings.default_tts_name = default_tts_name
     else:
         logger.debug("[SettingsEditor] default_tts %s is not defined in settings file ", default_tts_name)
 def set_stts(new_stt):
     """
     Add or update the speak to text list defined in the settings.
     :param new_stt: The new stt instance.
     """
     settings = SettingLoader().settings
     list_no_duplicate_stt = [
         stt for stt in settings.stts if stt.name != new_stt.name
     ]
     list_no_duplicate_stt.append(new_stt)
     settings.stts = list_no_duplicate_stt
 def set_ttss(new_tts):
     """
     Add a new TTS object in the list of tts in the settings.
     If TTS already exists in settings, it will be updated with the new tts provided values.
     :param new_tts: the new TTS object to add in the settings.
     """
     settings = SettingLoader().settings
     list_no_duplicate_tts = [
         tts for tts in settings.ttss if tts.name != new_tts.name
     ]
     list_no_duplicate_tts.append(new_tts)
     settings.ttss = list_no_duplicate_tts
 def set_default_trigger(cls, default_trigger):
     """
     Set dynamically a new default_trigger in the settingss
     :param default_trigger: string value
     """
     settings = SettingLoader().settings
     if cls._check_name_in_list_settings_entry(default_trigger,
                                               settings.triggers):
         settings.default_trigger_name = default_trigger
     else:
         logger.debug(
             "[Settings] default_trigger %s is not defined in settings file ",
             default_trigger)
 def set_trigger(new_trigger):
     """
     Update the list of triggers with a new trigger instance.
     If the trigger name already exists then it will be updated otherwise it will be added.
     :param new_trigger: the new trigger instance
     """
     settings = SettingLoader().settings
     list_no_duplicate_triggers = [
         trigger for trigger in settings.triggers
         if trigger.name != new_trigger.name
     ]
     list_no_duplicate_triggers.append(new_trigger)
     settings.triggers = list_no_duplicate_triggers
Esempio n. 22
0
 def test_get_ttss(self):
     tts1 = Tts(name="pico2wave",
                parameters={
                    'cache': True,
                    'language': 'fr-FR'
                })
     tts2 = Tts(name="voxygen",
                parameters={
                    'voice': 'Agnes',
                    'cache': True
                })
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual([tts1, tts2], sl._get_ttss(self.settings_dict))
 def set_default_stt(cls, default_stt_name):
     """
     Set dynamically a new default_stt_name in the settings if in the list of stts.
     :param default_stt_name: string value
     """
     settings = SettingLoader().settings
     if cls._check_name_in_list_settings_entry(default_stt_name,
                                               settings.stts):
         settings.default_stt_name = default_stt_name
     else:
         logger.debug(
             "[Settings] default_stt %s is not defined in settings file ",
             default_stt_name)
 def set_players(new_player):
     """
     Add a new Player object in the list of players in the settings.
     If PLayer already exists in settings, it will be updated with the new player provided values.
     :param new_player: the new PLayer object to add in the settings.
     """
     settings = SettingLoader().settings
     list_no_duplicate_player = [
         player for player in settings.players
         if player.name != new_player.name
     ]
     list_no_duplicate_player.append(new_player)
     settings.players = list_no_duplicate_player
 def set_default_tts(cls, default_tts_name):
     """
     Set dynamically a new default_tts_name in the settings
     :param default_tts_name: string value
     """
     settings = SettingLoader().settings
     # Verify that the default name exists in the settings list
     if cls._check_name_in_list_settings_entry(default_tts_name,
                                               settings.ttss):
         settings.default_tts_name = default_tts_name
     else:
         logger.debug(
             "[SettingsEditor] default_tts %s is not defined in settings file ",
             default_tts_name)
Esempio n. 26
0
    def test_get_hooks(self):

        # test with only one hook set
        settings = dict()
        settings["hooks"] = {
            "on_start": "test_synapse"
        }

        expected_dict = {
            "on_start": "test_synapse",
            "on_waiting_for_trigger": None,
            "on_triggered": None,
            "on_start_listening": None,
            "on_stop_listening": None,
            "on_order_found": None,
            "on_order_not_found": None,
            "on_deaf": None,
            "on_undeaf": None,
            "on_mute": None,
            "on_unmute": None,
            "on_start_speaking": None,
            "on_stop_speaking": None
        }

        returned_dict = SettingLoader._get_hooks(settings)

        self.assertEqual(returned_dict, expected_dict)

        # test with no hook set
        settings = dict()

        expected_dict = {
            "on_start": None,
            "on_waiting_for_trigger": None,
            "on_triggered": None,
            "on_start_listening": None,
            "on_stop_listening": None,
            "on_order_found": None,
            "on_order_not_found": None,
            "on_deaf": None,
            "on_undeaf": None,
            "on_mute": None,
            "on_unmute": None,
            "on_start_speaking": None,
            "on_stop_speaking": None
        }

        returned_dict = SettingLoader._get_hooks(settings)

        self.assertEqual(returned_dict, expected_dict)
Esempio n. 27
0
    def test_get_hooks(self):

        # test with only one hook set
        settings = dict()
        settings["hooks"] = {"on_start": "test_synapse"}

        expected_dict = {
            "on_start": "test_synapse",
            "on_waiting_for_trigger": None,
            "on_triggered": None,
            "on_start_listening": None,
            "on_stop_listening": None,
            "on_order_found": None,
            "on_order_not_found": None,
            "on_deaf": None,
            "on_undeaf": None,
            "on_mute": None,
            "on_unmute": None,
            "on_start_speaking": None,
            "on_stop_speaking": None
        }

        returned_dict = SettingLoader._get_hooks(settings)

        self.assertEqual(returned_dict, expected_dict)

        # test with no hook set
        settings = dict()

        expected_dict = {
            "on_start": None,
            "on_waiting_for_trigger": None,
            "on_triggered": None,
            "on_start_listening": None,
            "on_stop_listening": None,
            "on_order_found": None,
            "on_order_not_found": None,
            "on_deaf": None,
            "on_undeaf": None,
            "on_mute": None,
            "on_unmute": None,
            "on_start_speaking": None,
            "on_stop_speaking": None
        }

        returned_dict = SettingLoader._get_hooks(settings)

        self.assertEqual(returned_dict, expected_dict)
Esempio n. 28
0
    def create_app(self):
        """
        executed once at the beginning of the test
        """
        # be sure that the singleton haven't been loaded before
        Singleton._instances = {}
        current_path = os.getcwd()
        full_path_brain_to_test = current_path + os.sep + "Tests/brains/brain_test.yml"
        print full_path_brain_to_test

        # rest api config
        sl = SettingLoader()
        sl.settings.rest_api.password_protected = False
        sl.settings.active = True
        sl.settings.port = 5000
        sl.settings.allowed_cors_origin = "*"

        # prepare a test brain
        brain_to_test = full_path_brain_to_test
        brain_loader = BrainLoader(file_path=brain_to_test)
        brain = brain_loader.brain

        self.app = Flask(__name__)
        self.flask_api = FlaskAPI(self.app, port=5000, brain=brain)
        self.flask_api.app.config['TESTING'] = True
        return self.flask_api.app
Esempio n. 29
0
    def __init__(self, **kwargs):

        # set parameter from what we receive from the settings
        self.cache = kwargs.get('cache', False)
        self.language = kwargs.get('language', None)
        self.voice = kwargs.get('voice', "default")
        # the name of the TSS is the name of the Tss module that have instantiated TTSModule
        self.tts_caller_name = self.__class__.__name__

        # we don't know yet the words that will be converted to an audio and so we don't have the audio path yet too
        self.words = None
        self.file_path = None
        self.base_cache_path = None

        # load settings
        sl = SettingLoader()
        self.settings = sl.settings

        # create the path in the tmp folder
        base_path = os.path.join(self.settings.cache_path,
                                 self.tts_caller_name, self.language,
                                 self.voice)
        FileManager.create_directory(base_path)

        logger.debug(
            "Class TTSModule called from module %s, cache: %s, language: %s, voice: %s"
            % (self.tts_caller_name, self.cache, self.language, self.voice))
Esempio n. 30
0
    def create_app(self):
        """
        executed once at the beginning of the test
        """
        # be sure that the singleton haven't been loaded before
        Singleton._instances = {}
        current_path = os.getcwd()
        if "/Tests" in os.getcwd():
            full_path_brain_to_test = current_path + os.sep + "brains/brain_test_api.yml"
            self.audio_file = "files/bonjour.wav"
        else:
            full_path_brain_to_test = current_path + os.sep + "Tests/brains/brain_test_api.yml"
            self.audio_file = "Tests/files/bonjour.wav"

        # rest api config
        sl = SettingLoader()
        sl.settings.rest_api.password_protected = False
        sl.settings.active = True
        sl.settings.port = 5000
        sl.settings.allowed_cors_origin = "*"
        sl.settings.default_synapse = None

        # prepare a test brain
        brain_to_test = full_path_brain_to_test
        brain_loader = BrainLoader(file_path=brain_to_test)
        brain = brain_loader.brain

        self.app = Flask(__name__)
        self.app.config['TESTING'] = True
        self.flask_api = FlaskAPI(self.app, port=5000, brain=brain)
        self.client = self.app.test_client()
        return self.flask_api.app
Esempio n. 31
0
    def __init__(self, **kwargs):
        """
        Class used by neuron for talking
        :param kwargs: Same parameter as the Child. Can contain info about the tts to use instead of the
        default one
        """
        # get the child who called the class
        child_name = self.__class__.__name__
        self.neuron_name = child_name

        sl = SettingLoader()
        self.settings = sl.settings
        brain_loader = BrainLoader()
        self.brain = brain_loader.brain

        # check if the user has overrider the TTS
        tts = kwargs.get('tts', None)
        if tts is None:
            # No tts provided,  we load the default one
            self.tts = self.settings.default_tts_name
        else:
            self.tts = tts

        # get if the cache settings is present
        self.override_cache = kwargs.get('cache', None)

        # get templates if provided
        # Check if there is a template associate to the output message
        self.say_template = kwargs.get('say_template', None)
        # check if there is a template file associate to the output message
        self.file_template = kwargs.get('file_template', None)
Esempio n. 32
0
    def test_get_dynamic_class_instantiation(self):
        """
        Test that an instance as been instantiate properly.
        """
        sl = SettingLoader()
        sl.settings.resource_dir = '/var/tmp/test/resources'

        neuron = Neuron(
            name='Say',
            parameters={'message': 'test dynamic class instantiate'})
        say1 = Utils.get_dynamic_class_instantiation(
            package_name="neurons",
            module_name=neuron.name.capitalize(),
            parameters=neuron.parameters,
            resources_dir='/var/tmp/test/resources')
        self.assertTrue(isinstance(say1, Say),
                        "Failed to dynamically instantiate neuron 'Say'")
        say2 = Utils.get_dynamic_class_instantiation(
            package_name="neurons",
            module_name=neuron.name.capitalize(),
            parameters=neuron.parameters,
            resources_dir='/var/tmp/test/resources')
        self.assertTrue(isinstance(say2, Say),
                        "Failed to dynamically instantiate neuron 'Say'")
        self.assertNotEqual(
            id(say1), id(say2),
            "Dynamic class instantiations must return unique instances")
Esempio n. 33
0
def check_auth(username, password):
    """This function is called to check if a username /
    password combination is valid.
    """
    sl = SettingLoader.Instance()
    settings = sl.settings
    return username == settings.rest_api.login and password == settings.rest_api.password
    def test_get_default_speech_to_text(self):
        expected_default_speech_to_text = "google"
        sl = SettingLoader.Instance(file_path=self.settings_file_to_test)

        self.assertEqual(expected_default_speech_to_text,
                         sl._get_default_speech_to_text(self.settings_dict))
        del sl
 def set_variables(variables):
     """
     Update the settings variables dictionary.
     :param variables: The dict of variables with the new values.
     """
     settings = SettingLoader().settings
     settings.variables.update(variables)
Esempio n. 36
0
    def __init__(self, **kwargs):
        """
        Class used by neuron for talking
        :param kwargs: Same parameter as the Child. Can contain info about the tts to use instead of the
        default one
        """
        # get the child who called the class
        child_name = self.__class__.__name__
        self.neuron_name = child_name

        sl = SettingLoader()
        self.settings = sl.settings
        brain_loader = BrainLoader()
        self.brain = brain_loader.brain

        self.tts = self._get_tts_object(settings=self.settings)

        # get templates if provided
        # Check if there is a template associate to the output message
        self.say_template = kwargs.get('say_template', None)
        # check if there is a template file associate to the output message
        self.file_template = kwargs.get('file_template', None)
        # keep the generated message
        self.tts_message = None
        # if the current call is api one
        self.is_api_call = kwargs.get('is_api_call', False)
        # boolean to know id the synapse is waiting for an answer
        self.is_waiting_for_answer = False
        # the synapse name to add the the buffer
        self.pending_synapse = None
        # a dict of parameters the user ask to save in short term memory
        self.kalliope_memory = kwargs.get('kalliope_memory', None)
        # parameters loaded from the order can be save now
        Cortex.save_parameter_from_order_in_memory(self.kalliope_memory)
Esempio n. 37
0
    def test_get_settings(self):
        settings_object = Settings()
        settings_object.default_tts_name = "pico2wave"
        settings_object.default_stt_name = "google"
        settings_object.default_trigger_name = "snowboy"
        tts1 = Tts(name="pico2wave",
                   parameters={
                       'cache': True,
                       'language': 'fr-FR'
                   })
        tts2 = Tts(name="voxygen",
                   parameters={
                       'voice': 'Agnes',
                       'cache': True
                   })
        settings_object.ttss = [tts1, tts2]
        stt = Stt(name="google", parameters={'language': 'fr-FR'})
        settings_object.stts = [stt]
        settings_object.random_wake_up_answers = ['Oui monsieur?']
        settings_object.random_wake_up_sounds = [
            'sounds/ding.wav', 'sounds/dong.wav'
        ]
        settings_object.play_on_ready_notification = "never"
        settings_object.on_ready_answers = ['Kalliope is ready']
        settings_object.on_ready_sounds = [
            'sounds/ding.wav', 'sounds/dong.wav'
        ]
        trigger1 = Trigger(
            name="snowboy",
            parameters={
                'pmdl_file':
                'trigger/snowboy/resources/kalliope-FR-6samples.pmdl'
            })
        settings_object.triggers = [trigger1]
        settings_object.rest_api = RestAPI(password_protected=True,
                                           active=True,
                                           login="******",
                                           password="******",
                                           port=5000,
                                           allowed_cors_origin=False)
        settings_object.cache_path = '/tmp/kalliope_tts_cache'
        settings_object.default_synapse = 'Default-synapse'
        resources = Resources(
            neuron_folder="/tmp/kalliope/tests/kalliope_resources_dir/neurons",
            stt_folder="/tmp/kalliope/tests/kalliope_resources_dir/stt",
            tts_folder="/tmp/kalliope/tests/kalliope_resources_dir/tts",
            trigger_folder="/tmp/kalliope/tests/kalliope_resources_dir/trigger"
        )
        settings_object.resources = resources
        settings_object.variables = {
            "author": "Lamonf",
            "test_number": 60,
            "test": "kalliope"
        }
        settings_object.machine = platform.machine()

        sl = SettingLoader(file_path=self.settings_file_to_test)

        self.assertEqual(settings_object, sl.settings)
Esempio n. 38
0
 def decorated(*args, **kwargs):
     sl = SettingLoader.Instance()
     settings = sl.settings
     if settings.rest_api.password_protected:
         auth = request.authorization
         if not auth or not check_auth(auth.username, auth.password):
             return authenticate()
     return f(*args, **kwargs)
 def set_hooks(hooks):
     """
     Update the hooks dictionary defined in the settings with the new dictionary in param.
     :param hooks: the dictionary containing hooks to update.
     :type hooks : dict
     """
     settings = SettingLoader().settings
     settings.hooks.update(hooks)
 def set_recognizer_recording_timeout(recognizer_recording_timeout):
     """
     Set the new value of the recognizer_recording_timeoutt to the settings.
     Must be an float.
     :param recognizer_recording_timeout: new value for the recognizer_recording_timeout to push into the settings
     """
     if isinstance(recognizer_recording_timeout, float):
         settings = SettingLoader().settings
         settings.options.recognizer_recording_timeout = recognizer_recording_timeout
 def set_recognizer_energy_ratio(recognizer_energy_ratio):
     """
     Set a new value for the recognizer_energy_ratio;
     Must be an float.
     :param recognizer_energy_ratio: new value to push to the recognizer_energy_ratio in the Options settings
     """
     if isinstance(recognizer_energy_ratio, float):
         settings = SettingLoader().settings
         settings.options.recognizer_energy_ratio = recognizer_energy_ratio
Esempio n. 42
0
 def test_get_triggers(self):
     trigger1 = Trigger(name="snowboy",
                        parameters={'pmdl_file': 'trigger/snowboy/resources/kalliope-FR-6samples.pmdl'})
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual([trigger1], sl._get_triggers(self.settings_dict))
Esempio n. 43
0
 def test_get_stts(self):
     stt = Stt(name="google", parameters={'language': 'fr-FR'})
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual([stt], sl._get_stts(self.settings_dict))
Esempio n. 44
0
 def test_get_cache_path(self):
     expected_cache_path = '/tmp/kalliope_tts_cache'
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual(expected_cache_path, sl._get_cache_path(self.settings_dict))
Esempio n. 45
0
 def test_get_default_trigger(self):
     expected_default_trigger = "snowboy"
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual(expected_default_trigger, sl._get_default_trigger(self.settings_dict))
Esempio n. 46
0
 def test_get_default_text_to_speech(self):
     expected_default_text_to_speech = "pico2wave"
     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))
Esempio n. 47
0
 def test_get_options(self):
     expected_result = Options(energy_threshold=3000, deaf=True, mute=False)
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual(expected_result,
                      sl._get_options(self.settings_dict))
Esempio n. 48
0
    def test_get_default_speech_to_text(self):
        expected_default_speech_to_text = "google"
        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))
Esempio n. 49
0
 def test_get_ttss(self):
     tts1 = Tts(name="pico2wave", parameters={'cache': True, 'language': 'fr-FR'})
     tts2 = Tts(name="googletts", parameters={'language': 'fr', 'cache': True})
     sl = SettingLoader(file_path=self.settings_file_to_test)
     self.assertEqual([tts1, tts2], sl._get_ttss(self.settings_dict))