From e5a775bc8d5f51a064487eef31b96b5a8dd1f742 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 9 Jan 2024 22:16:15 -0600 Subject: [PATCH 1/4] Add test for BZ 2139834 --- tests/foreman/cli/test_contentview.py | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/foreman/cli/test_contentview.py b/tests/foreman/cli/test_contentview.py index 6aeea931ff..cd67689608 100644 --- a/tests/foreman/cli/test_contentview.py +++ b/tests/foreman/cli/test_contentview.py @@ -4023,6 +4023,34 @@ def test_positive_inc_update_no_lce(self, module_org, module_product, module_tar content_view = module_target_sat.cli.ContentView.info({'id': content_view['id']}) assert '1.1' in [cvv_['version'] for cvv_ in content_view['versions']] + @pytest.mark.tier2 + def test_version_info_by_lce(self, module_org, module_target_sat): + """Hammer version info can be passed the lce id/name argument without error + + :id: 6ab0c46c-c62a-488b-a30f-5500d6c7ec96 + + :steps: + 1. Lookup CV version info passing the lce id as an argument + + :expectedresults: LCE is able to be passed to version info command without error + + :BZ: 2139834 + + :customerscenario: true + """ + content_view = module_target_sat.cli_factory.make_content_view( + {'organization-id': module_org.id} + ) + module_target_sat.cli.ContentView.publish({'id': content_view['id']}) + content_view = module_target_sat.cli.ContentView.version_info( + {'id': content_view['id'], 'lifecycle-environment-id': 1} + ) + assert len(content_view['versions']) == 1 + content_view = module_target_sat.cli.ContentView.version_info( + {'id': content_view['id'], 'lifecycle-environment': 'Library'} + ) + assert len(content_view['versions']) == 1 + class TestContentViewFileRepo: """Specific tests for Content Views with File Repositories containing From de8730d87331e3cdcb416daf45ee47c181845c41 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 16 Jan 2024 17:00:32 -0600 Subject: [PATCH 2/4] Update test setup to create a discrete LCE, and publish/promote to there --- tests/foreman/cli/test_contentview.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/foreman/cli/test_contentview.py b/tests/foreman/cli/test_contentview.py index cd67689608..a6606d696e 100644 --- a/tests/foreman/cli/test_contentview.py +++ b/tests/foreman/cli/test_contentview.py @@ -4042,14 +4042,23 @@ def test_version_info_by_lce(self, module_org, module_target_sat): {'organization-id': module_org.id} ) module_target_sat.cli.ContentView.publish({'id': content_view['id']}) + lce = module_target_sat.cli_factory.make_lifecycle_environment( + {'organization-id': module_org.id} + ) + module_target_sat.cli.ContentView.version_promote( + {'id': content_view['id'], 'to-lifecycle-environment-id': lce['id']} + ) + module_target_sat.cli.ContentView.publish({'id': content_view['id']}) content_view = module_target_sat.cli.ContentView.version_info( - {'id': content_view['id'], 'lifecycle-environment-id': 1} + {'id': content_view['id'], 'lifecycle-environment-id': lce['id'], + 'organization-id': module_org.id} ) - assert len(content_view['versions']) == 1 + assert content_view['version'] == '1.0' content_view = module_target_sat.cli.ContentView.version_info( - {'id': content_view['id'], 'lifecycle-environment': 'Library'} + {'id': content_view['id'], 'lifecycle-environment': lce['name'], + 'organization-id': module_org.id} ) - assert len(content_view['versions']) == 1 + assert content_view['version'] == '1.0' class TestContentViewFileRepo: From 8be78e310296ba8ba871ed0331054391ada218c9 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 16 Jan 2024 17:01:39 -0600 Subject: [PATCH 3/4] Update test setup to create a discrete LCE, and publish/promote to there --- tests/foreman/cli/test_contentview.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/foreman/cli/test_contentview.py b/tests/foreman/cli/test_contentview.py index a6606d696e..f0b5ef3d70 100644 --- a/tests/foreman/cli/test_contentview.py +++ b/tests/foreman/cli/test_contentview.py @@ -4050,13 +4050,19 @@ def test_version_info_by_lce(self, module_org, module_target_sat): ) module_target_sat.cli.ContentView.publish({'id': content_view['id']}) content_view = module_target_sat.cli.ContentView.version_info( - {'id': content_view['id'], 'lifecycle-environment-id': lce['id'], - 'organization-id': module_org.id} + { + 'id': content_view['id'], + 'lifecycle-environment-id': lce['id'], + 'organization-id': module_org.id, + } ) assert content_view['version'] == '1.0' content_view = module_target_sat.cli.ContentView.version_info( - {'id': content_view['id'], 'lifecycle-environment': lce['name'], - 'organization-id': module_org.id} + { + 'id': content_view['id'], + 'lifecycle-environment': lce['name'], + 'organization-id': module_org.id, + } ) assert content_view['version'] == '1.0' From 431e6fd361e42aa5967d0dd677a056bc06924255 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Wed, 17 Jan 2024 09:07:14 -0600 Subject: [PATCH 4/4] Remove unnecessary publish --- tests/foreman/cli/test_contentview.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/foreman/cli/test_contentview.py b/tests/foreman/cli/test_contentview.py index f0b5ef3d70..0b4ee4041e 100644 --- a/tests/foreman/cli/test_contentview.py +++ b/tests/foreman/cli/test_contentview.py @@ -4048,7 +4048,6 @@ def test_version_info_by_lce(self, module_org, module_target_sat): module_target_sat.cli.ContentView.version_promote( {'id': content_view['id'], 'to-lifecycle-environment-id': lce['id']} ) - module_target_sat.cli.ContentView.publish({'id': content_view['id']}) content_view = module_target_sat.cli.ContentView.version_info( { 'id': content_view['id'],