3.0.ipv8.test.REST.test_identity_endpoint ========================================= .. py:module:: 3.0.ipv8.test.REST.test_identity_endpoint Classes ------- .. autoapisummary:: 3.0.ipv8.test.REST.test_identity_endpoint.MockPseudonymFolderManager 3.0.ipv8.test.REST.test_identity_endpoint.TestIdentityEndpoint Module Contents --------------- .. py:class:: MockPseudonymFolderManager Bases: :py:obj:`3.0.ipv8.attestation.communication_manager.PseudonymFolderManager` Mock the OS file system using a dictionary as to mock files in a folder. .. py:attribute:: folder_contents :type: dict[str, 3.0.ipv8.types.PrivateKey] .. py:method:: get_or_create_private_key(name: str) -> 3.0.ipv8.types.PrivateKey Generate or load a new key in memory. .. py:method:: remove_pseudonym_file(name: str) -> None Remove the given "folder" in the dictionary, i.e., a key. .. py:method:: list_pseudonym_files() -> list[str] Retrieve the "folders", i.e., keys, in the fake file structure. .. py:class:: TestIdentityEndpoint(methodName: str = 'runTest') Bases: :py:obj:`3.0.ipv8.test.base.TestBase`\ [\ :py:obj:`3.0.ipv8.attestation.identity.community.IdentityCommunity`\ ] Class for testing the REST API of the IdentityEndpoint. .. py:method:: setUp() -> None :async: Set up an identity community, memory identity manager and memory pseudonym folder manager. .. py:method:: 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. .. py:method:: rest_ep(i: int) -> 3.0.ipv8.REST.identity_endpoint.IdentityEndpoint Shortcut to the REST endpoint of node i. .. py:method:: communication_manager(i: int) -> 3.0.ipv8.attestation.communication_manager.CommunicationManager Shortcut to the communication manager of node i. .. py:method:: clear_pseudonyms() -> None :async: We set up our tests with one pseudonym per peer by default: get rid of them. .. py:method:: introduce_pseudonyms() -> None :async: Figure out the ephemeral communities of each node and introduce them to each other. .. py:method:: test_list_pseudonyms_empty() -> None :async: Check that we do not start with any pseudonyms. .. py:method:: test_list_schemas() -> None :async: Check that the endpoint reports the available schemas correctly. .. py:method:: test_list_pseudonyms_one() -> None :async: Check that a loaded pseudonym is reported as such. .. py:method:: test_list_pseudonyms_many() -> None :async: Check that all loaded pseudonyms are reported as such. .. py:method:: test_list_public_key_one() -> None :async: Check that we retrieve the pseudonym public key correctly. .. py:method:: test_list_public_key_many() -> None :async: Check that we retrieve the pseudonym public key correctly. .. py:method:: test_list_peers() -> None :async: Check if peers are correctly listed. .. py:method:: test_list_unload() -> None :async: Check if a pseudonym stops communicating on unload. .. py:method:: test_list_credentials_empty() -> None :async: Check that we retrieve credentials correctly, if none exist. .. py:method:: test_request_attestation() -> None :async: Check that requesting an attestation works. .. py:method:: test_request_attestation_metadata() -> None :async: Check that requesting an attestation with metadata works. .. py:method:: test_attest() -> None :async: Check that attesting to an attestation request with metadata works. .. py:method:: test_verify() -> None :async: Check that verifying a credential works. .. py:method:: test_disallow_verify() -> None :async: Check that no verification is performed, if not allowed.