From c06291b67fd3a922f6943b22cfa4201e0fdb3392 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Fri, 15 Dec 2023 11:19:04 -0600 Subject: [PATCH 1/8] Add test reading CV Version table --- tests/foreman/ui/test_contentview.py | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/foreman/ui/test_contentview.py b/tests/foreman/ui/test_contentview.py index 83df54ba541..31c2621103d 100644 --- a/tests/foreman/ui/test_contentview.py +++ b/tests/foreman/ui/test_contentview.py @@ -19,6 +19,8 @@ from fauxfactory import gen_string import pytest +from robottelo.constants import DEFAULT_ARCHITECTURE, PRDS, REPOS, REPOSET + @pytest.mark.tier2 def test_positive_create_cv(session, target_sat): @@ -42,6 +44,59 @@ def test_positive_create_cv(session, target_sat): assert session.contentview_new.search(cv)[0]['Name'] == cv +@pytest.mark.tier2 +def test_version_table_read(session, function_sca_manifest_org, target_sat): + """Able to read CV version package details, which includes the Epoch tab + + :id: fe2a87c7-f148-40f2-b11a-c209a4807016 + + :steps: + 1. Enable and Sync RHEL8 Base OS Repo + 2. Add repo to a CV + 3. Publish the CV + 4. Navigate to the published Version's page + 5. Filter packages to only an arbitrary package + + :expectedresults: The package is present, has the appropriate name, and has the epoch tab present + + :CaseLevel: System + + :BZ: 1911545 + + :customerscenario: true + """ + target_sat.cli.RepositorySet.enable( + { + 'basearch': DEFAULT_ARCHITECTURE, + 'name': REPOSET['rhel8_bos'], + 'organization-id': function_sca_manifest_org.id, + 'product': PRDS['rhel8'], + 'releasever': REPOS['rhel8_bos']['releasever'], + } + ) + rhel8_bos_info = target_sat.cli.RepositorySet.info( + { + 'name': REPOSET['rhel8_bos'], + 'organization-id': function_sca_manifest_org.id, + 'product': PRDS['rhel8'], + } + ) + rh_repo_id = rhel8_bos_info['enabled-repositories'][0]['id'] + rh_repo = target_sat.api.Repository(id=rh_repo_id).read() + rh_repo.sync() + cv = target_sat.api.ContentView(organization=function_sca_manifest_org).create() + cv = target_sat.api.ContentView(id=cv.id, repository=[rh_repo]).update(["repository"]) + cv.publish() + with target_sat.ui_session() as session: + package_name = 'aajohan' + session.organization.select(org_name=function_sca_manifest_org.name) + response = session.contentview_new.read_version_table( + cv.name, 'Version 1.0', 'rpmPackages', search_param=package_name + ) + assert package_name in response[0]['Name'] + assert response[0]['Epoch'] + + @pytest.mark.tier2 def test_no_blank_page_on_language_switch(session, target_sat, module_org): """Able to view the new CV UI when the language is set to something other From 721cc4f591c2c68388e18a2cdc3a56777789a6a1 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Fri, 15 Dec 2023 11:19:04 -0600 Subject: [PATCH 2/8] Add test reading CV Version table --- tests/foreman/ui/test_contentview.py | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/foreman/ui/test_contentview.py b/tests/foreman/ui/test_contentview.py index 0d203fc7707..78fed2895c0 100644 --- a/tests/foreman/ui/test_contentview.py +++ b/tests/foreman/ui/test_contentview.py @@ -15,6 +15,8 @@ from fauxfactory import gen_string import pytest +from robottelo.constants import DEFAULT_ARCHITECTURE, PRDS, REPOS, REPOSET + @pytest.mark.tier2 def test_positive_create_cv(session, target_sat): @@ -36,6 +38,59 @@ def test_positive_create_cv(session, target_sat): assert session.contentview_new.search(cv)[0]['Name'] == cv +@pytest.mark.tier2 +def test_version_table_read(session, function_sca_manifest_org, target_sat): + """Able to read CV version package details, which includes the Epoch tab + + :id: fe2a87c7-f148-40f2-b11a-c209a4807016 + + :steps: + 1. Enable and Sync RHEL8 Base OS Repo + 2. Add repo to a CV + 3. Publish the CV + 4. Navigate to the published Version's page + 5. Filter packages to only an arbitrary package + + :expectedresults: The package is present, has the appropriate name, and has the epoch tab present + + :CaseLevel: System + + :BZ: 1911545 + + :customerscenario: true + """ + target_sat.cli.RepositorySet.enable( + { + 'basearch': DEFAULT_ARCHITECTURE, + 'name': REPOSET['rhel8_bos'], + 'organization-id': function_sca_manifest_org.id, + 'product': PRDS['rhel8'], + 'releasever': REPOS['rhel8_bos']['releasever'], + } + ) + rhel8_bos_info = target_sat.cli.RepositorySet.info( + { + 'name': REPOSET['rhel8_bos'], + 'organization-id': function_sca_manifest_org.id, + 'product': PRDS['rhel8'], + } + ) + rh_repo_id = rhel8_bos_info['enabled-repositories'][0]['id'] + rh_repo = target_sat.api.Repository(id=rh_repo_id).read() + rh_repo.sync() + cv = target_sat.api.ContentView(organization=function_sca_manifest_org).create() + cv = target_sat.api.ContentView(id=cv.id, repository=[rh_repo]).update(["repository"]) + cv.publish() + with target_sat.ui_session() as session: + package_name = 'aajohan' + session.organization.select(org_name=function_sca_manifest_org.name) + response = session.contentview_new.read_version_table( + cv.name, 'Version 1.0', 'rpmPackages', search_param=package_name + ) + assert package_name in response[0]['Name'] + assert response[0]['Epoch'] + + @pytest.mark.tier2 def test_no_blank_page_on_language_switch(session, target_sat, module_org): """Able to view the new CV UI when the language is set to something other From 77425b3f82ad760d3147e7149980880e95f31963 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Fri, 3 May 2024 10:08:38 -0500 Subject: [PATCH 3/8] Add additional checks for table fields --- tests/foreman/ui/test_contentview.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/foreman/ui/test_contentview.py b/tests/foreman/ui/test_contentview.py index 78fed2895c0..3f6f0405d13 100644 --- a/tests/foreman/ui/test_contentview.py +++ b/tests/foreman/ui/test_contentview.py @@ -89,6 +89,9 @@ def test_version_table_read(session, function_sca_manifest_org, target_sat): ) assert package_name in response[0]['Name'] assert response[0]['Epoch'] + assert response[0]['Name'] == 'aajohan-comfortaa-fonts-3.001-2.el8.noarch' + assert response[0]['Version'] == '3.001' + assert response[0]['Release'] == '2.el8' @pytest.mark.tier2 From 220042dc94b0d60b9237fe7f21e976b2e52045a8 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Fri, 15 Dec 2023 11:19:04 -0600 Subject: [PATCH 4/8] Add test reading CV Version table --- tests/foreman/ui/test_contentview.py | 55 ++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/foreman/ui/test_contentview.py b/tests/foreman/ui/test_contentview.py index 0d203fc7707..78fed2895c0 100644 --- a/tests/foreman/ui/test_contentview.py +++ b/tests/foreman/ui/test_contentview.py @@ -15,6 +15,8 @@ from fauxfactory import gen_string import pytest +from robottelo.constants import DEFAULT_ARCHITECTURE, PRDS, REPOS, REPOSET + @pytest.mark.tier2 def test_positive_create_cv(session, target_sat): @@ -36,6 +38,59 @@ def test_positive_create_cv(session, target_sat): assert session.contentview_new.search(cv)[0]['Name'] == cv +@pytest.mark.tier2 +def test_version_table_read(session, function_sca_manifest_org, target_sat): + """Able to read CV version package details, which includes the Epoch tab + + :id: fe2a87c7-f148-40f2-b11a-c209a4807016 + + :steps: + 1. Enable and Sync RHEL8 Base OS Repo + 2. Add repo to a CV + 3. Publish the CV + 4. Navigate to the published Version's page + 5. Filter packages to only an arbitrary package + + :expectedresults: The package is present, has the appropriate name, and has the epoch tab present + + :CaseLevel: System + + :BZ: 1911545 + + :customerscenario: true + """ + target_sat.cli.RepositorySet.enable( + { + 'basearch': DEFAULT_ARCHITECTURE, + 'name': REPOSET['rhel8_bos'], + 'organization-id': function_sca_manifest_org.id, + 'product': PRDS['rhel8'], + 'releasever': REPOS['rhel8_bos']['releasever'], + } + ) + rhel8_bos_info = target_sat.cli.RepositorySet.info( + { + 'name': REPOSET['rhel8_bos'], + 'organization-id': function_sca_manifest_org.id, + 'product': PRDS['rhel8'], + } + ) + rh_repo_id = rhel8_bos_info['enabled-repositories'][0]['id'] + rh_repo = target_sat.api.Repository(id=rh_repo_id).read() + rh_repo.sync() + cv = target_sat.api.ContentView(organization=function_sca_manifest_org).create() + cv = target_sat.api.ContentView(id=cv.id, repository=[rh_repo]).update(["repository"]) + cv.publish() + with target_sat.ui_session() as session: + package_name = 'aajohan' + session.organization.select(org_name=function_sca_manifest_org.name) + response = session.contentview_new.read_version_table( + cv.name, 'Version 1.0', 'rpmPackages', search_param=package_name + ) + assert package_name in response[0]['Name'] + assert response[0]['Epoch'] + + @pytest.mark.tier2 def test_no_blank_page_on_language_switch(session, target_sat, module_org): """Able to view the new CV UI when the language is set to something other From 377bde54553746616892e8cb58be49f4f923b20c Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Fri, 3 May 2024 10:08:38 -0500 Subject: [PATCH 5/8] Add additional checks for table fields --- tests/foreman/ui/test_contentview.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/foreman/ui/test_contentview.py b/tests/foreman/ui/test_contentview.py index 78fed2895c0..3f6f0405d13 100644 --- a/tests/foreman/ui/test_contentview.py +++ b/tests/foreman/ui/test_contentview.py @@ -89,6 +89,9 @@ def test_version_table_read(session, function_sca_manifest_org, target_sat): ) assert package_name in response[0]['Name'] assert response[0]['Epoch'] + assert response[0]['Name'] == 'aajohan-comfortaa-fonts-3.001-2.el8.noarch' + assert response[0]['Version'] == '3.001' + assert response[0]['Release'] == '2.el8' @pytest.mark.tier2 From 2a10e6534d5943b814d87abe81f81d1a8c079aca Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Fri, 3 May 2024 14:11:35 -0500 Subject: [PATCH 6/8] Fix caseimportance string --- tests/foreman/ui/test_contentview.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/foreman/ui/test_contentview.py b/tests/foreman/ui/test_contentview.py index 3f6f0405d13..e9ae037909a 100644 --- a/tests/foreman/ui/test_contentview.py +++ b/tests/foreman/ui/test_contentview.py @@ -53,7 +53,7 @@ def test_version_table_read(session, function_sca_manifest_org, target_sat): :expectedresults: The package is present, has the appropriate name, and has the epoch tab present - :CaseLevel: System + :CaseImportance: Critical :BZ: 1911545 From 6e5aae3344dd5ffb8a5ff7e2224b26673d8d25c1 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Fri, 3 May 2024 14:29:53 -0500 Subject: [PATCH 7/8] Use only REPOS constant --- tests/foreman/ui/test_contentview.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/foreman/ui/test_contentview.py b/tests/foreman/ui/test_contentview.py index e9ae037909a..57bbe41db2f 100644 --- a/tests/foreman/ui/test_contentview.py +++ b/tests/foreman/ui/test_contentview.py @@ -15,7 +15,7 @@ from fauxfactory import gen_string import pytest -from robottelo.constants import DEFAULT_ARCHITECTURE, PRDS, REPOS, REPOSET +from robottelo.constants import DEFAULT_ARCHITECTURE, REPOS @pytest.mark.tier2 @@ -62,17 +62,17 @@ def test_version_table_read(session, function_sca_manifest_org, target_sat): target_sat.cli.RepositorySet.enable( { 'basearch': DEFAULT_ARCHITECTURE, - 'name': REPOSET['rhel8_bos'], + 'name': REPOS['rhel8_bos']['reposet'], 'organization-id': function_sca_manifest_org.id, - 'product': PRDS['rhel8'], + 'product': REPOS['rhel8_bos']['product'], 'releasever': REPOS['rhel8_bos']['releasever'], } ) rhel8_bos_info = target_sat.cli.RepositorySet.info( { - 'name': REPOSET['rhel8_bos'], + 'name': REPOS['rhel8_bos']['reposet'], 'organization-id': function_sca_manifest_org.id, - 'product': PRDS['rhel8'], + 'product': REPOS['rhel8_bos']['product'], } ) rh_repo_id = rhel8_bos_info['enabled-repositories'][0]['id'] From 15c078fd83b8e9056a59235ca05e62819f14f193 Mon Sep 17 00:00:00 2001 From: Sam Bible Date: Tue, 7 May 2024 16:31:53 -0500 Subject: [PATCH 8/8] Read data from product to compare in table, and use smaller repo --- tests/foreman/ui/test_contentview.py | 35 ++++++++-------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/tests/foreman/ui/test_contentview.py b/tests/foreman/ui/test_contentview.py index 57bbe41db2f..ee7b7f2ca27 100644 --- a/tests/foreman/ui/test_contentview.py +++ b/tests/foreman/ui/test_contentview.py @@ -15,7 +15,7 @@ from fauxfactory import gen_string import pytest -from robottelo.constants import DEFAULT_ARCHITECTURE, REPOS +from robottelo.constants import REPOS @pytest.mark.tier2 @@ -59,39 +59,24 @@ def test_version_table_read(session, function_sca_manifest_org, target_sat): :customerscenario: true """ - target_sat.cli.RepositorySet.enable( - { - 'basearch': DEFAULT_ARCHITECTURE, - 'name': REPOS['rhel8_bos']['reposet'], - 'organization-id': function_sca_manifest_org.id, - 'product': REPOS['rhel8_bos']['product'], - 'releasever': REPOS['rhel8_bos']['releasever'], - } + rh_repo_id = target_sat.api_factory.enable_sync_redhat_repo( + REPOS['rhae2.9_el8'], function_sca_manifest_org.id ) - rhel8_bos_info = target_sat.cli.RepositorySet.info( - { - 'name': REPOS['rhel8_bos']['reposet'], - 'organization-id': function_sca_manifest_org.id, - 'product': REPOS['rhel8_bos']['product'], - } - ) - rh_repo_id = rhel8_bos_info['enabled-repositories'][0]['id'] rh_repo = target_sat.api.Repository(id=rh_repo_id).read() - rh_repo.sync() + packages = target_sat.api.Repository(id=rh_repo_id).packages() cv = target_sat.api.ContentView(organization=function_sca_manifest_org).create() cv = target_sat.api.ContentView(id=cv.id, repository=[rh_repo]).update(["repository"]) cv.publish() with target_sat.ui_session() as session: - package_name = 'aajohan' session.organization.select(org_name=function_sca_manifest_org.name) response = session.contentview_new.read_version_table( - cv.name, 'Version 1.0', 'rpmPackages', search_param=package_name + cv.name, 'Version 1.0', 'rpmPackages', search_param=packages['results'][0]['nvra'] ) - assert package_name in response[0]['Name'] - assert response[0]['Epoch'] - assert response[0]['Name'] == 'aajohan-comfortaa-fonts-3.001-2.el8.noarch' - assert response[0]['Version'] == '3.001' - assert response[0]['Release'] == '2.el8' + assert response[0]['Epoch'] == packages['results'][0]['epoch'] + assert response[0]['Name'] == packages['results'][0]['nvra'] + assert response[0]['Version'] == packages['results'][0]['version'] + assert response[0]['Release'] == packages['results'][0]['release'] + assert response[0]['Arch'] == packages['results'][0]['arch'] @pytest.mark.tier2