From 58e4817f1ed47b477dcbb35843e64692cc652ca5 Mon Sep 17 00:00:00 2001 From: Cole Higgins Date: Mon, 30 Oct 2023 08:28:19 -0400 Subject: [PATCH 1/4] Adding tests for web ui --- tests/foreman/ui/test_activationkey.py | 19 +++++++++++++++++++ tests/foreman/ui/test_organization.py | 20 ++++++++++++++++++++ tests/foreman/ui/test_subscription.py | 18 ++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/tests/foreman/ui/test_activationkey.py b/tests/foreman/ui/test_activationkey.py index dd2496a8aff..d791ded9f31 100644 --- a/tests/foreman/ui/test_activationkey.py +++ b/tests/foreman/ui/test_activationkey.py @@ -1228,3 +1228,22 @@ def test_positive_ak_with_custom_product_on_rhel6(session, rhel6_contenthost, ta ak = session.activationkey.read(ak.name, widget_names='content_hosts') assert len(ak['content_hosts']['table']) == 1 assert ak['content_hosts']['table'][0]['Name'] == rhel6_contenthost.hostname + + +def test_positive_prepare_for_sca_only_ak(target_sat, function_entitlement_manifest_org): + """Verify that the ActivationKey details page notifies users that Simple Content Access + will be required for all organizations in Satellite 6.16 + + :id: 417a8331-3c66-473f-938c-bbf01deb6031 + + :expectedresults: The ActivationKey page notifies users that Simple Content Access will + be required for all organizations in Satellite 6.16 + """ + ak = target_sat.api.ActivationKey(organization=function_entitlement_manifest_org).create() + with target_sat.ui_session() as session: + session.organization.select(function_entitlement_manifest_org.name) + ak = session.activationkey.read(ak.name) + assert ( + 'This organization is not using Simple Content Access. Entitlement-based subscription management is deprecated and will be removed in Katello 4.12.' + in ak['sca_alert'] + ) diff --git a/tests/foreman/ui/test_organization.py b/tests/foreman/ui/test_organization.py index b9bc7949eba..16c04b2b903 100644 --- a/tests/foreman/ui/test_organization.py +++ b/tests/foreman/ui/test_organization.py @@ -384,3 +384,23 @@ def test_positive_prepare_for_sca_only_deprecation(target_sat): ) results = target_sat.execute('tail -100 /var/log/foreman/production.log').stdout assert 'Simple Content Access will be required for all organizations in Katello 4.12' in results + + +def test_positive_prepare_for_sca_only_organization(target_sat, function_entitlement_manifest_org): + """Verify that the organization details page notifies users that Simple Content Access + will be required for all organizations in Satellite 6.16 + + :id: 3a6a848b-3c16-4dbb-8f52-5ea57a9a97ef + + :expectedresults: The Organization details page notifies users that Simple Content Access will + be required for all organizations in Satellite 6.16 + """ + with target_sat.ui_session() as session: + session.organization.select(function_entitlement_manifest_org.name) + sca_alert = session.organization.read( + function_entitlement_manifest_org.name, widget_names='primary' + ) + assert ( + 'Simple Content Access will be required for all organizations in Katello 4.12.' + in sca_alert['primary']['sca_alert'] + ) diff --git a/tests/foreman/ui/test_subscription.py b/tests/foreman/ui/test_subscription.py index 3a90a4335cc..8c50d421ff3 100644 --- a/tests/foreman/ui/test_subscription.py +++ b/tests/foreman/ui/test_subscription.py @@ -551,3 +551,21 @@ def test_positive_candlepin_events_processed_by_STOMP( response = entities.Ping().search_json()['services']['candlepin_events'] assert response['status'] == 'ok' assert '0 Failed' in response['message'] + + +def test_positive_prepare_for_sca_only_subscription(target_sat, function_entitlement_manifest_org): + """Verify that the Subcsription page notifies users that Simple Content Access + will be required for all organizations in Satellite 6.16 + + :id: cb6fdfdd-04ee-4acb-9460-c78556cef11e + + :expectedresults: The Subscription page notifies users that Simple Content Access will + be required for all organizations in Satellite 6.16 + """ + with target_sat.ui_session() as session: + session.organization.select(function_entitlement_manifest_org.name) + sca_alert = session.subscription.sca_alert() + assert ( + 'This organization is not using Simple Content Access. Entitlement-based subscription management is deprecated and will be removed in Katello 4.12.' + in sca_alert + ) From 4287e5220da9d47eb1e1b8a421bdc0721a229bf4 Mon Sep 17 00:00:00 2001 From: Cole Higgins Date: Thu, 2 Nov 2023 15:02:52 -0400 Subject: [PATCH 2/4] Adding host test for sca only --- tests/foreman/ui/test_contenthost.py | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/foreman/ui/test_contenthost.py b/tests/foreman/ui/test_contenthost.py index 2643eb59f50..fef2fddcc6b 100644 --- a/tests/foreman/ui/test_contenthost.py +++ b/tests/foreman/ui/test_contenthost.py @@ -1871,3 +1871,44 @@ def test_search_for_virt_who_hypervisors(session, default_location): # Search with hypervisor=false gives the correct result. content_hosts = [host['Name'] for host in session.contenthost.search('hypervisor = false')] assert hypervisor_display_name not in content_hosts + + +@pytest.mark.rhel_ver_match('[^6]') +def test_positive_prepare_for_sca_only_content_host( + session, + function_entitlement_manifest_org, + default_location, + rhel_contenthost, + target_sat, +): + """Verify that the Content Host page notifies users that Entitlement-based subscription + management is deprecated and will be removed in Satellite 6.16 + + :id: 1a725675-2cf5-4f84-a755-c25f19ef5fd1 + + :expectedresults: The Content Host page notifies users that Entitlement-based subscription + management is deprecated and will be removed in Satellite 6.16 + """ + lce = target_sat.api.LifecycleEnvironment( + organization=function_entitlement_manifest_org + ).create() + cv = target_sat.api.ContentView( + organization=function_entitlement_manifest_org, environment=[lce] + ).create() + cv.publish() + cvv = cv.read().version[0].read() + cvv.promote(data={'environment_ids': lce.id, 'force': False}) + ak = target_sat.api.ActivationKey( + organization=function_entitlement_manifest_org, content_view=cv, environment=lce + ).create() + rhel_contenthost.register( + function_entitlement_manifest_org, default_location, ak.name, target_sat + ) + with session: + session.organization.select(function_entitlement_manifest_org.name) + session.location.select(default_location.name) + host_details = session.contenthost.read(rhel_contenthost.hostname, widget_names='details') + assert ( + 'This organization is not using Simple Content Access. Entitlement-based subscription management is deprecated and will be removed in Katello 4.12.' + in host_details['details']['sca_alert'] + ) From 92f544909fe5ef6ff7444b39129c73ffb069e7c7 Mon Sep 17 00:00:00 2001 From: Cole Higgins Date: Mon, 6 Nov 2023 08:22:43 -0500 Subject: [PATCH 3/4] Prepare for sca only deprecation --- tests/foreman/ui/test_organization.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/foreman/ui/test_organization.py b/tests/foreman/ui/test_organization.py index 16c04b2b903..b10e2878734 100644 --- a/tests/foreman/ui/test_organization.py +++ b/tests/foreman/ui/test_organization.py @@ -404,3 +404,24 @@ def test_positive_prepare_for_sca_only_organization(target_sat, function_entitle 'Simple Content Access will be required for all organizations in Katello 4.12.' in sca_alert['primary']['sca_alert'] ) + + +def test_positive_prepare_for_sca_only_deprecation(target_sat): + """Verify that Simple Content Access endpoints are depreacated and will be required + for all organizations in Satellite 6.16 + + :id: 08539596-1bd3-4363-9737-e45f32ee5cbb + + :expectedresults: Attepting to create an Organization with sca set to False, will throw + deprecation endpoint message + """ + with target_sat.ui_session() as session: + session.organization.create( + { + 'name': gen_string('alpha'), + 'label': gen_string('alpha'), + 'simple_content_access': False, + } + ) + results = target_sat.execute('tail -100 /var/log/foreman/production.log').stdout + assert 'Simple Content Access will be required for all organizations in Katello 4.12' in results From c8b075d1384ee7028275c7823fe88f40ec11e78e Mon Sep 17 00:00:00 2001 From: Cole Higgins Date: Tue, 21 Nov 2023 14:46:48 -0500 Subject: [PATCH 4/4] updating to satellite 6.16 --- tests/foreman/ui/test_activationkey.py | 4 ++-- tests/foreman/ui/test_contenthost.py | 3 ++- tests/foreman/ui/test_organization.py | 23 +---------------------- tests/foreman/ui/test_subscription.py | 4 ++-- 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/tests/foreman/ui/test_activationkey.py b/tests/foreman/ui/test_activationkey.py index d791ded9f31..b0d1e52de21 100644 --- a/tests/foreman/ui/test_activationkey.py +++ b/tests/foreman/ui/test_activationkey.py @@ -1244,6 +1244,6 @@ def test_positive_prepare_for_sca_only_ak(target_sat, function_entitlement_manif session.organization.select(function_entitlement_manifest_org.name) ak = session.activationkey.read(ak.name) assert ( - 'This organization is not using Simple Content Access. Entitlement-based subscription management is deprecated and will be removed in Katello 4.12.' - in ak['sca_alert'] + 'This organization is not using Simple Content Access. Entitlement-based subscription ' + 'management is deprecated and will be removed in Satellite 6.16.' in ak['sca_alert'] ) diff --git a/tests/foreman/ui/test_contenthost.py b/tests/foreman/ui/test_contenthost.py index fef2fddcc6b..28ea37df065 100644 --- a/tests/foreman/ui/test_contenthost.py +++ b/tests/foreman/ui/test_contenthost.py @@ -1909,6 +1909,7 @@ def test_positive_prepare_for_sca_only_content_host( session.location.select(default_location.name) host_details = session.contenthost.read(rhel_contenthost.hostname, widget_names='details') assert ( - 'This organization is not using Simple Content Access. Entitlement-based subscription management is deprecated and will be removed in Katello 4.12.' + 'This organization is not using Simple Content Access. Entitlement-based subscription ' + 'management is deprecated and will be removed in Satellite 6.16.' in host_details['details']['sca_alert'] ) diff --git a/tests/foreman/ui/test_organization.py b/tests/foreman/ui/test_organization.py index b10e2878734..6b18d947eb9 100644 --- a/tests/foreman/ui/test_organization.py +++ b/tests/foreman/ui/test_organization.py @@ -401,27 +401,6 @@ def test_positive_prepare_for_sca_only_organization(target_sat, function_entitle function_entitlement_manifest_org.name, widget_names='primary' ) assert ( - 'Simple Content Access will be required for all organizations in Katello 4.12.' + 'Simple Content Access will be required for all organizations in Satellite 6.16.' in sca_alert['primary']['sca_alert'] ) - - -def test_positive_prepare_for_sca_only_deprecation(target_sat): - """Verify that Simple Content Access endpoints are depreacated and will be required - for all organizations in Satellite 6.16 - - :id: 08539596-1bd3-4363-9737-e45f32ee5cbb - - :expectedresults: Attepting to create an Organization with sca set to False, will throw - deprecation endpoint message - """ - with target_sat.ui_session() as session: - session.organization.create( - { - 'name': gen_string('alpha'), - 'label': gen_string('alpha'), - 'simple_content_access': False, - } - ) - results = target_sat.execute('tail -100 /var/log/foreman/production.log').stdout - assert 'Simple Content Access will be required for all organizations in Katello 4.12' in results diff --git a/tests/foreman/ui/test_subscription.py b/tests/foreman/ui/test_subscription.py index 8c50d421ff3..337ae56d982 100644 --- a/tests/foreman/ui/test_subscription.py +++ b/tests/foreman/ui/test_subscription.py @@ -566,6 +566,6 @@ def test_positive_prepare_for_sca_only_subscription(target_sat, function_entitle session.organization.select(function_entitlement_manifest_org.name) sca_alert = session.subscription.sca_alert() assert ( - 'This organization is not using Simple Content Access. Entitlement-based subscription management is deprecated and will be removed in Katello 4.12.' - in sca_alert + 'This organization is not using Simple Content Access. Entitlement-based subscription ' + 'management is deprecated and will be removed in Satellite 6.16.' in sca_alert )