def test_delete_queue(self, queue, add_connector): url = 'test-url' name = 'test-queue' # test agent = PulpAgent() agent.delete_queue(url, name) # validation add_connector.assert_called_once_with() queue.assert_called_once_with(name, url) queue.return_value.purge.assert_called_once_with() queue.return_value.delete.assert_called_once_with()
def test_delete_queue_not_found(self, queue, add_connector): url = 'test-url' name = 'test-queue' queue.return_value.purge.side_effect = NotFound # test agent = PulpAgent() agent.delete_queue(url, name) # validation add_connector.assert_called_once_with() queue.assert_called_once_with(name, url) queue.return_value.purge.assert_called_once_with() self.assertFalse(queue.delete.called)
def delete_queue(url, name, consumer_id): """ Delete the agent queue. :param url: The broker URL. :type url: str :param name: The queue name. :type name: str :param consumer_id: The consumer ID. :type consumer_id: str """ try: manager = managers.consumer_manager() manager.get_consumer(consumer_id) return # still registered (abort) except MissingResource: # expected pass agent = PulpAgent() agent.delete_queue(url, name)