Location: Pulp SmashAPI Documentationpulp_smash.tests.pulp2.docker.api_v2.utils

Utility functions for Docker API tests.

class pulp_smash.tests.pulp2.docker.api_v2.utils.SyncPublishMixin

Tools for test cases that sync and publish Docker repositories.

This class must be mixed in to a class that inherits from unittest.TestCase.

static adjust_url(url)

Return a URL that can be used for talking with Crane.

The URL returned is the same as url, except that the scheme is set to HTTP, and the port is set to (or replaced by) 5000.

Parameters:url – A string, such as https://pulp.example.com/foo.
Returns:A string, such as http://pulp.example.com:5000/foo.
create_sync_publish_repo(cfg, importer_config, distributors=None)

Create, sync and publish a repository.

Specifically do the following:

  1. Create a repository and schedule it for deletion.
  2. Sync and publish the repository.
  3. Make Crane immediately re-read the metadata files published by Pulp. (Restart Apache)
  • cfg (pulp_smash.config.PulpSmashConfig) – Information about a Pulp deployment.
  • importer_config – An importer configuration to pass when creating the repository. For example: {'feed': '…'}.
  • distributors – Distributor configurations to pass when creating the repository. If no value is passed, one will be generated.

A detailed dict of information about the repository.

static make_crane_client(cfg)

Make an API client for talking with Crane.

Create an API client for talking to Crane. The client returned by this method is similar to the following client:

>>> client = api.Client(cfg, api.json_handler)


  • The client’s base URL is adjusted as described by adjust_url().
  • The client will send an accept:application/json header with each request.
Parameters:cfg (pulp_smash.config.PulpSmashConfig) – Information about a Pulp deployment.
Returns:An API client for talking with Crane.
Return type:pulp_smash.api.Client

Return a semi-random dict for use in creating a Docker distributor.


Return a semi-random dict that used for creating a Docker repo.