#NEWLINE# @ mock . patch ( 'oppy.stream.stream.Stream' , autospec = True ) #NEWLINE# def test_getOpenCircuit_no_circuit( self , mock_stream ) : #NEWLINE# #INDENT# r = mock . Mock ( ) #NEWLINE# mock_stream . request = r #NEWLINE# self . cm . _getOpenCandidates = mock . Mock ( ) #NEWLINE# self . cm . _getOpenCandidates . return_value = [ ] #NEWLINE# self . cm . _getPendingCandidates = mock . Mock ( ) #NEWLINE# self . cm . _getPendingCandidates . return_value = [ ] #NEWLINE# self . cm . _buildCircuit = mock . Mock ( ) #NEWLINE# self . cm . _pending_stream_list = [ ] #NEWLINE# _ = self . cm . getOpenCircuit ( mock_stream ) #NEWLINE# self . cm . _getOpenCandidates . assert_called_once_with ( r ) #NEWLINE# self . cm . _getPendingCandidates . assert_called_once_with ( r ) #NEWLINE# self . assertEqual ( self . cm . _buildCircuit . call_count , 1 ) #NEWLINE# self . assertEqual ( len ( self . cm . _pending_stream_list ) , 1 )