Skip to content

Commit

Permalink
Using module_product and _org
Browse files Browse the repository at this point in the history
  • Loading branch information
damoore044 committed May 18, 2023
1 parent 0a2910e commit c620aea
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/foreman/api/test_http_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def test_positive_assign_http_proxy_to_products():


@pytest.mark.tier2
def test_positive_sync_proxy_with_certificate(request, target_sat):
def test_positive_sync_proxy_with_certificate(request, target_sat, module_org, module_product):
"""Assign http_proxy with ca.crt to Repo and test
whether http_proxy and cert are used during sync.
Expand All @@ -293,27 +293,26 @@ def test_positive_sync_proxy_with_certificate(request, target_sat):
proxy_host = settings.http_proxy.auth_proxy_url.replace("http://", "").replace(":3128", "")
cacert_path = '/root/cacert.crt'

# Create and fetch new cerfiticate
target_sat.custom_cert_generate(proxy_host)
# Pull cert contents from the Satellite
cacert = target_sat.execute(f'cat {cacert_path}').stdout
assert "BEGIN CERTIFICATE" and "END CERTIFICATE" in cacert
# Create org, HTTP_Proxy, and repo
org = target_sat.api.Organization().create()

# Create HTTP_Proxy and repository
http_proxy = target_sat.api.HTTPProxy(
name=gen_string('alpha', 15),
url=settings.http_proxy.auth_proxy_url,
username=settings.http_proxy.username,
password=settings.http_proxy.password,
organization=[org],
organization=[module_org],
cacert=cacert_path,
).create()
product = target_sat.api.Product(organization=org).create()
repo = target_sat.api.Repository(
product=product,
product=module_product,
http_proxy_policy='use_selected_http_proxy',
http_proxy_id=http_proxy.id,
).create()
product.update()
module_product.update()

assert repo.http_proxy_policy == 'use_selected_http_proxy'
assert repo.http_proxy_id == http_proxy.id
Expand Down

0 comments on commit c620aea

Please sign in to comment.