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.
- class 2.12.ipv8.test.test_loader.MockWalk2(overlay: _OT)
Bases:
2.12.ipv8.peerdiscovery.discovery.DiscoveryStrategy
Empty walker.
- 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.
- 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.
- 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.StagedCommunityLauncher
Bases:
2.12.ipv8.loader.CommunityLauncher
Community launcher with some fake data.
- 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.
- 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_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.
- class 2.12.ipv8.test.test_loader.TestCommunityLoader(methodName: str = 'runTest')
Bases:
2.12.ipv8.test.base.TestBase
Tests related to the community loader.