@@ -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,10 @@ 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 ):
96
- self .skill .config_core [ 'enclosure' ][ 'platform' ] = 'mycroft_mark_2'
97
+ self .skill .gui . connected = True
97
98
query_phrase = self .bus .on .call_args_list [- 2 ][0 ][1 ]
98
99
self .skill .CQS_match_query_phrase .return_value = (
99
100
'What\' s the meaning of life' , CQSVisualMatchLevel .EXACT , '42' )
100
-
101
101
query_phrase (Message ('question:query' ,
102
102
data = {'phrase' : 'What\' s the meaning of life' }))
103
103
@@ -119,14 +119,22 @@ def test_successful_visual_match_query_phrase(self):
119
119
120
120
class CQSTest (CommonQuerySkill ):
121
121
"""Simple skill for testing the CommonQuerySkill"""
122
+
122
123
def __init__ (self , * args , ** kwargs ):
123
124
super ().__init__ (* args , ** kwargs )
124
125
self .CQS_match_query_phrase = mock .Mock (name = 'match_phrase' )
125
126
self .CQS_action = mock .Mock (name = 'selected_action' )
126
127
self .skill_id = 'CQSTest'
128
+ self .gui = MockGUI ()
127
129
128
130
def CQS_match_query_phrase (self , phrase ):
129
131
pass
130
132
131
133
def CQS_action (self , phrase , data ):
132
134
pass
135
+
136
+
137
+ class MockGUI ():
138
+ def __init__ (self ):
139
+ self .connected = False
140
+ self .setup_default_handlers = AnyCallable
0 commit comments