示例#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')
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')
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
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')
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')
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')
示例#8
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(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')
示例#10
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')