latest.ipv8.test.test_community

Module Contents

Classes

OldCommunity

Old-style community that does not support new-style introduction requests.

NewCommunity

A new-style supporting community.

TestCommunityCompatibility

Tests for interoperability between old-style and new-style IPv8 Communities.

NoIDCommunity

Faulty community that has no id specified.

StrangeIDCommunity

Faulty community that has a wrong community id type.

TestCommunityInit

Tests for initializing new Communities.

TestCommunityBootstrapping

Tests for the Community to Bootstrapper interface.

class latest.ipv8.test.test_community.OldCommunity(settings: CommunitySettings)

Bases: latest.ipv8.community.Community

Old-style community that does not support new-style introduction requests.

community_id
create_introduction_request(socket_address: latest.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.

create_introduction_response(lan_socket_address: latest.ipv8.types.Address, socket_address: latest.ipv8.types.Address, identifier: int, introduction: latest.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.

create_puncture(lan_walker: latest.ipv8.types.Address, wan_walker: latest.ipv8.types.Address, identifier: int, new_style: bool = False) bytes

Make sure all sent punctures are flagged as old style.

create_puncture_request(lan_walker: latest.ipv8.types.Address, wan_walker: latest.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.

class latest.ipv8.test.test_community.NewCommunity(settings: CommunitySettings)

Bases: latest.ipv8.community.Community

A new-style supporting community.

community_id
class latest.ipv8.test.test_community.TestCommunityCompatibility

Bases: latest.ipv8.test.base.TestBase

Tests for interoperability between old-style and new-style IPv8 Communities.

setUp() None

Create two nodes that have a new-style and old-style community.

make_nodes() None

Create the actual two nodes.

endpoint_listener(i: int) latest.ipv8.test.mocking.endpoint.MockEndpointListener

Shortcut to the endpoint listener of node i.

received_message_ids(i: int) list[int]

List the message ids received by node i.

async walk_from_to(from_i: int, to_i: int) None

Send an introduction request from one node id to another node id.

async test_introduce_old() None

Check that no new-style messages are going to the old-style peer.

class latest.ipv8.test.test_community.NoIDCommunity(settings: CommunitySettings)

Bases: latest.ipv8.community.Community

Faulty community that has no id specified.

class latest.ipv8.test.test_community.StrangeIDCommunity(settings: CommunitySettings)

Bases: latest.ipv8.community.Community

Faulty community that has a wrong community id type.

community_id
class latest.ipv8.test.test_community.TestCommunityInit

Bases: latest.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.

async test_init_no_id() None

Check that attempting to create a Community without an id raises an error.

async test_init_strange_id() None

Check that attempting to create a Community with an id that is not `bytes raises an error.

class latest.ipv8.test.test_community.TestCommunityBootstrapping

Bases: latest.ipv8.test.base.TestBase

Tests for the Community to Bootstrapper interface.

Note: don’t put tests for the Bootstrapper implementations here.

async test_empty_bootstrap() None

Check if unloading a Community after waiting for bootstrapping results exits cleanly.

async test_cancel_bootstrap() None

Check if unloading a Community while waiting for bootstrapping results exits cleanly.