#NEWLINE# @ mock . patch ( 'neutron.db.l3_hamode_db.MAX_ALLOCATION_TRIES' , new = 2 ) #NEWLINE# def test_vr_id_allocation_contraint_conflict( self ) : #NEWLINE# #INDENT# router = self . _create_router ( ) #NEWLINE# network = self . plugin . get_ha_network ( self . admin_ctx , router [ 'tenant_id' ] ) #NEWLINE# with mock . patch . object ( self . plugin , '_get_allocated_vr_id' , return_value = set ( ) ) as alloc : #NEWLINE# #INDENT# self . assertRaises ( l3_ext_ha_mode . MaxVRIDAllocationTriesReached , self . plugin . _allocate_vr_id , self . admin_ctx , router . network_id , router [ 'id' ] ) #NEWLINE# self . assertEqual ( 2 , len ( alloc . mock_calls ) )