#NEWLINE# def test_channel_pool_release( self ) : #NEWLINE# #INDENT# ncm = Mock ( ) #NEWLINE# ncm . return_value = Mock ( spec = BidirClientChannel ) #NEWLINE# ncm . return_value . _queue_auto_delete = False #NEWLINE# ncm . return_value . get_channel_id . return_value = sentinel . chid #NEWLINE# with patch ( 'pyon.net.messaging.NodeB._new_channel' , ch2 ) : #NEWLINE# #INDENT# ch = self . _node . channel ( BidirClientChannel ) #NEWLINE# #UNINDENT# ncm . return_value = Mock ( spec = BidirClientChannel ) #NEWLINE# ncm . return_value . _queue_auto_delete = False #NEWLINE# ncm . return_value . get_channel_id . return_value = sentinel . chid2 #NEWLINE# with patch ( 'pyon.net.messaging.NodeB._new_channel' , ncm ) : #NEWLINE# #INDENT# ch2 = self . _node . channel ( BidirClientChannel ) #NEWLINE# #UNINDENT# self . assertEquals ( ch . get_channel_id ( ) , sentinel . chid ) #NEWLINE# self . assertEquals ( ch2 . get_channel_id ( ) , sentinel . chid2 ) #NEWLINE# with patch ( 'pyon.net.messaging.log' ) : #NEWLINE# #INDENT# self . _node . on_channel_request_close ( ch ) #NEWLINE# #UNINDENT# self . assertEquals ( len ( self . _node . _bidir_pool ) , 2 ) #NEWLINE# self . assertEquals ( len ( self . _node . _pool_map ) , 1 ) #NEWLINE# self . assertIn ( sentinel . chid2 , self . _node . _pool_map )