#NEWLINE# @ mock . patch ( 'oppy.circuit.circuitmanager.PendingStream' , autospec = True ) #NEWLINE# def test_assignPossiblePendingRequests_none( self , mock_pending_stream ) : #NEWLINE# #INDENT# mock_request = mock . Mock ( ) #NEWLINE# mock_deferred = mock . Mock ( ) #NEWLINE# mock_pending_stream . stream . request = mock_request #NEWLINE# mock_pending_stream . deferred = mock_deferred #NEWLINE# mock_circuit = mock . Mock ( ) #NEWLINE# mock_circuit . canHandleRequest = mock . Mock ( ) #NEWLINE# mock_circuit . canHandleRequest . return_value = False #NEWLINE# self . cm . _pending_stream_list = [ mock_pending_stream ] #NEWLINE# self . cm . _assignPossiblePendingRequestsToCircuit ( mock_circuit ) #NEWLINE# mock_circuit . canHandleRequest . assert_called_once_with ( mock_request ) #NEWLINE# self . assertEqual ( mock_deferred . callback . call_count , 0 ) #NEWLINE# self . assertTrue ( ( mock_pending_stream in self . cm . _pending_stream_list ) ) #NEWLINE# self . assertEqual ( len ( self . cm . _pending_stream_list ) , 1 )