summaryrefslogtreecommitdiff
path: root/client/test_mic.py
diff options
context:
space:
mode:
Diffstat (limited to 'client/test_mic.py')
-rw-r--r--client/test_mic.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/client/test_mic.py b/client/test_mic.py
new file mode 100644
index 0000000..b01240f
--- /dev/null
+++ b/client/test_mic.py
@@ -0,0 +1,27 @@
+"""
+A drop-in replacement for the Mic class used during unit testing.
+Designed to take pre-arranged inputs as an argument and store any
+outputs for inspection. Requires a populated profile (profile.yml).
+"""
+
+
+class Mic:
+
+ def __init__(self, inputs):
+ self.inputs = inputs
+ self.idx = 0
+ self.outputs = []
+
+ def passiveListen(self, PERSONA):
+ return True, "JASPER"
+
+ def activeListen(self, THRESHOLD=None, LISTEN=True, MUSIC=False):
+ if not LISTEN:
+ return self.inputs[self.idx - 1]
+
+ input = self.inputs[self.idx]
+ self.idx += 1
+ return input
+
+ def say(self, phrase, OPTIONS=None):
+ self.outputs.append(phrase)