I'm working on a project that works with tornado's websocket functionality. I see a decent amount of documentation for working with asychronous code, but nothing on how this can be used to create unit tests that work with their WebSocket implementation.
Does tornado.testing
provide the functionality to do this? If so, could someone provide a brief example of how to make it happen?
Thanks in advance.
I've attempted to implement some unit tests on tornado.websocket.WebSocketHandler
based handlers and got the following results:
First of all AsyncHTTPTestCase
definitely has lack of web sockets support.
Still, one can use it at least to manage IOLoop
and application stuff which is significant. Unfortunately, there is no WebSocket client provided with tornado, so here enter side-developed library.
Here is unit test on Web Sockets using Jef Balog's tornado websocket client.