@@ -38,6 +38,7 @@ def test_common_test_skill_action(self):
38
38
39
39
class TestCommonQueryMatching (TestCase ):
40
40
"""Tests for CQS_match_query_phrase."""
41
+
41
42
def setUp (self ):
42
43
self .skill = CQSTest ()
43
44
self .bus = mock .Mock (name = 'bus' )
@@ -93,11 +94,11 @@ def test_successful_match_query_phrase(self):
93
94
self .assertEqual (response .data ['conf' ], 1.12 )
94
95
95
96
def test_successful_visual_match_query_phrase (self ):
97
+ self .skill .gui .connected = True
96
98
self .skill .config_core ['enclosure' ]['platform' ] = 'mycroft_mark_2'
97
99
query_phrase = self .bus .on .call_args_list [- 2 ][0 ][1 ]
98
100
self .skill .CQS_match_query_phrase .return_value = (
99
101
'What\' s the meaning of life' , CQSVisualMatchLevel .EXACT , '42' )
100
-
101
102
query_phrase (Message ('question:query' ,
102
103
data = {'phrase' : 'What\' s the meaning of life' }))
103
104
@@ -119,14 +120,22 @@ def test_successful_visual_match_query_phrase(self):
119
120
120
121
class CQSTest (CommonQuerySkill ):
121
122
"""Simple skill for testing the CommonQuerySkill"""
123
+
122
124
def __init__ (self , * args , ** kwargs ):
123
125
super ().__init__ (* args , ** kwargs )
124
126
self .CQS_match_query_phrase = mock .Mock (name = 'match_phrase' )
125
127
self .CQS_action = mock .Mock (name = 'selected_action' )
126
128
self .skill_id = 'CQSTest'
129
+ self .gui = MockGUI ()
127
130
128
131
def CQS_match_query_phrase (self , phrase ):
129
132
pass
130
133
131
134
def CQS_action (self , phrase , data ):
132
135
pass
136
+
137
+
138
+ class MockGUI ():
139
+ def __init__ (self ):
140
+ self .connected = False
141
+ self .setup_default_handlers = AnyCallable
0 commit comments