From be71f6e6ff7459c492d90404599865a8aca68aea Mon Sep 17 00:00:00 2001 From: Anna Kotsa <44175203+annakotsa@users.noreply.github.com> Date: Mon, 18 May 2020 19:04:49 +0300 Subject: [PATCH] Update test_voice.py --- jarviscli/tests/test_voice.py | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 jarviscli/tests/test_voice.py diff --git a/jarviscli/tests/test_voice.py b/jarviscli/tests/test_voice.py new file mode 100644 index 000000000..2437e47ab --- /dev/null +++ b/jarviscli/tests/test_voice.py @@ -0,0 +1,37 @@ +import unittest +from tests import PluginTest +from plugins import voice +from CmdInterpreter import JarvisAPI +from Jarvis import Jarvis +import subprocess + +# this test class contains test cases for the plugins "gtts" and "disable_gtts" +# which are included in the "voice.py" file in the "plugins" folder + +class VoiceTest(PluginTest): + + # test "gtts" plugin + def setUp(self): + self.test_gtts = self.load_plugin(voice.gtts) + + def test_gtts(self): + # run "gtts" plugin code + self.jarvis.enable_gtts() + + # verify that "gtts" plugin code works + self.assertEqual(self.jarvis_api.get_data('gtts_status'), True) + + + # test "disable_gtts" plugin + def setUp(self): + self.test_disable_gtts = self.load_plugin(voice.disable_gtts) + + def test_disable_gtts(self): + # run "disable_gtts" plugin code + self.jarvis.disable_gtts() + + # verify that "disable_gtts" plugin code works + self.assertEqual(self.jarvis_api.get_data('gtts_status'), False) + +if __name__ == '__main__': + unittest.main()