#NEWLINE# def test__allocate_specific_ip_raises_exception( self ) : #NEWLINE# #INDENT# cidr = '10.0.0.0/24' #NEWLINE# ip = '10.0.0.15' #NEWLINE# ipam_subnet = self . _create_and_allocate_ipam_subnet ( cidr ) [ 0 ] #NEWLINE# ipam_subnet . subnet_manager = mock . Mock ( ) #NEWLINE# ipam_subnet . subnet_manager . list_ranges_by_subnet_id . return_value = [ { #NEWLINE# #INDENT# 'first_ip' : '10.0.0.15' , #NEWLINE# 'last_ip' : '10.0.0.15' , #NEWLINE# #UNINDENT# } ] #NEWLINE# ipam_subnet . subnet_manager . delete_range . return_value = 0 #NEWLINE# @ ndb_api . retry_db_errors #NEWLINE# def go( ) : #NEWLINE# #INDENT# ipam_subnet . _allocate_specific_ip ( self . ctx . session , ip ) #NEWLINE# #UNINDENT# self . assertRaises ( ipam_exc . IPAllocationFailed , go )