def test_find_target_guest_id_greater_than_count(self): uid_maps = [(500, 10000, 10)] # Below range actual_target = idmapshift.find_target_id(499, uid_maps, idmapshift.NOBODY_ID, dict()) self.assertEqual(idmapshift.NOBODY_ID, actual_target) # Match actual_target = idmapshift.find_target_id(501, uid_maps, idmapshift.NOBODY_ID, dict()) self.assertEqual(10001, actual_target) # Beyond range actual_target = idmapshift.find_target_id(510, uid_maps, idmapshift.NOBODY_ID, dict()) self.assertEqual(idmapshift.NOBODY_ID, actual_target)
def test_find_target_id_updates_memo(self): memo = dict() idmapshift.find_target_id(0, self.uid_maps, idmapshift.NOBODY_ID, memo) self.assertIn(0, memo) self.assertEqual(10000, memo[0])
def test_find_target_id_no_mappings(self): actual_target = idmapshift.find_target_id(0, [], idmapshift.NOBODY_ID, dict()) self.assertEqual(idmapshift.NOBODY_ID, actual_target)
def test_find_target_id_outside_range(self): actual_target = idmapshift.find_target_id(10000, self.uid_maps, idmapshift.NOBODY_ID, dict()) self.assertEqual(idmapshift.NOBODY_ID, actual_target)
def test_find_target_id_range_2_first(self): actual_target = idmapshift.find_target_id(10, self.uid_maps, idmapshift.NOBODY_ID, dict()) self.assertEqual(20000, actual_target)
def test_find_target_id_inside_range_1(self): actual_target = idmapshift.find_target_id(2, self.uid_maps, idmapshift.NOBODY_ID, dict()) self.assertEqual(10002, actual_target)