def test_queue_delete(self, m_tags, m_delete, m_update): """ Ensure that queueing a delete task uses the proper tags. """ m_task_tags = [m_tags.resource_tag(), m_tags.resource_tag(), m_tags.action_tag()] dist = model.Distributor('rid', 'did', 'd_type_id', {}, False) result = distributor.queue_delete(dist) m_delete.apply_async_with_reservation.assert_called_once_with( m_tags.RESOURCE_REPOSITORY_TYPE, dist.repo_id, ['rid', 'did'], tags=m_task_tags) self.assertTrue(result is m_delete.apply_async_with_reservation.return_value)
def delete(self, request, repo_id, distributor_id): """ Disassociate the requested distributor. :param request: WSGI request object :type request: django.core.handlers.wsgi.WSGIRequest :param repo_id: The id of the repository the to disassociate from :type repo_id: basestring :param repo_id: The id of the distributor to disassociate :type repo_id: basestring :raises exceptions.OperationPostponed: dispatch a task """ dist = model.Distributor.objects.get_or_404(repo_id=repo_id, distributor_id=distributor_id) async_result = dist_controller.queue_delete(dist) raise exceptions.OperationPostponed(async_result)