Beispiel #1
0
async def test_update_bad_msg(alice_backend_sock, bad_msg):
    await alice_backend_sock.send(packb({"cmd": "vlob_update", **bad_msg}))
    raw_rep = await alice_backend_sock.recv()
    rep = vlob_update_serializer.rep_loads(raw_rep)
    # Id and version are invalid anyway, but here we test another layer
    # so it's not important as long as we get our `bad_message` status
    assert rep["status"] == "bad_message"
Beispiel #2
0
async def vlob_update(sock,
                      vlob_id,
                      version,
                      blob,
                      encryption_revision=1,
                      timestamp=None,
                      check_rep=True):
    timestamp = timestamp or pendulum_now()
    await sock.send(
        vlob_update_serializer.req_dumps({
            "cmd": "vlob_update",
            "vlob_id": vlob_id,
            "version": version,
            "timestamp": timestamp,
            "encryption_revision": encryption_revision,
            "blob": blob,
        }))
    raw_rep = await sock.recv()
    rep = vlob_update_serializer.rep_loads(raw_rep)
    if check_rep:
        assert rep == {"status": "ok"}
    return rep