forked from pulp/pulp-certguard
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update tests based on publication path change
ref #4720 https://pulp.plan.io/issues/4720 Required PR: pulp/pulpcore-plugin#93 Required PR: https://github.com/pulp/pulpcore/pull/103/files Required PR: pulp/pulp_file#207 Required PR: pulp/pulp-openapi-generator#3
- Loading branch information
David Davis
committed
Apr 26, 2019
1 parent
811e80c
commit 0abc737
Showing
3 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,33 @@ | ||
"""Utilities for tests for the certguard plugin.""" | ||
from pulp_smash import api | ||
|
||
from pulp_file.tests.functional.utils import ( # noqa:F401 | ||
gen_file_publisher, gen_file_remote, get_file_content_paths | ||
) | ||
|
||
from pulp_certguard.tests.functional.constants import FILE_PUBLICATION_PATH | ||
|
||
|
||
def publish(cfg, repo, version_href=None, publisher=None): | ||
"""Publish a file repository. | ||
:param pulp_smash.config.PulpSmashConfig cfg: Information about the Pulp | ||
host. | ||
:param repo: A dict of information about the repository. | ||
:param version_href: A href for the repo version to be published. | ||
:param publisher: A dict of publisher info to use to publish. | ||
:returns: A publication. A dict of information about the just created | ||
publication. | ||
""" | ||
if version_href: | ||
body = {"repository_version": version_href} | ||
else: | ||
body = {"repository": repo["_href"]} | ||
|
||
if publisher: | ||
body['publisher'] = publisher['_href'] | ||
|
||
client = api.Client(cfg, api.json_handler) | ||
call_report = client.post(FILE_PUBLICATION_PATH, body) | ||
tasks = tuple(api.poll_spawned_tasks(cfg, call_report)) | ||
return client.get(tasks[-1]["created_resources"][0]) |