55 import mock
66
77import pytest
8+ from graphql .execution .executors .sync import SyncExecutor
89
9- from graphql_ws import base , constants
10+ from graphql_ws import base , base_sync , constants
1011
1112
1213@pytest .fixture
@@ -18,7 +19,7 @@ def cc():
1819
1920@pytest .fixture
2021def ss ():
21- return base . BaseSubscriptionServer (schema = None )
22+ return base_sync . BaseSyncSubscriptionServer (schema = None )
2223
2324
2425class TestConnectionContextOperation :
@@ -137,7 +138,9 @@ def test_get_graphql_params(ss, cc):
137138 "operationName" : "query" ,
138139 "context" : "ctx" ,
139140 }
140- assert ss .get_graphql_params (cc , payload ) == {
141+ params = ss .get_graphql_params (cc , payload )
142+ assert isinstance (params .pop ("executor" ), SyncExecutor )
143+ assert params == {
141144 "request_string" : "req" ,
142145 "variable_values" : "vars" ,
143146 "operation_name" : "query" ,
@@ -189,34 +192,10 @@ def test_send_message(ss, cc):
189192 cc .send = mock .Mock ()
190193 cc .send .return_value = "returned"
191194 assert "returned" == ss .send_message (cc )
192- cc .send .assert_called_with (' {"mess": "age"}' )
195+ cc .send .assert_called_with ({"mess" : "age" })
193196
194197
195198class TestSSNotImplemented :
196199 def test_handle (self , ss ):
197200 with pytest .raises (NotImplementedError ):
198201 ss .handle (ws = None , request_context = None )
199-
200- def test_on_open (self , ss ):
201- with pytest .raises (NotImplementedError ):
202- ss .on_open (connection_context = None )
203-
204- def test_on_connect (self , ss ):
205- with pytest .raises (NotImplementedError ):
206- ss .on_connect (connection_context = None , payload = None )
207-
208- def test_on_close (self , ss ):
209- with pytest .raises (NotImplementedError ):
210- ss .on_close (connection_context = None )
211-
212- def test_on_connection_init (self , ss ):
213- with pytest .raises (NotImplementedError ):
214- ss .on_connection_init (connection_context = None , op_id = None , payload = None )
215-
216- def test_on_stop (self , ss ):
217- with pytest .raises (NotImplementedError ):
218- ss .on_stop (connection_context = None , op_id = None )
219-
220- def test_on_start (self , ss ):
221- with pytest .raises (NotImplementedError ):
222- ss .on_start (connection_context = None , op_id = None , params = None )
0 commit comments