latest.ipv8.test.peerdiscovery.test_network
Module Contents
Classes
A peer observer that simply stores all added and removed peers. |
|
Tests related to the Network class. |
Functions
|
Generate a Peer with a real private key and a fake address. |
- latest.ipv8.test.peerdiscovery.test_network._generate_peer() latest.ipv8.peer.Peer
Generate a Peer with a real private key and a fake address.
- class latest.ipv8.test.peerdiscovery.test_network.MockPeerObserver
Bases:
latest.ipv8.peerdiscovery.network.PeerObserver
A peer observer that simply stores all added and removed peers.
- on_peer_added(peer: latest.ipv8.peer.Peer) None
Callback for when a peer is added.
- on_peer_removed(peer: latest.ipv8.peer.Peer) None
Callback for when a peer is removed.
- class latest.ipv8.test.peerdiscovery.test_network.TestNetwork(methodName: str = 'runTest')
Bases:
latest.ipv8.test.base.TestBase
Tests related to the Network class.
- peers
- serialized_ipv4_len = 7
- test_discover_address() None
Check registration of introducer and introduced when a new address is discovered.
The introducer should be verified and not walkable. The introduced should not be verified and walkable.
- test_discover_address_duplicate() None
Check registration of introducer and introduced when the same address is discovered twice.
- test_discover_address_known() None
Check if an address is already known, the network isn’t updated.
- test_discover_address_known_parent_deceased() None
Check if an address is already known, the new introducer adopts the introduced.
- test_discover_address_blacklist() None
Check if an address is in the blacklist, the network isn’t updated.
- test_get_introductions_from_cache_no_refresh() None
Cache entries in the introduction cache should not refresh.
This is to avoid dead peers sticking around the cache for too long.
- test_discover_services_unverified() None
Check if services are properly registered for an unverified peer.
- test_discover_services_update_overlap() None
Check if services are properly combined when discovered services overlap.
- test_add_verified_peer_duplicate() None
Check if an already verified (by slightly changed) peer doesn’t cause duplicates in the network.
- test_add_verified_peer_promote() None
Check if a peer can be promoted from an address to a verified peer.
- test_get_verified_by_address_cache_refresh() None
Asking for the same peer twice should land it back on top of the cleanup stack.
- test_get_verified_by_public_key() None
Check if we can find a peer in our network by its public key.
- test_remove_by_address_unverified() None
Check if we can remove an unverified peer from our network by its address.
- test_remove_by_address_no_services() None
Check if we can remove a peer from our network if it doesn’t have services by address.
- test_remove_peer_external() None
Check if we can remove an externally created peer from our network.
- test_get_walkable_by_service() None
Check if we can retrieve walkable addresses by parent service id.
- test_snapshot_verified_and_unverified() None
Check if a snapshot poperly serializes only verified peers.
- test_load_snapshot_truncated() None
Check if as many peers as possible are loaded from a truncated snapshot.
- test_cache_reconstruct() None
Check if services caches are reconstructed properly.
This test is based on https://github.com/Tribler/py-ipv8/issues/1131
- test_add_peer_observer() None
Check if an added observer becomes part of the registered observers.
- test_notify_peer_addition() None
Check if peer observers are notified of newly added peers, when adding verified peers normally.
- test_notify_peer_addition_discover() None
Check if peer observers are notified of newly added peers, when they aid in address discovery.
- test_notify_peer_addition_known_address() None
Check if peer observers are notified of newly added peers, with known addresses.
- test_notify_peer_removal() None
Check if peer observers are notified of removed peers, when removing verified peers normally.