def test_slow_websocket(self): message = self.request_simple_session() consumers.create_session(message) # test connecting after session is created pre_create_id = message['kwargs']['pre_create_id'] ws_client = ConnectingWSClient( path=channel_utils.wait_for_session_path(pre_create_id)) ws_client.connect() self.assertEqual(ws_client.receive(), {'status': 'ready'})
def test_failure_with_slow_websocket(self, patched): message = self.request_simple_session() pre_create_id = message['kwargs']['pre_create_id'] ws_client = ConnectingWSClient( path=channel_utils.wait_for_session_path(pre_create_id)) with self.assertRaises(ZeroDivisionError): consumers.create_session(message) ws_client.connect() message_dict = ws_client.receive() self.assertTrue(bool(message_dict.get('error'))) self.assertTrue(bool(message_dict.get('traceback')))
def socket_url(self): return channel_utils.wait_for_session_path(self._pre_create_id)
def socket_url(self): return channel_utils.wait_for_session_path(self._pre_create_id)