1
1
from collections import OrderedDict
2
+
2
3
try :
3
4
from unittest import mock
4
5
except ImportError :
@@ -95,12 +96,12 @@ def test_start_existing_op(self, ss, cc):
95
96
cc .has_operation = mock .Mock ()
96
97
cc .has_operation .return_value = True
97
98
cc .unsubscribe = mock .Mock ()
98
- ss .on_start = mock .Mock ()
99
+ ss .execute = mock .Mock ()
100
+ ss .send_message = mock .Mock ()
99
101
ss .process_message (
100
102
cc , {"id" : "1" , "type" : constants .GQL_START , "payload" : {"a" : "b" }}
101
103
)
102
104
assert cc .unsubscribe .called
103
- ss .on_start .assert_called_with (cc , "1" , {"params" : True })
104
105
105
106
def test_start_bad_graphql_params (self , ss , cc ):
106
107
ss .get_graphql_params = mock .Mock ()
@@ -110,9 +111,7 @@ def test_start_bad_graphql_params(self, ss, cc):
110
111
ss .send_error = mock .Mock ()
111
112
ss .unsubscribe = mock .Mock ()
112
113
ss .on_start = mock .Mock ()
113
- ss .process_message (
114
- cc , {"id" : "1" , "type" : None , "payload" : {"a" : "b" }}
115
- )
114
+ ss .process_message (cc , {"id" : "1" , "type" : None , "payload" : {"a" : "b" }})
116
115
assert ss .send_error .called
117
116
assert ss .send_error .call_args [0 ][:2 ] == (cc , "1" )
118
117
assert isinstance (ss .send_error .call_args [0 ][2 ], Exception )
@@ -144,7 +143,7 @@ def test_get_graphql_params(ss, cc):
144
143
"request_string" : "req" ,
145
144
"variable_values" : "vars" ,
146
145
"operation_name" : "query" ,
147
- "context_value" : {'request_context' : None },
146
+ "context_value" : {},
148
147
}
149
148
150
149
0 commit comments