Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several ContentView test fixes #16486

Merged
merged 4 commits into from
Sep 25, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion robottelo/cli/contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def version_info(cls, options, output_format=None):
return result

@classmethod
def version_incremental_update(cls, options, output_format='csv'):
def version_incremental_update(cls, options, output_format='base'):
"""Performs incremental update of the content-view's version"""
cls.command_sub = 'version incremental-update'
if options is None:
Expand Down
2 changes: 2 additions & 0 deletions tests/foreman/api/test_contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -1211,6 +1211,7 @@ def test_negative_non_readonly_user_actions(target_sat, content_view, function_r
target_sat.api.ContentView(id=content_view.id).read()


@pytest.mark.stubbed
class TestOstreeContentView:
"""Tests for ostree contents in content views."""

Expand Down Expand Up @@ -1314,6 +1315,7 @@ def test_positive_publish_promote_with_custom_ostree_and_other(self, content_vie
assert len(content_view.read().version[0].read().environment) == 2


@pytest.mark.stubbed
class TestContentViewRedHatOstreeContent:
"""Tests for publishing and promoting cv with RH ostree contents."""

Expand Down
14 changes: 7 additions & 7 deletions tests/foreman/cli/test_contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -1618,7 +1618,7 @@ def test_positive_republish_after_rh_content_removed(
{'id': new_cv['id'], 'repository-id': module_rhel_content['id']}
)
new_cv = module_target_sat.cli.ContentView.info({'id': new_cv['id']})
assert len(new_cv['yum-repositories']) == 0
assert 'yum-repositories' not in new_cv
# Publish a new version of CV once more
module_target_sat.cli.ContentView.publish({'id': new_cv['id']})
new_cv = module_target_sat.cli.ContentView.info({'id': new_cv['id']})
Expand Down Expand Up @@ -3113,10 +3113,7 @@ def test_positive_inc_update_no_lce(self, module_org, module_product, module_tar
result = module_target_sat.cli.ContentView.version_incremental_update(
{'content-view-version-id': cvv['id'], 'errata-ids': settings.repos.yum_1.errata[1]}
)
# Inc update output format is pretty weird - list of dicts where each
# key's value is actual line from stdout
result = [line.strip() for line_dict in result for line in line_dict.values()]
assert FAKE_2_CUSTOM_PACKAGE not in [line.strip() for line in result]
assert FAKE_2_CUSTOM_PACKAGE not in result
content_view = module_target_sat.cli.ContentView.info({'id': content_view['id']})
assert '1.1' in [cvv_['version'] for cvv_ in content_view['versions']]

Expand Down Expand Up @@ -3501,10 +3498,13 @@ def test_positive_arbitrary_file_repo_removal(
module_target_sat.cli.ContentView.add_repository(
{'id': cv['id'], 'repository-id': repo['id'], 'organization-id': module_org.id}
)
cv_info = module_target_sat.cli.ContentView.info({'id': cv['id']})
assert cv_info['file-repositories'][0]['id'] == repo['id'], 'File repo should be listed'
module_target_sat.cli.ContentView.remove_repository(
{'id': cv['id'], 'repository-id': repo['id']}
)
assert cv['file-repositories'][0]['id'] != repo['id']
cv_info = module_target_sat.cli.ContentView.info({'id': cv['id']})
assert 'file-repositories' not in cv_info, 'No file repo should be listed'

@pytest.mark.tier3
def test_positive_arbitrary_file_repo_promotion(
Expand Down Expand Up @@ -3610,7 +3610,7 @@ def test_positive_inc_update_should_not_fail(self, module_org, module_target_sat
result = module_target_sat.cli.ContentView.version_incremental_update(
{'content-view-version-id': cvv['id'], 'errata-ids': settings.repos.yum_1.errata[0]}
)
assert result[2]
assert f'Content View: {content_view["name"]} version 1.1' in result
content_view = module_target_sat.cli.ContentView.info({'id': content_view['id']})
assert '1.1' in [cvv_['version'] for cvv_ in content_view['versions']]

Expand Down
4 changes: 2 additions & 2 deletions tests/foreman/cli/test_docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@ def test_positive_product_name_change_after_promotion(self, module_org, module_t
content_view = module_target_sat.cli.ContentView.info({'id': content_view['id']})
module_target_sat.cli.ContentView.version_promote(
{
'id': content_view['versions'][-1]['id'],
'id': sorted(cvv['id'] for cvv in content_view['versions'])[-1],
'to-lifecycle-environment-id': lce['id'],
}
)
Expand Down Expand Up @@ -668,7 +668,7 @@ def test_positive_repo_name_change_after_promotion(self, module_org, module_targ
content_view = module_target_sat.cli.ContentView.info({'id': content_view['id']})
module_target_sat.cli.ContentView.version_promote(
{
'id': content_view['versions'][-1]['id'],
'id': sorted(cvv['id'] for cvv in content_view['versions'])[-1],
'to-lifecycle-environment-id': lce['id'],
}
)
Expand Down