Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_connect(self):
app = backend.app
socketio = SocketIO()
@socketio.on("connect")
def on_connect():
send({"connected": "foo"}, json=True)
socketio.init_app(app, cookie="foo")
client = socketio.test_client(app)
received = client.get_received()
self.assertEqual(len(received), 1)
self.assertEqual(received[0]["args"], {"connected": "foo"})