def test_closing_message_received(self):
     s = MagicMock()
     m = MagicMock()
     c = MagicMock()
     
     ws = WebSocket(sock=m)
     with patch.multiple(ws, close=c):
         ws.stream = s
         ws.stream.closing = CloseControlMessage(code=1000, reason='test closing')
         ws.process(b'unused for this test')
         c.assert_called_once_with(1000, b'test closing')
Exemplo n.º 2
0
    def test_closing_message_received(self):
        s = MagicMock()
        m = MagicMock()
        c = MagicMock()

        ws = WebSocket(sock=m)
        with patch.multiple(ws, close=c):
            ws.stream = s
            ws.stream.closing = CloseControlMessage(code=1000,
                                                    reason='test closing')
            ws.process(b'unused for this test')
            c.assert_called_once_with(1000, b'test closing')