コード例 #1
0
ファイル: test_server.py プロジェクト: boatx/SockIt
    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()
コード例 #2
0
ファイル: test_server.py プロジェクト: boatx/SockIt
    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)