2.12.ipv8.test.test_loader

Module Contents

Classes

class 2.12.ipv8.test.test_loader.MockCommunity(settings: 2.12.ipv8.community.CommunitySettings)

Bases: 2.12.ipv8.community.Community

Empty community implementation.

class 2.12.ipv8.test.test_loader.MockWalk(community: MockCommunity, some_attribute: int)

Bases: 2.12.ipv8.peerdiscovery.discovery.DiscoveryStrategy

Empty walker with an init parameter.

take_step() None

Do nothing.

class 2.12.ipv8.test.test_loader.MockWalk2(overlay: _OT)

Bases: 2.12.ipv8.peerdiscovery.discovery.DiscoveryStrategy

Empty walker.

take_step() None

Do nothing.

class 2.12.ipv8.test.test_loader.MockBootstrapper(some_attribute: int)

Bases: 2.12.ipv8.bootstrapping.bootstrapper_interface.Bootstrapper

Empty bootstrapper with an init parameter.

async initialize(overlay: 2.12.ipv8.community.Community) None

Initialize nothing.

async get_addresses(overlay: 2.12.ipv8.community.Community, timeout: float) Iterable[2.12.ipv8.types.Address]

Return no addresses.

keep_alive(overlay: 2.12.ipv8.community.Community) None

Ping nothing.

blacklist() Iterable[2.12.ipv8.types.Address]

Return no blacklist.

unload() None

Unload nothing.

class 2.12.ipv8.test.test_loader.MockBootstrapper2

Bases: 2.12.ipv8.bootstrapping.bootstrapper_interface.Bootstrapper

Empty bootstrapper.

async initialize(overlay: 2.12.ipv8.community.Community) None

Initialize nothing.

async get_addresses(overlay: 2.12.ipv8.community.Community, timeout: float) Iterable[2.12.ipv8.types.Address]

Return no addresses.

keep_alive(overlay: 2.12.ipv8.community.Community) None

Ping nothing.

blacklist() Iterable[2.12.ipv8.types.Address]

Return no blacklist.

unload() None

Unload nothing.

class 2.12.ipv8.test.test_loader.MockSession

Fake session object.

launch_condition1 = True
launch_condition2 = False
some_attribute1 = 'I am a string :)'
some_attribute2 = 1337
community
class 2.12.ipv8.test.test_loader.MockOverlayProvider

Fake overlay provider.

endpoint
network
class 2.12.ipv8.test.test_loader.StagedCommunityLauncher

Bases: 2.12.ipv8.loader.CommunityLauncher

Community launcher with some fake data.

not_before() list[str]

Should wait for CommunityLauncher1 and CommunityLauncher2.

should_launch(session: MockSession) bool

Pull the launch conditions from our session.

get_overlay_class() type[MockCommunity]

We run on the MockCommunity.

get_kwargs(session: MockSession) dict[str, Any]

The keyword args to launch our community with.

get_walk_strategies() list[tuple[type[2.12.ipv8.peerdiscovery.discovery.DiscoveryStrategy], dict, int]]

Get our walkers.

get_bootstrappers(session: MockSession) list[tuple[type[2.12.ipv8.bootstrapping.bootstrapper_interface.Bootstrapper], dict]]

Get the bootstrappers for our community.

finalize(ipv8: 2.12.ipv8.types.IPv8, session: MockSession, community: MockCommunity) None

Finish off our launching procedure.

class 2.12.ipv8.test.test_loader.TestCommunityLauncher(methodName: str = 'runTest')

Bases: 2.12.ipv8.test.base.TestBase

Tests related to the community launcher.

setUp() None

Create a staged launcher to run tests with.

test_not_before_list() None

Check that the not_before decorator with multiple arguments equals the not_before() definition.

test_not_before_multiple() None

Check that multiple not_before decorators with an argument equals the not_before() definition.

test_should_launch_single() None

Check that a validated single launch condition causes should_launch() to return True.

test_shouldnt_launch_single() None

Check that an invalid single launch condition causes should_launch() to return False.

test_should_launch_multiple() None

Check that a validated multiple launch conditions causes should_launch() to return True.

test_shouldnt_launch_multiple() None

Check that an invalid condition for multiple launch conditions causes should_launch() to return False.

test_overlay_class_from_str() None

Check if a Community string specification can be lazy-loaded through the overlay_class decorator.

test_overlay_class_from_class() None

Check if a Community class can be lazy-loaded through the overlay_class decorator.

test_overlay_class_from_function() None

Check if a Community class (functional representation) can be lazy-loaded through the overlay_class decorator.

test_walk_strategy_from_str() None

Check if adding a walk strategy string specification is successful.

test_walk_strategy_from_class() None

Check if adding a walk strategy from a DiscoveryStrategy class is successful.

test_walk_strategy_from_function() None

Check if adding a walk strategy from a function is successful.

test_walk_strategy_multiple() None

Check if adding multiple walk strategies is successful.

test_bootstrapper_from_str() None

Check if adding a bootstrapper string specification is successful.

test_bootstrapper_from_class() None

Check if adding a bootstrapper from a Bootstrapper class is successful.

test_bootstrapper_from_function() None

Check if adding a bootstrapper from a function is successful.

test_bootstrapper_multiple() None

Check if adding multiple bootstrappers is successful.

test_set_in_session() None

Check if set_in_session correctly sets the attribute of the session.

test_kwargs() None

Check if the kwargs decorator correctly passes keyword arguments.

test_name() None

Check if the name of a launcher can be set, using the name decorator.

test_no_name() None

Check if the name of a launcher is equal to the Community class name by default.

class 2.12.ipv8.test.test_loader.TestCommunityLoader(methodName: str = 'runTest')

Bases: 2.12.ipv8.test.base.TestBase

Tests related to the community loader.

setUp() None

Create a loader and a community provider to test with.

test_load_community() None

Check if a CommunityLauncher is launched correctly.

test_protect_infinite_loop() None

Check if the CommunityLoader raises an error when it encounters a circular dependency.