예제 #1
0
def test_send_text_masked(protocol, transport):
    writer = WebSocketWriter(protocol,
                             transport,
                             use_mask=True,
                             random=random.Random(123))
    writer.send(b'text')
    writer.transport.write.assert_called_with(b'\x81\x84\rg\xb3fy\x02\xcb\x12')
예제 #2
0
def test_send_text_masked(protocol, transport):
    writer = WebSocketWriter(protocol,
                             transport,
                             use_mask=True,
                             random=random.Random(123))
    writer.send(b'text')
    writer.transport.write.assert_called_with(b'\x81\x84\rg\xb3fy\x02\xcb\x12')
예제 #3
0
def test_send_compress_text_notakeover(protocol, transport):
    writer = WebSocketWriter(protocol,
                             transport,
                             compress=15,
                             notakeover=True)
    writer.send(b'text')
    writer.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
    writer.send(b'text')
    writer.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
예제 #4
0
def test_send_compress_text_per_message(protocol, transport):
    writer = WebSocketWriter(protocol, transport)
    writer.send(b'text', compress=15)
    writer.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
    writer.send(b'text')
    writer.transport.write.assert_called_with(b'\x81\x04text')
    writer.send(b'text', compress=15)
    writer.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
예제 #5
0
async def test_send_text_masked(protocol, transport) -> None:
    writer = WebSocketWriter(protocol,
                             transport,
                             use_mask=True,
                             random=random.Random(123))
    await writer.send(b"text")
    writer.transport.write.assert_called_with(b"\x81\x84\rg\xb3fy\x02\xcb\x12")
예제 #6
0
async def test_send_compress_text_notakeover(protocol: Any,
                                             transport: Any) -> None:
    writer = WebSocketWriter(protocol, transport, compress=15, notakeover=True)
    await writer.send(b"text")
    writer.transport.write.assert_called_with(b"\xc1\x06*I\xad(\x01\x00")
    await writer.send(b"text")
    writer.transport.write.assert_called_with(b"\xc1\x06*I\xad(\x01\x00")
예제 #7
0
async def test_send_compress_text_per_message(protocol, transport) -> None:
    writer = WebSocketWriter(protocol, transport)
    await writer.send(b"text", compress=15)
    writer.transport.write.assert_called_with(b"\xc1\x06*I\xad(\x01\x00")
    await writer.send(b"text")
    writer.transport.write.assert_called_with(b"\x81\x04text")
    await writer.send(b"text", compress=15)
    writer.transport.write.assert_called_with(b"\xc1\x06*I\xad(\x01\x00")
예제 #8
0
def test_send_compress_text_per_message(protocol, transport):
    writer = WebSocketWriter(protocol, transport)
    writer.send(b'text', compress=15)
    writer.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
    writer.send(b'text')
    writer.transport.write.assert_called_with(b'\x81\x04text')
    writer.send(b'text', compress=15)
    writer.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
예제 #9
0
async def test_send_compress_text_notakeover(protocol, transport):
    writer = WebSocketWriter(protocol, transport, compress=15, notakeover=True)
    await writer.send(b'text')
    writer.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
    await writer.send(b'text')
    writer.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
예제 #10
0
def function2772(function2289, function1090):
    function1090 = WebSocketWriter(function2289, use_mask=True, random=random.Random(123))
    function1090.send(b'text')
    function2289.transport.write.assert_called_with(b'\x81\x84\rg\xb3fy\x02\xcb\x12')
def test_send_compress_text_notakeover(stream):
    writer = WebSocketWriter(stream, compress=15, notakeover=True)
    writer.send(b'text')
    stream.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
    writer.send(b'text')
    stream.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
def test_send_compress_text(stream):
    writer = WebSocketWriter(stream, compress=15)
    writer.send(b'text')
    stream.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
    writer.send(b'text')
    stream.transport.write.assert_called_with(b'\xc1\x05*\x01b\x00\x00')
def writer(stream):
    return WebSocketWriter(stream, use_mask=False)
예제 #14
0
def test_send_compress_text(protocol, transport):
    writer = WebSocketWriter(protocol, transport, compress=15)
    writer.send(b'text')
    writer.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
    writer.send(b'text')
    writer.transport.write.assert_called_with(b'\xc1\x05*\x01b\x00\x00')
예제 #15
0
def writer(protocol, transport):
    return WebSocketWriter(protocol, transport, use_mask=False)
예제 #16
0
async def test_send_compress_text(protocol, transport) -> None:
    writer = WebSocketWriter(protocol, transport, compress=15)
    await writer.send(b'text')
    writer.transport.write.assert_called_with(b'\xc1\x06*I\xad(\x01\x00')
    await writer.send(b'text')
    writer.transport.write.assert_called_with(b'\xc1\x05*\x01b\x00\x00')
예제 #17
0
def function1090(function2289):
    return WebSocketWriter(function2289, use_mask=False)