diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 0000000..d7ffe4f --- /dev/null +++ b/test/__init__.py @@ -0,0 +1,22 @@ +from test.integrationtests.skills.skill_tester import SkillTest +import mock + + +SEARCH_BASE = 'http://www.google.com/search?&sourceid=navclient&btnI=I&q={}' + + +@mock.patch('mycroft.skills.mycroft_skill.mycroft_skill.DeviceApi.send_email') +def test_runner(skill, example, emitter, loader, m1): + s = [s for s in loader.skills if s and s.root_dir == skill][0] + with mock.patch('webbrowser.open') as m: + ret = SkillTest(skill, example, emitter).run(loader) + if example.endswith('find.puppies.json'): + m.assert_called_with(SEARCH_BASE.format('wikipedia%20puppies')) + elif example.endswith('find.puppies.json'): + m.assert_called_with(SEARCH_BASE.format('imgur')) + elif example.endswith('open.tumblr.json'): + m.assert_called_with(SEARCH_BASE.format('tumblr')) + elif example.endswith('search.for.kittens.json'): + m.assert_called_with(SEARCH_BASE.format('youtube%20for%20kittens')) + + return ret diff --git a/test/intent/sample2.intent.json b/test/intent/find.puppies.json similarity index 100% rename from test/intent/sample2.intent.json rename to test/intent/find.puppies.json diff --git a/test/intent/sample3.intent.json b/test/intent/launch.imgur.json similarity index 100% rename from test/intent/sample3.intent.json rename to test/intent/launch.imgur.json diff --git a/test/intent/sample4.intent.json b/test/intent/open.tumblr.json similarity index 100% rename from test/intent/sample4.intent.json rename to test/intent/open.tumblr.json diff --git a/test/intent/sample1.intent.json b/test/intent/search.for.kittens.json similarity index 100% rename from test/intent/sample1.intent.json rename to test/intent/search.for.kittens.json