コード例 #1
0
 def test_queue_download_repo(self, mock_download_repo, mock_tags):
     """Assert download_repo tasks are tagged correctly."""
     content_controller.queue_download_repo('fake-id')
     mock_tags.resource_tag.assert_called_once_with(
         mock_tags.RESOURCE_REPOSITORY_TYPE, 'fake-id')
     mock_tags.action_tag.assert_called_once_with(
         mock_tags.ACTION_DOWNLOAD_TYPE)
     mock_download_repo.apply_async.assert_called_once_with(
         ['fake-id'], {'verify_all_units': False},
         tags=[
             mock_tags.resource_tag.return_value,
             mock_tags.action_tag.return_value
         ])
コード例 #2
0
ファイル: test_content.py プロジェクト: maxamillion/pulp
 def test_queue_download_repo(self, mock_download_repo, mock_tags):
     """Assert download_repo tasks are tagged correctly."""
     content_controller.queue_download_repo('fake-id')
     mock_tags.resource_tag.assert_called_once_with(
         mock_tags.RESOURCE_REPOSITORY_TYPE,
         'fake-id'
     )
     mock_tags.action_tag.assert_called_once_with(mock_tags.ACTION_DOWNLOAD_TYPE)
     mock_download_repo.apply_async.assert_called_once_with(
         ['fake-id'],
         {'verify_all_units': False},
         tags=[mock_tags.resource_tag.return_value, mock_tags.action_tag.return_value]
     )
コード例 #3
0
    def post(self, request, repo_id):
        """
        Dispatch a task to publish a repository. The JSON body may contain a key,
        `verify_all_units`, that forces the task to attempt to download all content
        units again rather than just those known to be not downloaded.

        :param request: WSGI request object.
        :type  request: django.core.handlers.wsgi.WSGIRequest
        :param repo_id: id of the repository to publish.
        :type  repo_id: str

        :raises pulp_exceptions.MissingResource: if repo does not exist.
        :raises pulp_exceptions.OperationPostponed: dispatch a ``download_repo`` task.
        """
        model.Repository.objects.get_repo_or_missing_resource(repo_id)
        verify = request.body_as_json.get('verify_all_units', False)
        if not isinstance(verify, bool):
            raise exceptions.PulpCodedValidationException(
                error_code=exceptions.error_codes.PLP1010,
                value=verify,
                field='verify_all_units',
                field_type='boolean'
            )
        async_result = content_controller.queue_download_repo(repo_id, verify_all_units=verify)
        raise exceptions.OperationPostponed(async_result)