From 3cd6f036299f254c20f7375f9fec350abdd0f16d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85ke=20Forslund?= Date: Wed, 6 Nov 2019 15:07:18 +0100 Subject: [PATCH] Add tests for launching applications --- test/__init__.py | 12 ++++++++++++ test/intent/launch.rocket.json | 9 +++++++++ test/intent/open.notepad.json | 8 ++++++++ 3 files changed, 29 insertions(+) create mode 100644 test/intent/launch.rocket.json create mode 100644 test/intent/open.notepad.json diff --git a/test/__init__.py b/test/__init__.py index d7ffe4f..b3d5283 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -19,4 +19,16 @@ def test_runner(skill, example, emitter, loader, m1): elif example.endswith('search.for.kittens.json'): m.assert_called_with(SEARCH_BASE.format('youtube%20for%20kittens')) + if example.endswith('launch.rocket.json'): + s.register_vocabulary('rocket', 'Application') + m = mock.Mock() + s.appmap['rocket'] = [m] + ret = SkillTest(skill, example, emitter).run(loader) + m.launch.assert_called_with() + elif example.endswith('open.notepad.json'): + s.register_vocabulary('notepad', 'Application') + m = mock.Mock() + s.appmap['notepad'] = [m] + ret = SkillTest(skill, example, emitter).run(loader) + m.launch.assert_called_with() return ret diff --git a/test/intent/launch.rocket.json b/test/intent/launch.rocket.json new file mode 100644 index 0000000..797fb27 --- /dev/null +++ b/test/intent/launch.rocket.json @@ -0,0 +1,9 @@ +{ + "utterance": "launch rocket", + "intent_type": "LaunchDesktopApplicationIntent", + "intent": { + "LaunchKeyword": "launch", + "Application": "rocket" + } +} + diff --git a/test/intent/open.notepad.json b/test/intent/open.notepad.json new file mode 100644 index 0000000..51f0eb2 --- /dev/null +++ b/test/intent/open.notepad.json @@ -0,0 +1,8 @@ +{ + "utterance": "open notepad", + "intent_type": "LaunchDesktopApplicationIntent", + "intent": { + "LaunchKeyword": "open", + "Application": "notepad" + } +}