コード例 #1
0
  def test_mpdrmq_after_execute_exception(self):
    """ Test that the call to after_execute call superclass after_execute"""
    agentconf={}
    telnetconf={"host":"telnet.lan"}
    rmqconf={"host":"rmq.lan"}
    agent=TelnetRmqAgent(agentconf, telnetconf, rmqconf)

    #Setup generic mock for others methods wich are not tested here
    ignoredmocks=Mock()
    agent.telnetclient=ignoredmocks
    agent.rmqclient=ignoredmocks
    
    agent.telnetclient.disconnect.side_effect=Exception("In your face")

    with self.assertRaises(TelnetRmqAgenException):
      agent.ensure_after_execute()