示例#1
0
    def test_get_player(self):
        """
        Test the PlayerLauncher trying to run the Player
        """
        player1 = Player("Player", {})
        player2 = Player("Player2", {'test': "hitheparamtest"})
        settings = Settings()
        settings.players = [player1, player2]
        with mock.patch("kalliope.core.Utils.get_dynamic_class_instantiation"
                        ) as mock_get_class_instantiation:
            # Get the player1
            settings.default_player_name = "Player"
            PlayerLauncher.get_player(settings=settings)

            mock_get_class_instantiation.assert_called_once_with(
                package_name="players",
                module_name=player1.name,
                parameters=player1.parameters)
            mock_get_class_instantiation.reset_mock()

            # Get the player 2
            settings.default_player_name = "Player2"
            PlayerLauncher.get_player(settings=settings)

            mock_get_class_instantiation.assert_called_once_with(
                package_name="players",
                module_name=player2.name,
                parameters=player2.parameters)
            mock_get_class_instantiation.reset_mock()
    def test_get_player(self):
        """
        Test the PlayerLauncher trying to run the Player
        """
        player1 = Player("Player", {})
        player2 = Player("Player2", {'test': "hitheparamtest"})
        settings = Settings()
        settings.players = [player1, player2]
        with mock.patch("kalliope.core.Utils.get_dynamic_class_instantiation") as mock_get_class_instantiation:
            # Get the player1
            settings.default_player_name = "Player"
            PlayerLauncher.get_player(settings=settings)

            mock_get_class_instantiation.assert_called_once_with(package_name="players",
                                                                 module_name=player1.name,
                                                                 parameters=player1.parameters)
            mock_get_class_instantiation.reset_mock()

            # Get the player 2
            settings.default_player_name = "Player2"
            PlayerLauncher.get_player(settings=settings)

            mock_get_class_instantiation.assert_called_once_with(package_name="players",
                                                                 module_name=player2.name,
                                                                 parameters=player2.parameters)
            mock_get_class_instantiation.reset_mock()
示例#3
0
    def test_get_trigger(self):
        """
        Test the Trigger Launcher trying to run the trigger
        """
        trigger1 = Trigger("Trigger", {})
        trigger2 = Trigger("Trigger2", {'pmdl_file': "trigger/snowboy/resources/kalliope-FR-6samples.pmdl"})
        settings = Settings()
        settings.triggers = [trigger1, trigger2]
        with mock.patch("kalliope.core.Utils.get_dynamic_class_instantiation") as mock_get_class_instantiation:
            # Get the trigger 1
            settings.default_trigger_name = "Trigger"
            TriggerLauncher.get_trigger(settings=settings,
                                        callback=None)

            mock_get_class_instantiation.assert_called_once_with(package_name="trigger",
                                                                 module_name=trigger1.name,
                                                                 parameters=trigger1.parameters)
            mock_get_class_instantiation.reset_mock()

            # Get the trigger 2
            settings.default_trigger_name = "Trigger2"
            TriggerLauncher.get_trigger(settings=settings,
                                        callback=None)

            mock_get_class_instantiation.assert_called_once_with(package_name="trigger",
                                                                 module_name=trigger2.name,
                                                                 parameters=trigger2.parameters)
            mock_get_class_instantiation.reset_mock()
示例#4
0
    def setUp(self):
        # Init
        neuron1 = Neuron(name='neurone1', parameters={'var1': 'val1'})
        neuron2 = Neuron(name='neurone2', parameters={'var2': 'val2'})
        neuron3 = Neuron(name='neurone3', parameters={'var3': 'val3'})
        neuron4 = Neuron(name='neurone4', parameters={'var4': 'val4'})

        signal1 = Signal(name="order", parameters="this is the sentence")
        signal2 = Signal(name="order",
                         parameters="this is the second sentence")
        signal3 = Signal(name="order",
                         parameters="that is part of the third sentence")

        self.synapse1 = Synapse(name="Synapse1",
                                neurons=[neuron1, neuron2],
                                signals=[signal1])
        self.synapse2 = Synapse(name="Synapse2",
                                neurons=[neuron3, neuron4],
                                signals=[signal2])
        self.synapse3 = Synapse(name="Synapse3",
                                neurons=[neuron2, neuron4],
                                signals=[signal3])

        self.all_synapse_list = [self.synapse1, self.synapse2, self.synapse3]

        self.brain_test = Brain(synapses=self.all_synapse_list)
        self.settings_test = Settings()

        # clean the LiFO
        Singleton._instances = dict()
        LifoManager.clean_saved_lifo()
示例#5
0
    def test_generate_and_play(self):
        """
        Test to generate and play sound
        """
        def new_play_audio(TTSModule):
            pass

        words = "kalliope"

        with mock.patch.object(TTSModule, 'play_audio', new=new_play_audio):
            settings = Settings(cache_path="/tmp/kalliope/tests")
            self.TTSMod.settings = settings

            # test missing callback
            with self.assertRaises(TtsGenerateAudioFunctionNotFound):
                self.TTSMod.generate_and_play(words=words)

            # Assert Callback is called
            # no Cache
            self.TTSMod.cache = False
            generate_audio_function_from_child = mock.Mock()
            self.TTSMod.generate_and_play(words=words,
                                          generate_audio_function_from_child=
                                          generate_audio_function_from_child)
            generate_audio_function_from_child.assert_called()

            # with cache True but not existing on system
            self.TTSMod.cache = True
            generate_audio_function_from_child = mock.Mock()
            self.TTSMod.generate_and_play(words=words,
                                          generate_audio_function_from_child=
                                          generate_audio_function_from_child)
            generate_audio_function_from_child.assert_called()

            # with cache True and existing on system
            # create tmp file
            tmp_base_path = "/tmp/kalliope/tests/TTSModule/tests/default/"
            file_path = os.path.join(tmp_base_path,
                                     "5c186d1e123be2667fb5fd54640e4fd0.tts")
            if os.path.isfile(file_path):
                # Remove the file
                FileManager.remove_file(file_path)
            if not os.path.exists(tmp_base_path):
                os.makedirs(tmp_base_path)
            FileManager.write_in_file(
                file_path, "[kalliope-test] test_generate_and_play")
            self.TTSMod.cache = True
            generate_audio_function_from_child = mock.Mock()
            self.TTSMod.generate_and_play(words=words,
                                          generate_audio_function_from_child=
                                          generate_audio_function_from_child)
            generate_audio_function_from_child.assert_not_called()
            # Remove the tmp file
            FileManager.remove_file(file_path)
示例#6
0
    def test_get_neurons(self):
        """
        Test to get neurons from the brainLoader
        scenarii:
            - 1/ get a simple neuron from the brainloader
            - 2/ get a neuron with brackets
            - 3/ get a neuron with int as parameters
        """
        # 1/ get a simple neuron from the brainloader
        st = Settings()
        neuron_list = [{'say': {'message': ['test message']}}]

        neuron = Neuron(name='say', parameters={'message': ['test message']})

        bl = BrainLoader(file_path=self.brain_to_test)
        neurons_from_brain_loader = bl.get_neurons(neuron_list, settings=st)

        self.assertEqual([neuron], neurons_from_brain_loader)

        # 2/ get a neuron with global variables as parameters
        neuron_list = [{'say': {'message': ['bonjour {{name}}']}}]

        st = Settings()
        bl = BrainLoader(file_path=self.brain_to_test)
        neurons_from_brain_loader = bl.get_neurons(neuron_list, settings=st)

        neuron = Neuron(name='say',
                        parameters={'message': ['bonjour {{name}}']})

        self.assertEqual([neuron], neurons_from_brain_loader)

        # 3/ get a neuron with int as parameters
        st = Settings()
        neuron_list = [{'sleep': {'seconds': 60}}]

        neuron = Neuron(name='sleep', parameters={'seconds': 60})

        bl = BrainLoader(file_path=self.brain_to_test)
        neurons_from_brain_loader = bl.get_neurons(neuron_list, settings=st)

        self.assertEqual([neuron], neurons_from_brain_loader)
示例#7
0
    def test_get_path_to_store_audio(self):
        """
        Test the path to store audio
        """

        self.TTSMod.words = "kalliope"
        settings = Settings(cache_path="/tmp/kalliope/tests")
        self.TTSMod.settings = settings

        expected_result = "/tmp/kalliope/tests/TTSModule/tests/default/5c186d1e123be2667fb5fd54640e4fd0.tts"

        self.assertEqual(
            self.TTSMod._get_path_to_store_audio(), expected_result,
            "fail test_get_path_to_store_audio, expected path not corresponding to result"
        )
    def setUp(self):
        # Kill the singleton
        Singleton._instances = dict()

        # Init
        neuron1 = Neuron(name='neurone1', parameters={'var1': 'val1'})
        neuron2 = Neuron(name='neurone2', parameters={'var2': 'val2'})
        neuron3 = Neuron(name='neurone3', parameters={'var3': 'val3'})
        neuron4 = Neuron(name='neurone4', parameters={'var4': 'val4'})

        signal1 = Signal(name="order", parameters="this is the sentence")
        signal2 = Signal(name="order",
                         parameters="this is the second sentence")
        signal3 = Signal(name="order",
                         parameters="that is part of the third sentence")

        self.synapse1 = Synapse(name="Synapse1",
                                neurons=[neuron1, neuron2],
                                signals=[signal1])
        self.synapse2 = Synapse(name="Synapse2",
                                neurons=[neuron3, neuron4],
                                signals=[signal2])
        self.synapse3 = Synapse(name="Synapse3",
                                neurons=[neuron2, neuron4],
                                signals=[signal3])

        self.all_synapse_list1 = [self.synapse1, self.synapse2, self.synapse3]

        self.all_synapse_list2 = [self.synapse2, self.synapse3]

        self.brain_test1 = Brain(synapses=self.all_synapse_list1)
        self.brain_test2 = Brain(synapses=self.all_synapse_list2)
        # this brain is the same as the first one
        self.brain_test3 = Brain(synapses=self.all_synapse_list1)

        self.settings_test = Settings()

        # clean the LiFO
        LIFOBuffer.lifo_list = list()
示例#9
0
    def _get_settings(self):
        """
        Class Methods which loads default or the provided YAML file and return a Settings Object

        :return: The loaded Settings
        :rtype: Settings

        :Example:

            settings = SettingLoader.get_settings(file_path="/var/tmp/settings.yml")

        .. seealso:: Settings
        .. warnings:: Class Method
        """

        # create a new setting
        setting_object = Settings()

        # Get the setting parameters
        settings = self._get_yaml_config()
        default_stt_name = self._get_default_speech_to_text(settings)
        default_tts_name = self._get_default_text_to_speech(settings)
        default_trigger_name = self._get_default_trigger(settings)
        default_player_name = self._get_default_player(settings)
        stts = self._get_stts(settings)
        ttss = self._get_ttss(settings)
        triggers = self._get_triggers(settings)
        players = self._get_players(settings)
        rest_api = self._get_rest_api(settings)
        cache_path = self._get_cache_path(settings)
        resources = self._get_resources(settings)
        variables = self._get_variables(settings)
        options = self._get_options(settings)
        hooks = self._get_hooks(settings)

        # Load the setting singleton with the parameters
        setting_object.default_tts_name = default_tts_name
        setting_object.default_stt_name = default_stt_name
        setting_object.default_trigger_name = default_trigger_name
        setting_object.default_player_name = default_player_name
        setting_object.stts = stts
        setting_object.ttss = ttss
        setting_object.triggers = triggers
        setting_object.players = players
        setting_object.rest_api = rest_api
        setting_object.cache_path = cache_path
        setting_object.resources = resources
        setting_object.variables = variables
        setting_object.options = options
        setting_object.hooks = hooks

        return setting_object
示例#10
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"
        settings_object.default_player_name = "mplayer"
        tts1 = Tts(name="pico2wave",
                   parameters={
                       'cache': True,
                       'language': 'fr-FR'
                   })
        tts2 = Tts(name="googletts",
                   parameters={
                       'language': 'fr',
                       'cache': True
                   })
        settings_object.ttss = [tts1, tts2]
        stt = Stt(name="google", parameters={'language': 'fr-FR'})
        settings_object.stts = [stt]
        trigger1 = Trigger(
            name="snowboy",
            parameters={
                'pmdl_file':
                'trigger/snowboy/resources/kalliope-FR-6samples.pmdl'
            })
        settings_object.triggers = [trigger1]
        player1 = Player(name="mplayer", parameters={})
        player2 = Player(name="pyalsaaudio", parameters={"device": "default"})
        settings_object.players = [player1, player2]
        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'
        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.options = Options(energy_threshold=3000,
                                          deaf=True,
                                          mute=False)
        settings_object.machine = platform.machine()
        settings_object.hooks = {
            'on_waiting_for_trigger': 'test',
            'on_stop_listening': None,
            'on_start_listening': None,
            'on_order_found': None,
            'on_start': ['on-start-synapse', 'bring-led-on'],
            'on_undeaf': [],
            'on_triggered': ['on-triggered-synapse'],
            'on_deaf': [],
            'on_mute': [],
            'on_unmute': [],
            'on_order_not_found': ['order-not-found-synapse'],
            'on_processed_synapses': None,
            'on_start_speaking': None,
            'on_stop_speaking': None,
        }

        sl = SettingLoader(file_path=self.settings_file_to_test)

        self.assertEqual(settings_object, sl.settings)
示例#11
0
    def test_run_matching_synapse_from_order(self):
        # ------------------
        # test_match_synapse1
        # ------------------
        with mock.patch("kalliope.core.Lifo.LIFOBuffer.execute"):
            order_to_match = "this is the sentence"

            should_be_created_matched_synapse = MatchedSynapse(
                matched_synapse=self.synapse1,
                user_order=order_to_match,
                matched_order="this is the sentence")
            expected_result = [[should_be_created_matched_synapse]]
            SynapseLauncher.run_matching_synapse_from_order(
                order_to_match,
                brain=self.brain_test,
                settings=self.settings_test)

            lifo_buffer = LifoManager.get_singleton_lifo()
            self.assertEqual(expected_result, lifo_buffer.lifo_list)

        # -------------------------
        # test_match_synapse1_and_2
        # -------------------------
        # clean LIFO
        Singleton._instances = dict()
        LifoManager.clean_saved_lifo()
        with mock.patch("kalliope.core.Lifo.LIFOBuffer.execute"):
            order_to_match = "this is the second sentence"
            should_be_created_matched_synapse1 = MatchedSynapse(
                matched_synapse=self.synapse1,
                user_order=order_to_match,
                matched_order="this is the sentence")
            should_be_created_matched_synapse2 = MatchedSynapse(
                matched_synapse=self.synapse2,
                user_order=order_to_match,
                matched_order="this is the second sentence")

            expected_result = [[
                should_be_created_matched_synapse1,
                should_be_created_matched_synapse2
            ]]
            SynapseLauncher.run_matching_synapse_from_order(
                order_to_match,
                brain=self.brain_test,
                settings=self.settings_test)
            lifo_buffer = LifoManager.get_singleton_lifo()
            self.assertEqual(expected_result, lifo_buffer.lifo_list)

        # -------------------------
        # test_call_hook_order_not_found
        # -------------------------
        # clean LIFO
        Singleton._instances = dict()
        LifoManager.clean_saved_lifo()
        with mock.patch(
                "kalliope.core.HookManager.on_order_not_found") as mock_hook:
            order_to_match = "not existing sentence"

            SynapseLauncher.run_matching_synapse_from_order(
                order_to_match,
                brain=self.brain_test,
                settings=self.settings_test)
            mock_hook.assert_called_with()

        mock_hook.reset_mock()

        # -------------------------
        # test_call_hook_order_found
        # -------------------------
        # clean LIFO
        Singleton._instances = dict()
        with mock.patch("kalliope.core.Lifo.LIFOBuffer.execute"):
            with mock.patch(
                    "kalliope.core.HookManager.on_order_found") as mock_hook:
                order_to_match = "this is the second sentence"
                new_settings = Settings()
                SynapseLauncher.run_matching_synapse_from_order(
                    order_to_match,
                    brain=self.brain_test,
                    settings=new_settings)
                mock_hook.assert_called_with()

        mock_hook.reset_mock()
示例#12
0
    def test_Settings(self):
        with mock.patch('platform.machine', return_value='pumpkins'):
            rest_api1 = RestAPI(password_protected=True,
                                login="******",
                                password="******",
                                active=True,
                                port=5000, allowed_cors_origin="*")

            tts1 = Tts(name="tts1", parameters=dict())
            tts2 = Tts(name="tts2", parameters=dict())
            stt1 = Stt(name="stt1", parameters=dict())
            stt2 = Stt(name="stt2", parameters=dict())
            trigger1 = Trigger(name="snowboy", parameters=dict())
            player = Player(name="player1")
            resources = Resources()
            options = Options()

            setting1 = Settings(default_tts_name="pico2wav",
                                default_stt_name="google",
                                default_trigger_name="swoyboy",
                                default_player_name="mplayer",
                                ttss=[tts1],
                                stts=[stt1],
                                triggers=[trigger1],
                                players=[player],
                                rest_api=rest_api1,
                                cache_path="/tmp/kalliope",
                                resources=resources,
                                variables={"key1": "val1"},
                                options=options)
            setting1.kalliope_version = "0.4.5"

            setting2 = Settings(default_tts_name="pico2wav",
                                default_stt_name="google",
                                default_trigger_name="swoyboy",
                                default_player_name="mplayer",
                                ttss=[tts2],
                                stts=[stt2],
                                triggers=[trigger1],
                                players=[player],
                                rest_api=rest_api1,
                                cache_path="/tmp/kalliope",
                                resources=resources,
                                variables={"key1": "val1"},
                                options=options)

            setting3 = Settings(default_tts_name="pico2wav",
                                default_stt_name="google",
                                default_trigger_name="swoyboy",
                                default_player_name="mplayer",
                                ttss=[tts1],
                                stts=[stt1],
                                triggers=[trigger1],
                                players=[player],
                                rest_api=rest_api1,
                                cache_path="/tmp/kalliope",
                                resources=resources,
                                variables={"key1": "val1"},
                                options=options)
            setting3.kalliope_version = "0.4.5"

            expected_result_serialize = {'default_tts_name': 'pico2wav', 'default_stt_name': 'google', 'default_trigger_name': 'swoyboy', 'default_player_name': 'mplayer', 'ttss': [{'name': 'tts1', 'parameters': {}}], 'stts': [{'name': 'stt1', 'parameters': {}}], 'triggers': [{'name': 'snowboy', 'parameters': {}}], 'players': [{'name': 'player1', 'parameters': None}], 'rest_api': {'password_protected': True, 'login': '******', 'password': '******', 'active': True, 'port': 5000, 'allowed_cors_origin': '*'}, 'cache_path': '/tmp/kalliope', 'resources': {'neuron_folder': None, 'stt_folder': None, 'tts_folder': None, 'trigger_folder': None, 'signal_folder': None}, 'variables': {'key1': 'val1'}, 'machine': 'pumpkins', 'kalliope_version': '0.4.5', 'options': {'name': 'Options', 'energy_threshold': 4000, 'adjust_for_ambient_noise_second': 0, 'deaf': None, 'mute': None, 'stt_timeout': 0}, 'hooks': None}

            self.maxDiff = None
            self.assertDictEqual(expected_result_serialize, setting1.serialize())

            self.assertTrue(setting1.__eq__(setting3))
            self.assertFalse(setting1.__eq__(setting2))
示例#13
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"
        settings_object.default_player_name = "mplayer"
        tts1 = Tts(name="pico2wave", parameters={'cache': True, 'language': 'fr-FR'})
        tts2 = Tts(name="googletts", parameters={'language': 'fr', 'cache': True})
        settings_object.ttss = [tts1, tts2]
        stt = Stt(name="google", parameters={'language': 'fr-FR'})
        settings_object.stts = [stt]
        trigger1 = Trigger(name="snowboy",
                           parameters={'pmdl_file': 'trigger/snowboy/resources/kalliope-FR-6samples.pmdl'})
        settings_object.triggers = [trigger1]
        player1 = Player(name="mplayer", parameters={})
        player2 = Player(name="pyalsaaudio", parameters={"device": "default"})
        settings_object.players = [player1, player2]
        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'
        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.options = Options(energy_threshold=3000, deaf=True, mute=False)
        settings_object.machine = platform.machine()
        settings_object.hooks = {'on_waiting_for_trigger': 'test',
                                 'on_stop_listening': None,
                                 'on_start_listening': None,
                                 'on_order_found': None,
                                 'on_start': ['on-start-synapse', 'bring-led-on'],
                                 'on_undeaf': [],
                                 'on_triggered': ['on-triggered-synapse'],
                                 'on_deaf': [],
                                 'on_mute': [],
                                 'on_unmute': [],
                                 'on_order_not_found': [
                                     'order-not-found-synapse'],
                                 'on_processed_synapses': None,
                                 'on_start_speaking': None,
                                 'on_stop_speaking': None,
                                 }

        sl = SettingLoader(file_path=self.settings_file_to_test)

        self.assertEqual(settings_object, sl.settings)
    def test_Settings(self):
        with mock.patch('platform.machine', return_value='pumpkins'):
            rest_api1 = RestAPI(password_protected=True,
                                login="******",
                                password="******",
                                active=True,
                                port=5000,
                                allowed_cors_origin="*")

            tts1 = Tts(name="tts1", parameters=dict())
            tts2 = Tts(name="tts2", parameters=dict())
            stt1 = Stt(name="stt1", parameters=dict())
            stt2 = Stt(name="stt2", parameters=dict())
            trigger1 = Trigger(name="snowboy", parameters=dict())
            player = Player(name="player1")
            resources = Resources()
            options = Options()

            setting1 = Settings(default_tts_name="pico2wav",
                                default_stt_name="google",
                                default_trigger_name="swoyboy",
                                default_player_name="mplayer",
                                ttss=[tts1],
                                stts=[stt1],
                                triggers=[trigger1],
                                players=[player],
                                rest_api=rest_api1,
                                cache_path="/tmp/kalliope",
                                resources=resources,
                                variables={"key1": "val1"},
                                options=options,
                                send_anonymous_usage_stats=0)
            setting1.kalliope_version = "0.4.5"

            setting2 = Settings(default_tts_name="pico2wav",
                                default_stt_name="google",
                                default_trigger_name="swoyboy",
                                default_player_name="mplayer",
                                ttss=[tts2],
                                stts=[stt2],
                                triggers=[trigger1],
                                players=[player],
                                rest_api=rest_api1,
                                cache_path="/tmp/kalliope",
                                resources=resources,
                                variables={"key1": "val1"},
                                options=options,
                                send_anonymous_usage_stats=0)

            setting3 = Settings(default_tts_name="pico2wav",
                                default_stt_name="google",
                                default_trigger_name="swoyboy",
                                default_player_name="mplayer",
                                ttss=[tts1],
                                stts=[stt1],
                                triggers=[trigger1],
                                players=[player],
                                rest_api=rest_api1,
                                cache_path="/tmp/kalliope",
                                resources=resources,
                                variables={"key1": "val1"},
                                options=options,
                                send_anonymous_usage_stats=0)
            setting3.kalliope_version = "0.4.5"

            expected_result_serialize = {
                'default_tts_name': 'pico2wav',
                'default_stt_name': 'google',
                'default_trigger_name': 'swoyboy',
                'default_player_name': 'mplayer',
                'ttss': [{
                    'name': 'tts1',
                    'parameters': {}
                }],
                'stts': [{
                    'name': 'stt1',
                    'parameters': {}
                }],
                'triggers': [{
                    'name': 'snowboy',
                    'parameters': {}
                }],
                'players': [{
                    'name': 'player1',
                    'parameters': None
                }],
                'rest_api': {
                    'password_protected': True,
                    'login': '******',
                    'password': '******',
                    'active': True,
                    'port': 5000,
                    'allowed_cors_origin': '*'
                },
                'cache_path': '/tmp/kalliope',
                'resources': {
                    'neuron_folder': None,
                    'stt_folder': None,
                    'tts_folder': None,
                    'trigger_folder': None,
                    'signal_folder': None
                },
                'variables': {
                    'key1': 'val1'
                },
                'machine': 'pumpkins',
                'kalliope_version': '0.4.5',
                'options': {
                    'name': 'Options',
                    'recognizer_multiplier': 1.0,
                    'recognizer_energy_ratio': 1.5,
                    'recognizer_recording_timeout': 15.0,
                    'recognizer_recording_timeout_with_silence': 3.0,
                    'deaf': None,
                    'mute': None
                },
                'hooks': None,
                'send_anonymous_usage_stats': 0
            }

            self.maxDiff = None
            self.assertDictEqual(expected_result_serialize,
                                 setting1.serialize())

            self.assertTrue(setting1.__eq__(setting3))
            self.assertFalse(setting1.__eq__(setting2))