#NEWLINE# @ mock . patch ( 'nova.console.serial.release_port' ) #NEWLINE# def test_stop_handler( self , mock_release_port ) : #NEWLINE# #INDENT# mock_serial_proxy = mock . Mock ( ) #NEWLINE# mock_workers = [ mock_serial_proxy , mock . Mock ( ) ] #NEWLINE# self . _consolehandler . _serial_proxy = mock_serial_proxy #NEWLINE# self . _consolehandler . _listen_host = mock . sentinel . host #NEWLINE# self . _consolehandler . _listen_port = mock . sentinel . port #NEWLINE# self . _consolehandler . _workers = mock_workers #NEWLINE# self . _consolehandler . stop ( ) #NEWLINE# mock_release_port . assert_called_once_with ( mock . sentinel . host , mock . sentinel . port ) #NEWLINE# for worker in mock_workers : #NEWLINE# #INDENT# worker . stop . assert_called_once_with ( )