3.0.ipv8.test.REST.test_identity_endpoint

Classes

Module Contents

class 3.0.ipv8.test.REST.test_identity_endpoint.MockPseudonymFolderManager

Bases: 3.0.ipv8.attestation.communication_manager.PseudonymFolderManager

Mock the OS file system using a dictionary as to mock files in a folder.

folder_contents: dict[str, 3.0.ipv8.types.PrivateKey]
get_or_create_private_key(name: str) 3.0.ipv8.types.PrivateKey

Generate or load a new key in memory.

remove_pseudonym_file(name: str) None

Remove the given “folder” in the dictionary, i.e., a key.

list_pseudonym_files() list[str]

Retrieve the “folders”, i.e., keys, in the fake file structure.

class 3.0.ipv8.test.REST.test_identity_endpoint.TestIdentityEndpoint(methodName: str = 'runTest')

Bases: 3.0.ipv8.test.base.TestBase[3.0.ipv8.attestation.identity.community.IdentityCommunity]

Class for testing the REST API of the IdentityEndpoint.

async setUp() None

Set up an identity community, memory identity manager and memory pseudonym folder manager.

create_node(settings: 3.0.ipv8.community.CommunitySettings | None = None, create_dht: bool = False, enable_statistics: bool = False) 3.0.ipv8.test.mocking.ipv8.MockIPv8

We load each node i with a pseudonym my_peer{i}, which is the default IPv8 my_peer key.

rest_ep(i: int) 3.0.ipv8.REST.identity_endpoint.IdentityEndpoint

Shortcut to the REST endpoint of node i.

communication_manager(i: int) 3.0.ipv8.attestation.communication_manager.CommunicationManager

Shortcut to the communication manager of node i.

async clear_pseudonyms() None

We set up our tests with one pseudonym per peer by default: get rid of them.

async introduce_pseudonyms() None

Figure out the ephemeral communities of each node and introduce them to each other.

async test_list_pseudonyms_empty() None

Check that we do not start with any pseudonyms.

async test_list_schemas() None

Check that the endpoint reports the available schemas correctly.

async test_list_pseudonyms_one() None

Check that a loaded pseudonym is reported as such.

async test_list_pseudonyms_many() None

Check that all loaded pseudonyms are reported as such.

async test_list_public_key_one() None

Check that we retrieve the pseudonym public key correctly.

async test_list_public_key_many() None

Check that we retrieve the pseudonym public key correctly.

async test_list_peers() None

Check if peers are correctly listed.

async test_list_unload() None

Check if a pseudonym stops communicating on unload.

async test_list_credentials_empty() None

Check that we retrieve credentials correctly, if none exist.

async test_request_attestation() None

Check that requesting an attestation works.

async test_request_attestation_metadata() None

Check that requesting an attestation with metadata works.

async test_attest() None

Check that attesting to an attestation request with metadata works.

async test_verify() None

Check that verifying a credential works.

async test_disallow_verify() None

Check that no verification is performed, if not allowed.