def test_should_trigger_on_connect_if_client_connect_valid(server_with_mocks):
node_script = '''
module.paths.push('{0}')
WebSocket = require('ws')
const SubscriptionClient =
require('subscriptions-transport-ws').SubscriptionClient
new SubscriptionClient('ws://localhost:{1}/socket')
'''.format(
os.path.join(os.path.dirname(__file__), 'node_modules'), TEST_PORT)
try:
subprocess.check_output(
['node', '-e', node_script], stderr=subprocess.STDOUT, timeout=.2)
except:
mock = server_with_mocks.get_nowait()
assert mock.name == 'on_connect'
mock.assert_called_once()
test_subscription_transport.py 文件源码
python
阅读 30
收藏 0
点赞 0
评论 0
评论列表
文章目录