Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.
/ pulp Public archive

Update tests after manifest field removed from remotes #3636

Merged
merged 1 commit into from
Sep 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 11 additions & 2 deletions pulpcore/tests/functional/api/using_plugin/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,33 @@
FILE_FIXTURE_URL = urljoin(PULP_FIXTURES_BASE_URL, 'file/')
"""The URL to a file repository."""

FILE_MANIFEST = 'PULP_MANIFEST'
"""Default name of a file manifest."""
FILE_FIXTURE_MANIFEST_URL = urljoin(FILE_FIXTURE_URL, 'PULP_MANIFEST')
"""The URL to a file repository manifest."""

FILE_FIXTURE_COUNT = 3
"""The number of packages available at :data:`FILE_FIXTURE_URL`."""

FILE2_FIXTURE_URL = urljoin(PULP_FIXTURES_BASE_URL, 'file2/')
"""The URL to a file repository."""

FILE2_FIXTURE_MANIFEST_URL = urljoin(FILE2_FIXTURE_URL, 'PULP_MANIFEST')
"""The URL to a file repository manifest"""

FILE_MANY_FIXTURE_URL = urljoin(PULP_FIXTURES_BASE_URL, 'file-many/')
"""The URL to a file repository containing many files."""

FILE_MANY_FIXTURE_MANIFEST_URL = urljoin(FILE_MANY_FIXTURE_URL, 'PULP_MANIFEST')
"""The URL to a file repository manifest"""

FILE_MANY_FIXTURE_COUNT = 250
"""The number of packages available at :data:`FILE_MANY_FIXTURE_URL`."""

FILE_LARGE_FIXTURE_URL = urljoin(PULP_FIXTURES_BASE_URL, 'file-large/')
"""The URL to a file repository containing a large number of files."""

FILE_LARGE_FIXTURE_MANIFEST_URL = urljoin(FILE_LARGE_FIXTURE_URL, 'PULP_MANIFEST')
"""The URL to a file repository manifest."""

FILE_URL = urljoin(FILE_FIXTURE_URL, '1.iso')
"""The URL to an ISO file at :data:`FILE_FIXTURE_URL`."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from pulp_smash.pulp3.utils import (
delete_orphans,
gen_distribution,
gen_remote,
gen_repo,
get_added_content,
get_versions,
Expand All @@ -19,17 +20,13 @@
)

from tests.functional.api.using_plugin.constants import (
FILE_FIXTURE_URL,
FILE_FIXTURE_MANIFEST_URL,
FILE_URL,
FILE_CONTENT_PATH,
FILE_PUBLISHER_PATH,
FILE_REMOTE_PATH
)
from tests.functional.api.using_plugin.utils import (
gen_file_publisher,
gen_file_remote,
populate_pulp
)
from tests.functional.api.using_plugin.utils import gen_file_publisher, populate_pulp
from tests.functional.api.using_plugin.utils import set_up_module as setUpModule # noqa:F401


Expand Down Expand Up @@ -181,7 +178,7 @@ def test_all(self):
# the new publication (because publisher and repository are unset).
remote = self.client.post(
FILE_REMOTE_PATH,
gen_file_remote(FILE_FIXTURE_URL),
gen_remote(FILE_FIXTURE_MANIFEST_URL),
)
self.addCleanup(self.client.delete, remote['_href'])

Expand Down
4 changes: 2 additions & 2 deletions pulpcore/tests/functional/api/using_plugin/test_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from tests.functional.api.using_plugin.constants import (
FILE_MANY_FIXTURE_COUNT,
FILE_MANY_FIXTURE_URL,
FILE_MANY_FIXTURE_MANIFEST_URL,
FILE_CONTENT_PATH
)
from tests.functional.api.using_plugin.utils import populate_pulp
Expand Down Expand Up @@ -87,7 +87,7 @@ def test_content(self):
# sample 21 contents, because with page_size set to 10, this produces 3
# pages, where the three three pages have unique combinations of values
# for the "previous" and "next" links.
populate_pulp(self.cfg, url=FILE_MANY_FIXTURE_URL)
populate_pulp(self.cfg, url=FILE_MANY_FIXTURE_MANIFEST_URL)
sample_size = min(FILE_MANY_FIXTURE_COUNT, 21)
contents = sample(self.client.get(FILE_CONTENT_PATH), sample_size)
repo = self.client.post(REPO_PATH, gen_repo())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from tests.functional.api.using_plugin.constants import (
FILE_CONTENT_PATH,
FILE_FIXTURE_COUNT,
FILE_LARGE_FIXTURE_URL,
FILE_LARGE_FIXTURE_MANIFEST_URL,
FILE_PUBLISHER_PATH,
FILE_REMOTE_PATH,
)
Expand Down Expand Up @@ -250,7 +250,7 @@ def setUpClass(cls):
"""Add content to Pulp."""
cls.cfg = config.get_config()
cls.client = api.Client(cls.cfg, api.json_handler)
populate_pulp(cls.cfg, url=FILE_LARGE_FIXTURE_URL)
populate_pulp(cls.cfg, url=FILE_LARGE_FIXTURE_MANIFEST_URL)
# We need at least three content units. Choosing a relatively low
# number is useful, to limit how many repo versions are created, and
# thus how long the test takes.
Expand Down
8 changes: 4 additions & 4 deletions pulpcore/tests/functional/api/using_plugin/test_tasking.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
)

from tests.functional.api.using_plugin.constants import (
FILE_FIXTURE_URL,
FILE_FIXTURE_MANIFEST_URL,
FILE_FIXTURE_COUNT,
FILE_LARGE_FIXTURE_URL,
FILE_LARGE_FIXTURE_MANIFEST_URL,
FILE_REMOTE_PATH,
)
from tests.functional.api.using_plugin.utils import gen_file_remote
Expand Down Expand Up @@ -48,11 +48,11 @@ def test_all(self):
repo = client.post(REPO_PATH, gen_repo())
self.addCleanup(client.delete, repo['_href'])

body = gen_file_remote(url=FILE_LARGE_FIXTURE_URL)
body = gen_file_remote(url=FILE_LARGE_FIXTURE_MANIFEST_URL)
remote = client.post(FILE_REMOTE_PATH, body)
self.addCleanup(client.delete, remote['_href'])

url = {'url': FILE_FIXTURE_URL}
url = {'url': FILE_FIXTURE_MANIFEST_URL}
client.patch(remote['_href'], url)

sync(cfg, remote, repo)
Expand Down
17 changes: 6 additions & 11 deletions pulpcore/tests/functional/api/using_plugin/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
)

from tests.functional.api.using_plugin.constants import (
FILE_FIXTURE_MANIFEST_URL,
FILE_CONTENT_PATH,
FILE_FIXTURE_URL,
FILE_MANIFEST,
FILE_REMOTE_PATH
)

Expand Down Expand Up @@ -45,13 +44,13 @@ def populate_pulp(cfg, url=None):
Pulp.
"""
if url is None:
url = FILE_FIXTURE_URL
url = FILE_FIXTURE_MANIFEST_URL

client = api.Client(cfg, api.json_handler)
remote = {}
repo = {}
try:
remote.update(client.post(FILE_REMOTE_PATH, gen_file_remote(url)))
remote.update(client.post(FILE_REMOTE_PATH, gen_remote(url)))
repo.update(client.post(REPO_PATH, gen_repo()))
sync(cfg, remote, repo)
finally:
Expand All @@ -62,19 +61,15 @@ def populate_pulp(cfg, url=None):
return client.get(FILE_CONTENT_PATH)['results']


def gen_file_remote(url=None, manifest=None, **kwargs):
def gen_file_remote(url=None, **kwargs):
"""Return a semi-random dict for use in creating a file Remote.

:param url: The URL of an external content source.
:param manifest: The name of the manifest file in the external content source.
"""
if url is None:
url = FILE_FIXTURE_URL
url = FILE_FIXTURE_MANIFEST_URL

if manifest is None:
manifest = FILE_MANIFEST

return gen_remote(url, manifest=manifest, **kwargs)
return gen_remote(url, **kwargs)


def gen_file_publisher(**kwargs):
Expand Down