コード例 #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()
コード例 #2
0
  def test_telnetrmq_before_execute(self, mocked):
    """ Test that the call to before_execute call superclass before_execute"""
    agentconf={}
    telnetconf={"host":"telnet.lan"}
    rmqconf={"host":"rmq.lan"}
    agent=TelnetRmqAgent(agentconf, telnetconf, rmqconf)

    #Setup generic mock for others methos wich are not tested here
    ignoredmocks=Mock()
    agent.telnetclient=ignoredmocks
    agent.rmqclient=ignoredmocks
    

    instance = mocked.return_value 
    agent.before_execute()
    mocked.assert_called_with(agent)