def run_test_all_members(network): primary, _ = network.find_primary() with primary.client() as c: r = c.get("/gov/members") assert r.status_code == http.HTTPStatus.OK.value response_members = r.body.json() network_members = network.get_members() assert len(network_members) == len(response_members) for member in network_members: assert member.service_id in response_members response_details = response_members[member.service_id] assert response_details["cert"] == member.cert assert ( infra.member.MemberStatus(response_details["status"]) == member.status_code ) assert response_details["member_data"] == member.member_data if member.is_recovery_member: recovery_enc_key = open( member.member_info["encryption_public_key_file"], encoding="utf-8" ).read() assert response_details["public_encryption_key"] == recovery_enc_key else: assert response_details["public_encryption_key"] is None
def test_member_data(network, args): assert args.initial_operator_count > 0 latest_public_tables, _ = network.get_latest_ledger_public_state() members_info = latest_public_tables["public:ccf.gov.members.info"] md_count = 0 for member in network.get_members(): stored_member_info = json.loads(members_info[member.service_id.encode()]) if member.member_data: assert ( stored_member_info["member_data"] == member.member_data ), f'stored member data "{stored_member_info["member_data"]}" != expected "{member.member_data} "' md_count += 1 else: assert "member_data" not in stored_member_info assert md_count == args.initial_operator_count return network
def test_member_data(network, args): assert args.initial_operator_count > 0 primary, _ = network.find_nodes() with primary.client("member0") as mc: def member_info(mid): return mc.post("/gov/read", { "table": "public:ccf.gov.members.info", "key": mid }).body.json() md_count = 0 for member in network.get_members(): if member.member_data: assert (member_info( member.service_id)["member_data"] == member.member_data) md_count += 1 else: assert "member_data" not in member_info(member.service_id) assert md_count == args.initial_operator_count return network