3.0.ipv8.test.test_community ============================ .. py:module:: 3.0.ipv8.test.test_community Classes ------- .. autoapisummary:: 3.0.ipv8.test.test_community.OldCommunity 3.0.ipv8.test.test_community.NewCommunity 3.0.ipv8.test.test_community.TestCommunityCompatibility 3.0.ipv8.test.test_community.NoIDCommunity 3.0.ipv8.test.test_community.StrangeIDCommunity 3.0.ipv8.test.test_community.TestCommunityInit 3.0.ipv8.test.test_community.TestCommunityBootstrapping Module Contents --------------- .. py:class:: OldCommunity(settings: CommunitySettings) Bases: :py:obj:`3.0.ipv8.community.Community` Old-style community that does not support new-style introduction requests. .. py:attribute:: community_id .. py:method:: create_introduction_request(socket_address: 3.0.ipv8.types.Address, extra_bytes: bytes = b'', new_style: bool = False, prefix: bytes | None = None) -> bytes Make sure all sent introduction requests are flagged as old style. .. py:method:: create_introduction_response(lan_socket_address: 3.0.ipv8.types.Address, socket_address: 3.0.ipv8.types.Address, identifier: int, introduction: 3.0.ipv8.peer.Peer | None = None, extra_bytes: bytes = b'', prefix: bytes | None = None, new_style: bool = False) -> bytes Make sure all sent introduction responses are flagged as old style. .. py:method:: create_puncture(lan_walker: 3.0.ipv8.types.Address, wan_walker: 3.0.ipv8.types.Address, identifier: int, new_style: bool = False) -> bytes Make sure all sent punctures are flagged as old style. .. py:method:: create_puncture_request(lan_walker: 3.0.ipv8.types.Address, wan_walker: 3.0.ipv8.types.Address, identifier: int, prefix: bytes | None = None, new_style: bool = False) -> bytes Make sure all sent puncture requests are flagged as old style. .. py:class:: NewCommunity(settings: CommunitySettings) Bases: :py:obj:`3.0.ipv8.community.Community` A new-style supporting community. .. py:attribute:: community_id .. py:class:: TestCommunityCompatibility Bases: :py:obj:`3.0.ipv8.test.base.TestBase` Tests for interoperability between old-style and new-style IPv8 Communities. .. py:method:: setUp() -> None Create two nodes that have a new-style and old-style community. .. py:method:: make_nodes() -> None Create the actual two nodes. .. py:method:: endpoint_listener(i: int) -> 3.0.ipv8.test.mocking.endpoint.MockEndpointListener Shortcut to the endpoint listener of node i. .. py:method:: received_message_ids(i: int) -> list[int] List the message ids received by node i. .. py:method:: walk_from_to(from_i: int, to_i: int) -> None :async: Send an introduction request from one node id to another node id. .. py:method:: test_introduce_old() -> None :async: Check that no new-style messages are going to the old-style peer. .. py:class:: NoIDCommunity(settings: CommunitySettings) Bases: :py:obj:`3.0.ipv8.community.Community` Faulty community that has no id specified. .. py:class:: StrangeIDCommunity(settings: CommunitySettings) Bases: :py:obj:`3.0.ipv8.community.Community` Faulty community that has a wrong community id type. .. py:attribute:: community_id .. py:class:: TestCommunityInit Bases: :py:obj:`3.0.ipv8.test.base.TestBase` Tests for initializing new Communities. - A test for a Community with a valid id is omitted as this is already covered by other tests. .. py:method:: test_init_no_id() -> None :async: Check that attempting to create a Community without an id raises an error. .. py:method:: test_init_strange_id() -> None :async: Check that attempting to create a Community with an id that is not ```bytes`` raises an error. .. py:class:: TestCommunityBootstrapping Bases: :py:obj:`3.0.ipv8.test.base.TestBase` Tests for the Community to Bootstrapper interface. Note: don't put tests for the Bootstrapper implementations here. .. py:method:: test_empty_bootstrap() -> None :async: Check if unloading a Community after waiting for bootstrapping results exits cleanly. .. py:method:: test_cancel_bootstrap() -> None :async: Check if unloading a Community while waiting for bootstrapping results exits cleanly.