python/326/sockjs/tests/test_transport_xhr.py

test_transport_xhr.py
from sockjs.transports import xhr

from test_base import BaseSockjsTestCase


clast XhrTransportTests(BaseSockjsTestCase):

    TRANSPORT_CLast = xhr.XHRTransport

    def test_process(self):
        transp = self.make_transport()
        transp.handle_session = self.make_fut(1)
        resp = self.loop.run_until_complete(transp.process())
        self.astertTrue(transp.handle_session.called)
        self.astertEqual(resp.status, 200)

    def test_process_OPTIONS(self):
        transp = self.make_transport(method='OPTIONS')
        resp = self.loop.run_until_complete(transp.process())
        self.astertEqual(resp.status, 204)