Example #1
0
def test_shortcuts():
    assert language.parse_pathod(
        "400:c'foo'").next().headers[0].key.val == "Content-Type"
    assert language.parse_pathod(
        "400:l'foo'").next().headers[0].key.val == "Location"

    assert "Android" in tutils.render(parse_request("get:/:ua"))
    assert "User-Agent" in tutils.render(parse_request("get:/:ua"))
Example #2
0
def test_shortcuts():
    assert next(language.parse_pathod(
        "400:c'foo'")).headers[0].key.val == b"Content-Type"
    assert next(language.parse_pathod(
        "400:l'foo'")).headers[0].key.val == b"Location"

    assert b"Android" in tutils.render(parse_request("get:/:ua"))
    assert b"User-Agent" in tutils.render(parse_request("get:/:ua"))
    def test_flags(self):
        wf = parse_request("wf:fin:mask:rsv1:rsv2:rsv3")
        frm = netlib.websockets.Frame.from_bytes(tutils.render(wf))
        assert frm.header.fin
        assert frm.header.mask
        assert frm.header.rsv1
        assert frm.header.rsv2
        assert frm.header.rsv3

        wf = parse_request("wf:-fin:-mask:-rsv1:-rsv2:-rsv3")
        frm = netlib.websockets.Frame.from_bytes(tutils.render(wf))
        assert not frm.header.fin
        assert not frm.header.mask
        assert not frm.header.rsv1
        assert not frm.header.rsv2
        assert not frm.header.rsv3
Example #4
0
    def test_flags(self):
        wf = parse_request("wf:fin:mask:rsv1:rsv2:rsv3")
        frm = netlib.websockets.Frame.from_bytes(tutils.render(wf))
        assert frm.header.fin
        assert frm.header.mask
        assert frm.header.rsv1
        assert frm.header.rsv2
        assert frm.header.rsv3

        wf = parse_request("wf:-fin:-mask:-rsv1:-rsv2:-rsv3")
        frm = netlib.websockets.Frame.from_bytes(tutils.render(wf))
        assert not frm.header.fin
        assert not frm.header.mask
        assert not frm.header.rsv1
        assert not frm.header.rsv2
        assert not frm.header.rsv3
 def fr(self, spec, **kwargs):
     settings = language.base.Settings(**kwargs)
     wf = parse_request(spec)
     return netlib.websockets.Frame.from_bytes(tutils.render(wf, settings))
Example #6
0
 def fr(self, spec, **kwargs):
     settings = language.base.Settings(**kwargs)
     wf = parse_request(spec)
     return netlib.websockets.Frame.from_bytes(tutils.render(wf, settings))