summaryrefslogtreecommitdiff
path: root/client/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'client/test.py')
-rw-r--r--client/test.py21
1 files changed, 12 insertions, 9 deletions
diff --git a/client/test.py b/client/test.py
index 0ad37a3..9c99688 100644
--- a/client/test.py
+++ b/client/test.py
@@ -12,6 +12,7 @@ import vocabcompiler
import g2p
import brain
import jasperpath
+import tts
from diagnose import Diagnostics
DEFAULT_PROFILE = {
@@ -21,9 +22,6 @@ DEFAULT_PROFILE = {
'phone_number': '012344321'
}
-def activeInternet():
- return Diagnostics.check_network_connection()
-
class UnorderedList(list):
def __eq__(self, other):
@@ -145,7 +143,7 @@ class TestModules(unittest.TestCase):
inputs = []
self.runConversation(query, inputs, Time)
- @unittest.skipIf(not activeInternet(), "No internet connection")
+ @unittest.skipIf(not Diagnostics.check_network_connection(), "No internet connection")
def testGmail(self):
key = 'gmail_password'
if not key in self.profile or not self.profile[key]:
@@ -157,7 +155,7 @@ class TestModules(unittest.TestCase):
inputs = []
self.runConversation(query, inputs, Gmail)
- @unittest.skipIf(not activeInternet(), "No internet connection")
+ @unittest.skipIf(not Diagnostics.check_network_connection(), "No internet connection")
def testHN(self):
from modules import HN
@@ -169,7 +167,7 @@ class TestModules(unittest.TestCase):
outputs = self.runConversation(query, inputs, HN)
self.assertTrue("front-page articles" in outputs[1])
- @unittest.skipIf(not activeInternet(), "No internet connection")
+ @unittest.skipIf(not Diagnostics.check_network_connection(), "No internet connection")
def testNews(self):
from modules import News
@@ -181,7 +179,7 @@ class TestModules(unittest.TestCase):
outputs = self.runConversation(query, inputs, News)
self.assertTrue("top headlines" in outputs[1])
- @unittest.skipIf(not activeInternet(), "No internet connection")
+ @unittest.skipIf(not Diagnostics.check_network_connection(), "No internet connection")
def testWeather(self):
from modules import Weather
@@ -192,6 +190,11 @@ class TestModules(unittest.TestCase):
"can't see that far ahead" in outputs[0]
or "Tomorrow" in outputs[0])
+class TestTTS(unittest.TestCase):
+ def testTTS(self):
+ tts_engine = tts.get_engine_by_slug('dummy-tts')
+ tts_instance = tts_engine()
+ tts_instance.say('This is a test.')
class TestBrain(unittest.TestCase):
@@ -225,7 +228,7 @@ class TestBrain(unittest.TestCase):
hn = filter(lambda m: m.__name__ == hn_module, my_brain.modules)[0]
with patch.object(hn, 'handle') as mocked_handle:
- my_brain.query("hacker news")
+ my_brain.query(["hacker news"])
self.assertTrue(mocked_handle.called)
@@ -239,7 +242,7 @@ if __name__ == '__main__':
# Change CWD to jasperpath.LIB_PATH
os.chdir(jasperpath.LIB_PATH)
- test_cases = [TestBrain, TestModules, TestVocabCompiler]
+ test_cases = [TestBrain, TestModules, TestVocabCompiler, TestTTS]
if not args.light:
test_cases.append(TestG2P)
test_cases.append(TestMic)