From 8168fba79a6a286dbf6055e8e6d50d409cb29dfb Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 9 Jan 2024 21:50:13 -0600 Subject: [PATCH 1/4] Add test for BZ 1943306 --- tests/foreman/cli/test_reporttemplates.py | 35 +++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/foreman/cli/test_reporttemplates.py b/tests/foreman/cli/test_reporttemplates.py index cd45f6fc5a0..d3f6c9389af 100644 --- a/tests/foreman/cli/test_reporttemplates.py +++ b/tests/foreman/cli/test_reporttemplates.py @@ -857,6 +857,41 @@ def test_positive_schedule_entitlements_report( assert local_subscription['name'] in data_csv +@pytest.mark.tier3 +def test_entitlements_report_no_inputs_field( + module_entitlement_manifest_org, local_ak, local_subscription, rhel7_contenthost, target_sat +): + """Generate an report using the Subscription - Entitlement Report template + without passing in the 'Days from Now' argument in the inputs field, to test the + default setting + + :id: 52fd52db-0ab3-48f3-b37c-c8ce4224810c + + :steps: + 1. hammer report-template generate --organization '' --id '' --report-format '' + + :expectedresults: report is generated containing all the expected information + regarding entitlements, and the Days From Now field isn't required + + :BZ: 1943306 + + :customerscenario: true + """ + client = rhel7_contenthost + client.install_katello_ca(target_sat) + client.register_contenthost(module_entitlement_manifest_org.label, local_ak['name']) + assert client.subscribed + result = target_sat.cli.ReportTemplate.generate( + { + 'organization': module_entitlement_manifest_org.name, + 'name': 'Subscription - Entitlement Report', + 'report-format': 'csv', + } + ) + assert client.hostname in result + assert local_subscription['name'] in result + + @pytest.mark.tier3 def test_positive_generate_hostpkgcompare( module_entitlement_manifest_org, local_ak, local_content_view, local_environment, target_sat From 6088c5dcb3b23e4dda7b4ea41cf4901eb100ee45 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 9 Jan 2024 21:50:13 -0600 Subject: [PATCH 2/4] Add test for BZ 1943306 --- tests/foreman/cli/test_reporttemplates.py | 35 +++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/foreman/cli/test_reporttemplates.py b/tests/foreman/cli/test_reporttemplates.py index cd45f6fc5a0..d3f6c9389af 100644 --- a/tests/foreman/cli/test_reporttemplates.py +++ b/tests/foreman/cli/test_reporttemplates.py @@ -857,6 +857,41 @@ def test_positive_schedule_entitlements_report( assert local_subscription['name'] in data_csv +@pytest.mark.tier3 +def test_entitlements_report_no_inputs_field( + module_entitlement_manifest_org, local_ak, local_subscription, rhel7_contenthost, target_sat +): + """Generate an report using the Subscription - Entitlement Report template + without passing in the 'Days from Now' argument in the inputs field, to test the + default setting + + :id: 52fd52db-0ab3-48f3-b37c-c8ce4224810c + + :steps: + 1. hammer report-template generate --organization '' --id '' --report-format '' + + :expectedresults: report is generated containing all the expected information + regarding entitlements, and the Days From Now field isn't required + + :BZ: 1943306 + + :customerscenario: true + """ + client = rhel7_contenthost + client.install_katello_ca(target_sat) + client.register_contenthost(module_entitlement_manifest_org.label, local_ak['name']) + assert client.subscribed + result = target_sat.cli.ReportTemplate.generate( + { + 'organization': module_entitlement_manifest_org.name, + 'name': 'Subscription - Entitlement Report', + 'report-format': 'csv', + } + ) + assert client.hostname in result + assert local_subscription['name'] in result + + @pytest.mark.tier3 def test_positive_generate_hostpkgcompare( module_entitlement_manifest_org, local_ak, local_content_view, local_environment, target_sat From 045838ac2415f13985be137364aeed75bb761f7d Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 16 Jan 2024 17:41:26 -0600 Subject: [PATCH 3/4] Adjust text and asserts --- tests/foreman/cli/test_reporttemplates.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/foreman/cli/test_reporttemplates.py b/tests/foreman/cli/test_reporttemplates.py index d3f6c9389af..9bb41be94b4 100644 --- a/tests/foreman/cli/test_reporttemplates.py +++ b/tests/foreman/cli/test_reporttemplates.py @@ -865,13 +865,12 @@ def test_entitlements_report_no_inputs_field( without passing in the 'Days from Now' argument in the inputs field, to test the default setting - :id: 52fd52db-0ab3-48f3-b37c-c8ce4224810c + :id: 5c4e52b9-314c-470d-9946-3d6e05c85b7e :steps: 1. hammer report-template generate --organization '' --id '' --report-format '' - :expectedresults: report is generated containing all the expected information - regarding entitlements, and the Days From Now field isn't required + :expectedresults: report is generated, and the Days From Now field isn't required :BZ: 1943306 @@ -888,8 +887,8 @@ def test_entitlements_report_no_inputs_field( 'report-format': 'csv', } ) - assert client.hostname in result - assert local_subscription['name'] in result + # Only care that the Days from Now field isn't required, do not care about content + assert 'Subscription Total Quantity' in result @pytest.mark.tier3 From c3577dca8736af9bcbef1620761353800d68a575 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Wed, 17 Jan 2024 09:32:56 -0600 Subject: [PATCH 4/4] Use global registration template --- tests/foreman/cli/test_reporttemplates.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/foreman/cli/test_reporttemplates.py b/tests/foreman/cli/test_reporttemplates.py index 9bb41be94b4..a84db283d3a 100644 --- a/tests/foreman/cli/test_reporttemplates.py +++ b/tests/foreman/cli/test_reporttemplates.py @@ -859,7 +859,12 @@ def test_positive_schedule_entitlements_report( @pytest.mark.tier3 def test_entitlements_report_no_inputs_field( - module_entitlement_manifest_org, local_ak, local_subscription, rhel7_contenthost, target_sat + module_entitlement_manifest_org, + module_location, + local_ak, + local_subscription, + rhel7_contenthost, + target_sat, ): """Generate an report using the Subscription - Entitlement Report template without passing in the 'Days from Now' argument in the inputs field, to test the @@ -877,8 +882,7 @@ def test_entitlements_report_no_inputs_field( :customerscenario: true """ client = rhel7_contenthost - client.install_katello_ca(target_sat) - client.register_contenthost(module_entitlement_manifest_org.label, local_ak['name']) + client.register(module_entitlement_manifest_org, module_location, local_ak['name'], target_sat) assert client.subscribed result = target_sat.cli.ReportTemplate.generate( {