Exemplo n.º 1
0
 def test_touch_kbucket(self):
     """
     Ensures that the lastAccessed field of the affected k-bucket is updated
     appropriately.
     """
     parent_node_id = 'abc'
     r = RoutingTable(parent_node_id)
     # At this point the single k-bucket in the routing table will have a
     # lastAccessed time of 0 (zero). Sanity check.
     self.assertEqual(0, r._buckets[0].last_accessed)
     # Since all keys are in the range of the single k-bucket any key will
     # do for the purposes of testing.
     r.touch_kbucket('xyz')
     self.assertNotEqual(0, r._buckets[0].last_accessed)