pulp_2_tests.tests.docker.api_v2.utils¶
Location: Pulp 2 Tests → Tests → pulp_2_tests.tests.docker.api_v2.utils
Utility functions for Docker API tests.
-
class
pulp_2_tests.tests.docker.api_v2.utils.
SyncPublishMixin
¶ Bases:
object
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:
- Create a repository and schedule it for deletion.
- Sync and publish the repository.
- Make Crane immediately re-read the metadata files published by Pulp. (Restart Apache)
Parameters: - cfg – 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.
Returns: 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)
However:
- 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 – Information about a Pulp deployment. Returns: An API client for talking with Crane. - The client’s base URL is adjusted as described by
-
static
-
pulp_2_tests.tests.docker.api_v2.utils.
gen_distributor
(**kwargs)¶ Return a semi-random dict for use in creating a Docker distributor.
-
pulp_2_tests.tests.docker.api_v2.utils.
gen_repo
(**kwargs)¶ Return a semi-random dict that used for creating a Docker repo.