async def user_get(sock, user_id): await sock.send( user_get_serializer.req_dumps({ "cmd": "user_get", "user_id": user_id })) raw_rep = await sock.recv() return user_get_serializer.rep_loads(raw_rep)
async def test_api_user_get_bad_msg(alice_backend_sock, bad_msg): await alice_backend_sock.send(packb({"cmd": "user_get", **bad_msg})) raw_rep = await alice_backend_sock.recv() rep = user_get_serializer.rep_loads(raw_rep) assert rep["status"] == "bad_message"