#NEWLINE# def test_backlogged_router_is_scheduled_if_hosting_device_exists( self ) : #NEWLINE# #INDENT# with mock . patch . object ( self . plugin , '_backlogged_routers' ) as m1 , mock . patch . object ( self . plugin , '_refresh_router_backlog' , False ) : #NEWLINE# #INDENT# back_log = set ( ) #NEWLINE# m1 . __iter__ = ( lambda obj : iter ( copy . deepcopy ( back_log ) ) ) #NEWLINE# m1 . __contains__ = ( lambda obj , r_id : ( r_id in back_log ) ) #NEWLINE# m1 . add . side_effect = ( lambda r_id : back_log . add ( r_id ) ) #NEWLINE# m1 . discard . side_effect = ( lambda r_id : back_log . discard ( r_id ) ) #NEWLINE# arg_list = ( routertype . TYPE_ATTR , ) #NEWLINE# kwargs = { #NEWLINE# #INDENT# routertype . TYPE_ATTR : '00000000-0000-0000-0000-000000000006' , #NEWLINE# #UNINDENT# } #NEWLINE# router = self . _make_router ( self . fmt , _uuid ( ) , 'router1' , arg_list = arg_list , ** r ) #NEWLINE# r = router [ 'router' ] #NEWLINE# self . assertIsNone ( r [ HOSTING_DEVICE_ATTR ] ) #NEWLINE# m1 . add . assert_called_once_with ( r [ 'id' ] ) #NEWLINE# self . plugin . _process_backlogged_routers ( ) #NEWLINE# self . assertNotIn ( r [ 'id' ] , back_log )