Skip to content

Commit

Permalink
Update default proxy parameter to content_default_http_proxy
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Talreja <[email protected]>
  • Loading branch information
Gauravtalreja1 committed Feb 13, 2025
1 parent cc8c0c8 commit e8933f5
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
14 changes: 9 additions & 5 deletions pytest_fixtures/component/http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ def session_auth_proxy(session_target_sat):
@pytest.fixture
def setup_http_proxy(request, module_manifest_org, target_sat):
"""Create a new HTTP proxy and set related settings based on proxy"""
content_proxy_value = target_sat.api.Setting().search(
query={'search': 'name=content_default_http_proxy'}
)[0]
general_proxy_value = target_sat.api.Setting().search(query={'search': 'name=http_proxy'})[0]
content_proxy_value = (
target_sat.api.Setting()
.search(query={'search': 'name=content_default_http_proxy'})[0]
.value
)
general_proxy_value = (
target_sat.api.Setting().search(query={'search': 'name=http_proxy'})[0].value
)

http_proxy = target_sat.api_factory.make_http_proxy(module_manifest_org, request.param)
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 = (
Expand Down
4 changes: 2 additions & 2 deletions robottelo/host_helpers/api_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,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(
Expand All @@ -48,7 +48,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

Expand Down
20 changes: 14 additions & 6 deletions tests/foreman/ui/test_http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})'

Expand Down

0 comments on commit e8933f5

Please sign in to comment.