Skip to content

Commit

Permalink
Updates pulp-smash for repo layout changes
Browse files Browse the repository at this point in the history
This is designed to go along with these changes in Pulp 3.0

pulp/pulp#3896

The response format changed you we have to adjust how the utils parse
the response data for tests.

https://pulp.plan.io/issues/4283
re #4283
  • Loading branch information
Brian Bouterse authored and rochacbruno committed Mar 1, 2019
1 parent 28b8bff commit 35a3eb9
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions pulp_smash/pulp3/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,16 @@ def inner(repo, version_href=None):
repo_version = client.get(version_href)

content = defaultdict(list)
for content_type, content_url in repo_version[content_field].items():
typed_content = client.get(content_url)
for content_type, content_dict in repo_version['content_summary'][content_field].items():
typed_content = client.get(content_dict['href'])
content[content_type] = typed_content
return content
return inner


get_content = _build_content_fetcher('content_hrefs') # pylint:disable=invalid-name
get_added_content = _build_content_fetcher('content_added_hrefs') # pylint:disable=invalid-name
get_removed_content = _build_content_fetcher('content_removed_hrefs') # pylint:disable=invalid-name
get_content = _build_content_fetcher('present') # pylint:disable=invalid-name
get_added_content = _build_content_fetcher('added') # pylint:disable=invalid-name
get_removed_content = _build_content_fetcher('removed') # pylint:disable=invalid-name


def _build_summary_fetcher(summary_field):
Expand Down Expand Up @@ -196,13 +196,17 @@ def inner(repo, version_href=None):
return {}

client = api.Client(config.get_config(), api.page_handler)
return client.get(version_href)[summary_field]
to_return = client.get(version_href)['content_summary'][summary_field]
for key in to_return:
# provide the old interface pre-changes from https://github.com/pulp/pulpcore/pull/2
to_return[key] = to_return[key]['count']
return to_return
return inner


get_content_summary = _build_summary_fetcher('content_summary') # pylint:disable=invalid-name
get_added_content_summary = _build_summary_fetcher('content_added_summary') # pylint:disable=invalid-name
get_removed_content_summary = _build_summary_fetcher('content_removed_summary') # pylint:disable=invalid-name
get_content_summary = _build_summary_fetcher('present') # pylint:disable=invalid-name
get_added_content_summary = _build_summary_fetcher('added') # pylint:disable=invalid-name
get_removed_content_summary = _build_summary_fetcher('removed') # pylint:disable=invalid-name


def delete_orphans(cfg=None):
Expand Down

0 comments on commit 35a3eb9

Please sign in to comment.