Example #1
0
 def setUpClass(cls):
     """Create class-wide variables."""
     cls.cfg = config.get_config()
     cls.client = gen_python_client()
     configuration = Configuration()
     configuration.username = '******'
     configuration.password = '******'
     configuration.host = 'http://{}:24817'.format(socket.gethostname())
     configuration.safe_chars_for_path_param = '/'
     cls.core_client = CoreApiClient(configuration)
Example #2
0
    def setUpClass(cls):
        """
        Create all the client instances needed to communicate with Pulp.
        """
        configuration = Configuration()
        configuration.username = '******'
        configuration.password = '******'
        configuration.host = 'http://pulp'
        configuration.safe_chars_for_path_param = '/'

        core_client = CoreApiClient(configuration)
        file_client = FileApiClient(configuration)
        migration_client = MigrationApiClient(configuration)

        # Create api clients for all resource types
        cls.file_repo_api = RepositoriesFileApi(file_client)
        cls.file_repo_versions_api = RepositoriesFileVersionsApi(file_client)
        cls.file_content_api = ContentFilesApi(file_client)
        cls.tasks_api = TasksApi(core_client)
        cls.migration_plans_api = MigrationPlansApi(migration_client)
Example #3
0
                                        content_range=content_range)
            offset += chunk_size
            sha256hasher.update(chunk)

        commit_response = uploads.commit(
            upload.pulp_href, UploadCommit(sha256=sha256hasher.hexdigest())
        )
        created_resources = monitor_task(commit_response.task)
        artifact = artifacts.read(created_resources[0])

    return artifact


# Configure HTTP basic authorization: basic
configuration = Configuration()
configuration.username = '******'
configuration.password = '******'
configuration.safe_chars_for_path_param = '/'

core_client = CoreApiClient(configuration)
file_client = FileApiClient(configuration)

# Create api clients for all resource types
artifacts = ArtifactsApi(core_client)
repositories = RepositoriesApi(core_client)
repoversions = RepositoriesVersionsApi(core_client)
filecontent = ContentFilesApi(file_client)
filedistributions = DistributionsFileApi(core_client)
filepublications = PublicationsFileApi(file_client)
fileremotes = RemotesFileApi(file_client)
tasks = TasksApi(core_client)
Example #4
0
# coding=utf-8
"""Utilities for Pulpcore tests."""
from functools import partial
from time import sleep
from unittest import SkipTest

from pulp_smash import selectors
from pulp_smash.pulp3.utils import require_pulp_3, require_pulp_plugins
from pulpcore.client.pulpcore import (
    ApiClient,
    Configuration,
    TaskGroupsApi,
)

configuration = Configuration()
configuration.username = "******"
configuration.password = "******"
configuration.safe_chars_for_path_param = "/"


def set_up_module():
    """Skip tests Pulp 3 isn't under test or if pulpcore isn't installed."""
    require_pulp_3(SkipTest)
    require_pulp_plugins({"pulpcore"}, SkipTest)


skip_if = partial(selectors.skip_if, exc=SkipTest)  # pylint:disable=invalid-name
"""The ``@skip_if`` decorator, customized for unittest.

:func:`pulp_smash.selectors.skip_if` is test runner agnostic. This function is
identical, except that ``exc`` has been set to ``unittest.SkipTest``.