2.13.ipv8.test.REST.test_attestation_endpoint

Module Contents

Classes

class 2.13.ipv8.test.REST.test_attestation_endpoint.TestAttestationEndpoint

Bases: 2.13.ipv8.test.REST.rest_base.RESTTestBase

Class for testing the REST API of the AttestationEndpoint.

async setUp() None

Create a new memory-based identity manager and set up the necessary communities.

async make_outstanding(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8) list[Sequence[str, str, str]]

Forward a request for outstanding attestation requests.

async make_verification_output(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8) dict[str, list[Sequence[str, float]]]

Forward a request for the verification outputs.

async make_peers(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8) list[str]

Forward a request for the known peers in the network.

async make_attributes(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8) list[Sequence[str, str, dict[str, str | int], str]]

Forward a request for the attributes of a peer.

async wait_for_attributes(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8) list[Sequence[str, str, dict[str, str | int], str]]

Forward a request for the attributes of a peer.

async make_drop_identity(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8) dict[str, bool]

Forward a request for dropping a peer’s identity.

async make_outstanding_verify(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8) list[Sequence[str, str]]

Forward a request which requests information on the outstanding verify requests.

async make_attestation_request(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8, attribute_name: str, mid: str, metadata: dict | None = None) dict[str, bool]

Forward a request for the attestation of an attribute.

async make_attest(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8, attribute_name: str, attribute_value: list[str], mid: str) dict[str, bool]

Forward a request which attests an attestation request.

async make_verify(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8, attribute_hash: str, attribute_values: str, mid: str) dict[str, bool]

Forward a request which demands the verification of an attestation.

async make_allow_verify(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8, attribute_name: str, mid: str) dict[str, bool]

Forward a request which requests that verifications be allowed for a particular peer for a particular attribute.

async create_attestation_request(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8, attribute_name: str, metadata: dict | None = None) None

Request all known peers to attest to the node’s given attribute name.

async wait_for_peers(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8) list[str]

Wait until this peer receives a non-empty list of fellow peers in the network.

async wait_for_outstanding_requests(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8) list[tuple[bytes, str, str]]

Wait until this peer receives a non-empty list of outstanding attestation requests.

async attest_all_outstanding_requests(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8, attribute_name: str, attribute_value: str) tuple[list[tuple[bytes, str, str]], list[dict[str, bool]]]

Forward an attestation for each of the outstanding attestation requests.

Returns:

a list of the outstanding requests and their (empty if successful) request responses

async verify_all_attestations(node: 2.13.ipv8.test.REST.rest_base.MockRestIPv8, peer_mids: Collection[bytes], attribute_hash: str, attribute_values: str) list[dict[str, bool]]

Forward an attestation verification for a set of attestations.

Parameters:

peer_mids – the set of peer mids to which a verification request will be sent

Returns:

the verification responses, as returned by the well-known peer. Ideally these should be all empty

async test_get_peers_request() None

Test the (GET: peers request) type.

async test_get_outstanding_requests() None

Test the (GET: outstanding) request type.

async test_get_verification_output() None

Test the (GET: verification output) request type.

async test_get_outstanding_verify() None

Test the (GET: outstanding verify) request type.

async test_get_attributes() None

Test the (GET: attributes) request type.

async test_get_drop_identity() None

Test the (GET: drop identity) request type.

async test_post_attestation_request() None

Test the (POST: request) request type.

async test_post_attest() None

Test the (POST: attest) request type.

async test_post_verify() None

Test the (POST: verify) request type.

async test_post_allow_verify() None

Test the (POST: allow verify) request type.