diff --git a/tenable/io/agent_groups.py b/tenable/io/agent_groups.py index a17553930..9f89378ac 100644 --- a/tenable/io/agent_groups.py +++ b/tenable/io/agent_groups.py @@ -207,6 +207,15 @@ def delete_agent(self, group_id, *agent_ids, **kw): json={'items': [self._check('agent_ids', i, int) for i in agent_ids]}, ).json() + def delete_agents(self, group_id, *agent_ids, **kw): + """ + Delete one or many agents from an agent group. + + This plural alias matches the naming used by the other agent-group + operations while preserving the existing :meth:`delete_agent` API. + """ + return self.delete_agent(group_id, *agent_ids, **kw) + def details(self, group_id, *filters, **kw): """ Retrieve the details about the specified agent group. diff --git a/tests/io/test_agent_groups.py b/tests/io/test_agent_groups.py index d8c2d5653..8f1c2b33d 100644 --- a/tests/io/test_agent_groups.py +++ b/tests/io/test_agent_groups.py @@ -3,6 +3,7 @@ ''' import time import uuid +from unittest.mock import patch import pytest @@ -259,6 +260,18 @@ def test_agentgroups_delete_agent_from_group_scanner_id_typeerror(api): api.agent_groups.delete_agent(1, 1, scanner_id='nope') +def test_agentgroups_delete_agents_alias(api): + """ + The plural spelling should preserve the existing delete-agent behavior. + """ + agent_groups = api.agent_groups + with patch.object(agent_groups, 'delete_agent', return_value={'task_id': 'task'}) as delete_agent: + result = agent_groups.delete_agents(42, 10, 11, scanner_id=7) + + assert result == {'task_id': 'task'} + delete_agent.assert_called_once_with(42, 10, 11, scanner_id=7) + + @pytest.mark.vcr() def test_agentgroups_delete_agent_from_group_notfounderror(api): '''