Exemple #1
0
    def test_data_received_initialised(self) -> None:
        server = WebSocketServer()
        server.initialised = True

        with patch.object(server,
                          "finalise_handshake") as mock_finalise_handshake:
            server.data_received(b"12345")
            mock_finalise_handshake.assert_not_called()
Exemple #2
0
    def test_data_received_not_initialised(self) -> None:
        server = WebSocketServer()
        server.initialised = False
        data = b"12345"

        with patch.object(server,
                          "finalise_handshake") as mock_finalise_handshake:
            server.data_received(data)
            mock_finalise_handshake.assert_called_once_with(data)