# Path: sockjs/transports/xhrsend.py
# class XHRSendTransport(Transport):
#     async def process(self):


from aiohttp import web
from sockjs.transports import xhrsend
import pytest

async def xtest_no_payload(make_transport, make_fut):
    transp = make_transport()
    transp.request.read = make_fut(b"")
    resp = await transp.process()
    assert resp.status == 500


async def xtest_bad_json(make_transport, make_fut):
    transp = make_transport()
    transp.request.read = make_fut(b"{]")
    resp = await transp.process()
    assert resp.status == 500


async def xtest_post_message(make_transport, make_fut):
    transp = make_transport()
    transp.session._remote_messages = make_fut(1)
    transp.request.read = make_fut(b'["msg1","msg2"]')
    resp = await transp.process()
    assert resp.status == 204
    transp.session._remote_messages.assert_called_with(["msg1", "msg2"])


async def test_OPTIONS(make_transport):
    transp = make_transport(method="OPTIONS")
    resp = await transp.process()
    assert resp.status == 204



# Path: sockjs/transports/xhrsend.py
# class XHRSendTransport(Transport):
#     async def process(self):


# Path: tests/test_transport_xhrsend.py
from aiohttp import web
from sockjs.transports import xhrsend
import pytest


async def xtest_no_payload(make_transport, make_fut):
    transp = make_transport()
    transp.request.read = make_fut(b"")
    resp = await transp.process()
    assert resp.status == 500


async def xtest_bad_json(make_transport, make_fut):
    transp = make_transport()
    transp.request.read = make_fut(b"{]")
    resp = await transp.process()
    assert resp.status == 500


async def xtest_post_message(make_transport, make_fut):
    transp = make_transport()
    transp.session._remote_messages = make_fut(1)
    transp.request.read = make_fut(b'["msg1","msg2"]')
    resp = await transp.process()
    assert resp.status == 204
    transp.session._remote_messages.assert_called_with(["msg1", "msg2"])


async def test_OPTIONS(make_transport):
    transp = make_transport(method="OPTIONS")
    resp = await transp.process()
    assert resp.status == 204



async def test_session_has_request(make_transport, make_fut):