Example #1
0
async def test_block_read_bad_msg(alice_backend_sock, bad_msg):
    await alice_backend_sock.send(packb({"cmd": "block_read", **bad_msg}))
    raw_rep = await alice_backend_sock.recv()
    rep = block_read_serializer.rep_loads(raw_rep)
    # Valid ID doesn't exists in database but this is ok given here we test
    # another layer so it's not important as long as we get our
    # `bad_message` status
    assert rep["status"] == "bad_message"
Example #2
0
async def block_read(sock, block_id):
    await sock.send(
        block_read_serializer.req_dumps({
            "cmd": "block_read",
            "block_id": block_id
        }))
    raw_rep = await sock.recv()
    return block_read_serializer.rep_loads(raw_rep)