diff --git a/__init__.py b/__init__.py index ebbc3d0..977f584 100644 --- a/__init__.py +++ b/__init__.py @@ -99,6 +99,10 @@ def demo_filename(self): """ return self.settings.get("filename") or "demo.txt" + @property + def prompt_on_start(self): + return self.settings.get("prompt_on_start", True) + def initialize(self): # When demo prompt enabled, wait for load and prompt user if self.settings.get("prompt_on_start"): diff --git a/test/test_skill.py b/test/test_skill.py index 3cae567..ccdcdac 100644 --- a/test/test_skill.py +++ b/test/test_skill.py @@ -39,7 +39,7 @@ def test_00_skill_init(self): from neon_utils.skills import NeonSkill self.assertIsInstance(self.skill, NeonSkill) - self.assertTrue(self.skill.settings["prompt_on_start"]) + self.assertTrue(self.skill.prompt_on_start) def test_skill_show_demo_prompt_no_response(self): def ask_yesno(dialog): @@ -53,8 +53,8 @@ def ask_yesno(dialog): self.skill._show_demo_prompt(Message("mycroft.ready")) self.skill.speak_dialog.assert_called_with("confirm_demo_disabled") + self.assertFalse(self.skill.prompt_on_start) self.assertFalse(self.skill.settings["prompt_on_start"]) - self.skill.ask_yesno = default_ask_yesno def test_skill_show_demo_prompt_no_demo_no_response(self): @@ -69,8 +69,8 @@ def ask_yesno(dialog): self.skill._show_demo_prompt(Message("mycroft.ready")) self.skill.speak_dialog.assert_called_with("confirm_demo_disabled") + self.assertFalse(self.skill.prompt_on_start) self.assertFalse(self.skill.settings["prompt_on_start"]) - self.skill.ask_yesno = default_ask_yesno def test_skill_show_demo_prompt_no_demo_no_next_time(self): @@ -85,6 +85,7 @@ def ask_yesno(dialog): self.skill._show_demo_prompt(Message("mycroft.ready")) self.skill.speak_dialog.assert_called_with("confirm_demo_disabled") + self.assertFalse(self.skill.prompt_on_start) self.assertFalse(self.skill.settings["prompt_on_start"]) self.skill.ask_yesno = default_ask_yesno @@ -101,8 +102,8 @@ def ask_yesno(dialog): self.skill._show_demo_prompt(Message("mycroft.ready")) self.skill.speak_dialog.assert_called_with("confirm_demo_enabled") + self.assertTrue(self.skill.prompt_on_start) self.assertTrue(self.skill.settings["prompt_on_start"]) - self.skill.ask_yesno = default_ask_yesno def test_skill_show_demo_prompt_yes_demo(self): @@ -122,6 +123,7 @@ def ask_yesno(dialog): context={"neon_should_respond": True}) self.skill._show_demo_prompt(message) self.skill.handle_show_demo.assert_called_with(message) + self.assertFalse(self.skill.prompt_on_start) self.assertFalse(self.skill.settings["prompt_on_start"]) self.skill.ask_yesno = default_ask_yesno