From c8d2e9df568b03d3a41fa8fc0e9e0a7b76353370 Mon Sep 17 00:00:00 2001 From: Anna Kotsa <44175203+annakotsa@users.noreply.github.com> Date: Mon, 18 May 2020 18:30:00 +0300 Subject: [PATCH] Create 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..d11177adc --- /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.test_gtts.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.test_disable_gtts.disable_gtts() + + # verify that "disable_gtts" plugin code works + self.assertEqual(self.jarvis_api.get_data('gtts_status'), False) + +if __name__ == '__main__': + unittest.main()