Пример #1
0
async def block_create(sock, block_id, realm_id, block, check_rep=True):
    await sock.send(
        block_create_serializer.req_dumps({
            "cmd": "block_create",
            "block_id": block_id,
            "realm_id": realm_id,
            "block": block
        }))
    raw_rep = await sock.recv()
    rep = block_create_serializer.rep_loads(raw_rep)
    if check_rep:
        assert rep == {"status": "ok"}
    return rep
Пример #2
0
async def test_block_create_bad_msg(alice_backend_sock, bad_msg):
    await alice_backend_sock.send(packb({"cmd": "block_create", **bad_msg}))
    raw_rep = await alice_backend_sock.recv()
    rep = block_create_serializer.rep_loads(raw_rep)
    assert rep["status"] == "bad_message"