From 11e3c220920bb6bde0a3b0f5276def3a5ad91506 Mon Sep 17 00:00:00 2001 From: vsedmik Date: Wed, 19 Feb 2025 17:29:29 +0100 Subject: [PATCH] Address several review comments --- tests/foreman/api/test_capsulecontent.py | 2 +- tests/foreman/cli/test_capsulecontent.py | 6 +++--- tests/foreman/cli/test_flatpak.py | 21 +++++++++------------ tests/foreman/cli/test_satellitesync.py | 6 +++--- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/tests/foreman/api/test_capsulecontent.py b/tests/foreman/api/test_capsulecontent.py index 02db66544e..8a453a3515 100644 --- a/tests/foreman/api/test_capsulecontent.py +++ b/tests/foreman/api/test_capsulecontent.py @@ -800,7 +800,7 @@ def test_flatpak_endpoint(self, target_sat, module_capsule_configured, endpoint) 1. HTTP 200 """ ep = FLATPAK_ENDPOINTS[endpoint].format(module_capsule_configured.hostname) - rq = requests.get(ep, verify=False) + rq = requests.get(ep, verify=settings.server.verify_ca) assert rq.ok, f'Expected 200 but got {rq.status_code} from {endpoint} registry index' @pytest.mark.e2e diff --git a/tests/foreman/cli/test_capsulecontent.py b/tests/foreman/cli/test_capsulecontent.py index c4581dfebc..added45fab 100644 --- a/tests/foreman/cli/test_capsulecontent.py +++ b/tests/foreman/cli/test_capsulecontent.py @@ -883,11 +883,11 @@ def test_sync_consume_flatpak_repo_via_library( 'job-template': 'Flatpak - Set up remote on host', 'inputs': ( f'Remote Name={remote_name}, ' - f'Flatpak registry URL=https://{caps.hostname}/pulpcore_registry/, ' + f'Flatpak registry URL={settings.server.scheme}://{caps.hostname}/pulpcore_registry/, ' f'Username={settings.server.admin_username}, ' f'Password={settings.server.admin_password}' ), - 'search-query': f"name ~ {host.hostname}", + 'search-query': f"name = {host.hostname}", } ) res = module_target_sat.cli.JobInvocation.info({'id': job.id}) @@ -907,7 +907,7 @@ def test_sync_consume_flatpak_repo_via_library( 'organization': function_org.name, 'job-template': 'Flatpak - Install application on host', 'inputs': f'Flatpak remote name={remote_name}, Application name={app_name}', - 'search-query': f"name ~ {host.hostname}", + 'search-query': f"name = {host.hostname}", } ) res = module_target_sat.cli.JobInvocation.info({'id': job.id}) diff --git a/tests/foreman/cli/test_flatpak.py b/tests/foreman/cli/test_flatpak.py index e09ae923a0..8f84dfb6e0 100644 --- a/tests/foreman/cli/test_flatpak.py +++ b/tests/foreman/cli/test_flatpak.py @@ -48,11 +48,8 @@ def function_user(target_sat, function_role, function_org): def function_host_cleanup(target_sat, module_flatpak_contenthost): """Cleans up the flatpak contenthost so it can be re-registered with different org""" module_flatpak_contenthost.unregister() - host = target_sat.api.Host().search( - query={'search': f'name={module_flatpak_contenthost.hostname}'} - ) - if len(host) > 0: - target_sat.api.Host(id=host[0].id).delete() + if nh := module_flatpak_contenthost.nailgun_host: + nh.delete() def test_CRUD_and_sync_flatpak_remote_with_permissions( @@ -224,7 +221,7 @@ def test_flatpak_endpoint(target_sat, endpoint): 1. HTTP 200 """ ep = FLATPAK_ENDPOINTS[endpoint].format(target_sat.hostname) - rq = requests.get(ep, verify=False) + rq = requests.get(ep, verify=settings.server.verify_ca) assert rq.ok, f'Expected 200 but got {rq.status_code} from {endpoint} registry index' @@ -318,11 +315,11 @@ def test_sync_consume_flatpak_repo_via_library( 'job-template': 'Flatpak - Set up remote on host', 'inputs': ( f'Remote Name={remote_name}, ' - f'Flatpak registry URL=https://{sat.hostname}/pulpcore_registry/, ' + f'Flatpak registry URL={settings.server.scheme}://{sat.hostname}/pulpcore_registry/, ' f'Username={settings.server.admin_username}, ' f'Password={settings.server.admin_password}' ), - 'search-query': f"name ~ {host.hostname}", + 'search-query': f"name = {host.hostname}", } ) res = module_target_sat.cli.JobInvocation.info({'id': job.id}) @@ -341,7 +338,7 @@ def test_sync_consume_flatpak_repo_via_library( 'organization': function_org.name, 'job-template': 'Flatpak - Install application on host', 'inputs': f'Flatpak remote name={remote_name}, Application name={app_name}', - 'search-query': f"name ~ {host.hostname}", + 'search-query': f"name = {host.hostname}", } ) res = module_target_sat.cli.JobInvocation.info({'id': job.id}) @@ -459,11 +456,11 @@ def test_sync_consume_flatpak_repo_via_cv( 'job-template': 'Flatpak - Set up remote on host', 'inputs': ( f'Remote Name={remote_name}, ' - f'Flatpak registry URL=https://{sat.hostname}/, ' + f'Flatpak registry URL={settings.server.scheme}://{sat.hostname}/, ' f'Username={settings.server.admin_username}, ' f'Password={settings.server.admin_password}' ), - 'search-query': f"name ~ {host.hostname}", + 'search-query': f"name = {host.hostname}", } ) res = module_target_sat.cli.JobInvocation.info({'id': job.id}) @@ -481,7 +478,7 @@ def test_sync_consume_flatpak_repo_via_cv( opts = { 'organization': function_org.name, 'job-template': 'Flatpak - Install application on host', - 'search-query': f"name ~ {host.hostname}", + 'search-query': f"name = {host.hostname}", } cv1_app = 'Inkscape' job = module_target_sat.cli_factory.job_invocation( diff --git a/tests/foreman/cli/test_satellitesync.py b/tests/foreman/cli/test_satellitesync.py index d84d8e7784..77963f849d 100644 --- a/tests/foreman/cli/test_satellitesync.py +++ b/tests/foreman/cli/test_satellitesync.py @@ -1537,11 +1537,11 @@ def test_postive_export_import_cv_with_mixed_content_repos( 'job-template': 'Flatpak - Set up remote on host', 'inputs': ( f'Remote Name={remote_name}, ' - f'Flatpak registry URL=https://{module_import_sat.hostname}/pulpcore_registry/, ' + f'Flatpak registry URL={settings.server.scheme}://{module_import_sat.hostname}/pulpcore_registry/, ' f'Username={settings.server.admin_username}, ' f'Password={settings.server.admin_password}' ), - 'search-query': f"name ~ {module_flatpak_contenthost.hostname}", + 'search-query': f"name = {module_flatpak_contenthost.hostname}", } ) res = module_import_sat.cli.JobInvocation.info({'id': job.id}) @@ -1564,7 +1564,7 @@ def test_postive_export_import_cv_with_mixed_content_repos( 'organization': function_import_org_at_isat.name, 'job-template': 'Flatpak - Install application on host', 'inputs': f'Flatpak remote name={remote_name}, Application name={app_name}', - 'search-query': f"name ~ {module_flatpak_contenthost.hostname}", + 'search-query': f"name = {module_flatpak_contenthost.hostname}", } ) res = module_import_sat.cli.JobInvocation.info({'id': job.id})