11from collections import OrderedDict
2+
23try :
34 from unittest import mock
45except ImportError :
@@ -95,12 +96,12 @@ def test_start_existing_op(self, ss, cc):
9596 cc .has_operation = mock .Mock ()
9697 cc .has_operation .return_value = True
9798 cc .unsubscribe = mock .Mock ()
98- ss .on_start = mock .Mock ()
99+ ss .execute = mock .Mock ()
100+ ss .send_message = mock .Mock ()
99101 ss .process_message (
100102 cc , {"id" : "1" , "type" : constants .GQL_START , "payload" : {"a" : "b" }}
101103 )
102104 assert cc .unsubscribe .called
103- ss .on_start .assert_called_with (cc , "1" , {"params" : True })
104105
105106 def test_start_bad_graphql_params (self , ss , cc ):
106107 ss .get_graphql_params = mock .Mock ()
@@ -110,9 +111,7 @@ def test_start_bad_graphql_params(self, ss, cc):
110111 ss .send_error = mock .Mock ()
111112 ss .unsubscribe = mock .Mock ()
112113 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" }})
116115 assert ss .send_error .called
117116 assert ss .send_error .call_args [0 ][:2 ] == (cc , "1" )
118117 assert isinstance (ss .send_error .call_args [0 ][2 ], Exception )
@@ -144,7 +143,7 @@ def test_get_graphql_params(ss, cc):
144143 "request_string" : "req" ,
145144 "variable_values" : "vars" ,
146145 "operation_name" : "query" ,
147- "context_value" : {'request_context' : None },
146+ "context_value" : {},
148147 }
149148
150149
0 commit comments