Skip to content

Commit

Permalink
Update tests based on publication path change
Browse files Browse the repository at this point in the history
  • Loading branch information
David Davis committed Apr 26, 2019
1 parent 811e80c commit 0abc737
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
6 changes: 3 additions & 3 deletions pulp_certguard/tests/functional/api/test_certguard.py
Expand Up @@ -10,7 +10,6 @@
download_content_unit,
gen_distribution,
gen_repo,
publish,
sync,
)
from pulp_certguard.tests.functional.constants import (
Expand All @@ -23,7 +22,8 @@
from pulp_certguard.tests.functional.utils import (
gen_file_publisher,
gen_file_remote,
get_file_content_paths
get_file_content_paths,
publish
)


Expand Down Expand Up @@ -86,7 +86,7 @@ def setUpClass(cls):
)

# 6. Create a publication
cls.publication = publish(cfg, cls.publisher, cls.repo)
cls.publication = publish(cfg, cls.repo, publisher=cls.publisher)
cls.teardown_cleanups.append(
(cls.client.delete, cls.publication['_href'])
)
Expand Down
6 changes: 5 additions & 1 deletion pulp_certguard/tests/functional/constants.py
Expand Up @@ -3,7 +3,11 @@
from urllib.parse import urljoin

from pulp_smash.pulp3.constants import BASE_PATH, BASE_CONTENT_GUARDS_PATH # noqa:F401
from pulp_file.tests.functional.constants import FILE_REMOTE_PATH, FILE_PUBLISHER_PATH # noqa:F401
from pulp_file.tests.functional.constants import ( # noqa:F401
FILE_REMOTE_PATH,
FILE_PUBLICATION_PATH,
FILE_PUBLISHER_PATH
)

_CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
CERTS_BASE_PATH = os.path.join(
Expand Down
29 changes: 29 additions & 0 deletions pulp_certguard/tests/functional/utils.py
@@ -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])

0 comments on commit 0abc737

Please sign in to comment.