From 18a5dd032294ef7c5f4e8f54f7c8e5a15beebc76 Mon Sep 17 00:00:00 2001 From: Gaurav Talreja Date: Sat, 11 Jan 2025 03:17:12 +0530 Subject: [PATCH] Update default proxy parameter to content_default_http_proxy Signed-off-by: Gaurav Talreja --- pytest_fixtures/component/http_proxy.py | 2 +- robottelo/host_helpers/api_factory.py | 4 ++-- tests/foreman/ui/test_http_proxy.py | 20 ++++++++++++++------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/pytest_fixtures/component/http_proxy.py b/pytest_fixtures/component/http_proxy.py index 0fce475f839..c11c94a34cf 100644 --- a/pytest_fixtures/component/http_proxy.py +++ b/pytest_fixtures/component/http_proxy.py @@ -22,7 +22,7 @@ def setup_http_proxy(request, module_manifest_org, target_sat): content_proxy = target_sat.api.Setting().search( query={'search': 'name=content_default_http_proxy'} )[0] - assert content_proxy.value == http_proxy.name + assert content_proxy.value == http_proxy.name if request.param is not None else '' if request.param is not None: general_proxy = ( diff --git a/robottelo/host_helpers/api_factory.py b/robottelo/host_helpers/api_factory.py index fa85054b8b1..4f3f3ffe48b 100644 --- a/robottelo/host_helpers/api_factory.py +++ b/robottelo/host_helpers/api_factory.py @@ -38,7 +38,7 @@ def make_http_proxy(self, org, http_proxy_type): name=gen_string('alpha', 15), url=settings.http_proxy.un_auth_proxy_url, organization=[org.id], - default_content_http_proxy=True, + content_default_http_proxy=True, ).create() if http_proxy_type: return self._satellite.api.HTTPProxy( @@ -47,7 +47,7 @@ def make_http_proxy(self, org, http_proxy_type): username=settings.http_proxy.username, password=settings.http_proxy.password, organization=[org.id], - default_content_http_proxy=True, + content_default_http_proxy=True, ).create() return None diff --git a/tests/foreman/ui/test_http_proxy.py b/tests/foreman/ui/test_http_proxy.py index 4bb9bc836b8..e0e83cb5217 100644 --- a/tests/foreman/ui/test_http_proxy.py +++ b/tests/foreman/ui/test_http_proxy.py @@ -277,16 +277,24 @@ def test_positive_set_default_http_proxy( { 'http_proxy.name': http_proxy_name, 'http_proxy.url': http_proxy_url, - 'http_proxy.default_content_http_proxy': 'true', + 'http_proxy.content_default_http_proxy': 'true', 'locations.resources.assigned': [module_location.name], 'organizations.resources.assigned': [module_org.name], } ) - request.addfinalizer( - lambda: target_sat.api.HTTPProxy() - .search(query={'search': f'name={http_proxy_name}'})[0] - .delete() - ) + + # Teardown + @request.addfinalizer + def _finalize(): + target_sat.api.HTTPProxy().search(query={'search': f'name={http_proxy_name}'})[ + 0 + ].delete() + default_proxy = target_sat.api.Setting().search( + query={'search': 'name=content_default_http_proxy'} + )[0] + assert default_proxy.value != http_proxy_name + assert not default_proxy.value + result = session.settings.read(f'name = {property_name}') assert result['table'][0]['Value'] == f'{http_proxy_name} ({http_proxy_url})'