3.0.ipv8.test.dht.test_routing ============================== .. py:module:: 3.0.ipv8.test.dht.test_routing Classes ------- .. autoapisummary:: 3.0.ipv8.test.dht.test_routing.FakeNode 3.0.ipv8.test.dht.test_routing.TestNode 3.0.ipv8.test.dht.test_routing.TestBucket 3.0.ipv8.test.dht.test_routing.TestRoutingTable Module Contents --------------- .. py:class:: FakeNode(binary_prefix: str) Bases: :py:obj:`3.0.ipv8.dht.routing.Node` A fake node. .. py:attribute:: _id .. py:property:: id :type: bytes Our fixed testing id. .. py:property:: status :type: int Always return a good status. .. py:class:: TestNode(methodName: str = 'runTest') Bases: :py:obj:`3.0.ipv8.test.base.TestBase` Tests related to the states of nodes. .. py:method:: setUp() -> None Create a single node. .. py:method:: test_init() -> None Check if the defaults values of nodes are properly initialized. .. py:method:: test_status() -> None Check if the status of nodes is correctly returned. .. py:method:: test_last_contact() -> None Check if the last contact property is properly derived from the last queries and last response. .. py:class:: TestBucket(methodName: str = 'runTest') Bases: :py:obj:`3.0.ipv8.test.base.TestBase` Tests related to Buckets. .. py:method:: setUp() -> None Create a single bucket with a prefix id of ``01`` and maximum size of 8. .. py:method:: test_owns() -> None Check if a Bucket correctly identifies that prefixes that it should "own". .. py:method:: test_get() -> None Check if nodes can be retrieved by their id. .. py:method:: test_add() -> None Check if adding a node to a bucket that it belongs to succeeds. .. py:method:: test_add_fail() -> None Check if adding a node to a bucket that it does not belong to fails. .. py:method:: test_add_update() -> None Check if nodes are merged together with their most recent data. .. py:method:: test_add_full() -> None Check if nodes are not added to an already-full bucket. .. py:method:: test_add_cleanup() -> None Check if nodes are not added to an already-full bucket, even if the existing nodes should be cleaned. .. py:method:: test_split() -> None Check if buckets properly split into other buckets. .. py:method:: test_split_not_full() -> None Check that non-full buckets do not allow splits. .. py:class:: TestRoutingTable(methodName: str = 'runTest') Bases: :py:obj:`3.0.ipv8.test.base.TestBase` Tests for routing tables. .. py:method:: setUp() -> None Create a routing table for a fake node with prefix 1111111111111111111111111111111111111111. .. py:method:: test_add_single_node() -> None Check that adding a node to the routing table inserts it into the trie. .. py:method:: test_add_multiple_nodes() -> None Check that adding multiple nodes causes them to be inserted into the trie. .. py:method:: test_add_node_with_bucket_split() -> None Check that overflowing the max size of a trie splits it. .. py:method:: test_add_node_full() -> None Check that a node is dropped if another node already serves its (max size) prefix. .. py:method:: test_closest_nodes_single_bucket() -> None Check if we can retrieve the closest nodes, in order, to a given id. .. py:method:: test_closest_nodes_multiple_buckets() -> None Check if we can retrieve the closest nodes, in order, to a given id after a trie split. .. py:method:: test_closest_nodes_no_nodes() -> None Check if we return False if no nodes are available as closest nodes.