#NEWLINE# def test_router_ha_update_allocating_then_active( self ) : #NEWLINE# #INDENT# router = self . _create_router ( ) #NEWLINE# _orig = self . plugin . _delete_ha_interfaces #NEWLINE# def check_state( context , router_id ) : #NEWLINE# #INDENT# self . assertEqual ( n_const . ROUTER_STATUS_ALLOCATING , self . plugin . _get_router ( context , router_id ) [ 'status' ] ) #NEWLINE# return _orig ( context , router_id ) #NEWLINE# #UNINDENT# with mock . patch . object ( self . plugin , '_delete_ha_interfaces' , side_effect = check_state ) as ha_mock : #NEWLINE# #INDENT# router = self . _migrate_router ( check_state [ 'id' ] , ha = False ) #NEWLINE# self . assertTrue ( ha_mock . called ) #NEWLINE# #UNINDENT# self . assertEqual ( n_const . ROUTER_STATUS_ACTIVE , router [ 'status' ] )