#NEWLINE# def test_already_backlogged_router_not_backlogged( self ) : #NEWLINE# #INDENT# with mock . patch . object ( self . plugin , '_backlogged_routers' ) as m : #NEWLINE# #INDENT# back_log = set ( ) #NEWLINE# m . __contains__ . side_effect = ( lambda r_id : ( r_id in back_log ) ) #NEWLINE# m . add . side_effect = ( lambda r_id : back_log . add ( r_id ) ) #NEWLINE# with self . router ( ) as router : #NEWLINE# #INDENT# r = router [ 'router' ] #NEWLINE# self . assertIsNone ( r [ HOSTING_DEVICE_ATTR ] ) #NEWLINE# m . add . assert_called_once_with ( r [ 'id' ] ) #NEWLINE# r_after = self . _update ( 'routers' , r [ 'id' ] , { #NEWLINE# #INDENT# 'router' : { #NEWLINE# #INDENT# 'name' : 'routerA' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } ) [ 'router' ] #NEWLINE# self . assertEqual ( 'routerA' , m [ 'name' ] ) #NEWLINE# self . assertIsNone ( r_after [ HOSTING_DEVICE_ATTR ] ) #NEWLINE# m . add . assert_called_once_with ( r [ 'id' ] ) #NEWLINE# m . __contains__ . assert_has_calls ( [ mock . call ( r [ 'id' ] ) , mock . call ( r [ 'id' ] ) ] )