def test_touch_bucket(self): """ Ensures that the last_accessed field of the affected k-bucket isi updated appropriately. """ parent_node_id = 'deadbeef' 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_bucket('abc') self.assertNotEqual(0, r._buckets[0].last_accessed)