def test_logoff_agent(self, AgentdClient):
        AgentdClient.return_value = self.agentd_client

        agent.logoff_agent(self.agi, self.agent_id)

        AgentdClient.assert_called_once_with(**self.agentd_config)
        self.agentd_client.agents.logoff_agent.assert_called_once_with(self.agent_id)
def agent_logoff(agi, cursor, args):
    try:
        agent_id = int(args[0])

        agent.logoff_agent(agi, agent_id)
    except Exception as e:
        logger.exception("Error while logging off agent")
        agi.dp_break(e)
    def test_logoff_agent_on_not_logged(self, AgentdClient):
        AgentdClient.return_value = self.agentd_client
        self.agentd_client.agents.logoff_agent.side_effect = AgentdClientError(error.NOT_LOGGED)

        agent.logoff_agent(self.agi, self.agent_id)