#NEWLINE# def test_socket_enqueues_incoming_messages( ) : #NEWLINE# #INDENT# queue = Queue ( ) #NEWLINE# request = testing . DummyRequest ( ) #NEWLINE# request . registry [ 'streamer.work_queue' ] = queue #NEWLINE# socket = mock . Mock ( ) #NEWLINE# client = websocket . WebSocket ( socket ) #NEWLINE# client . request = request #NEWLINE# message = FakeMessage ( 'client data' ) #NEWLINE# client . received_message ( message ) #NEWLINE# result = queue . get_nowait ( ) #NEWLINE# assert ( result . socket == client ) #NEWLINE# assert ( result . payload == 'client data' )