Skip to content

Commit

Permalink
UI fixture updates for combined sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
damoore044 committed Apr 17, 2024
1 parent 30cc9de commit 3c9e557
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions tests/foreman/ui/test_errata.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,22 +210,23 @@ def _publish_and_wait(sat, org, cv):


@pytest.fixture
def errata_host_ak(module_target_sat, module_org, module_lce):
def errata_host_ak(module_target_sat, module_sca_manifest_org, module_lce):
"""New activation key created in module_org and module_lce"""
ak = module_target_sat.api.ActivationKey(
organization=module_org,
organization=module_sca_manifest_org,
environment=module_lce,
).create()
return ak.read()


@pytest.fixture
def registered_contenthost(
module_sca_manifest_org,
module_target_sat,
rhel_contenthost,
errata_host_ak,
module_org,
module_lce,
module_ak,
module_cv,
request,
repos=None,
Expand Down Expand Up @@ -261,7 +262,7 @@ def registered_contenthost(
custom_repo_info = module_target_sat.cli_factory.setup_org_for_a_custom_repo(
{
'url': repo_url,
'organization-id': module_org.id,
'organization-id': module_sca_manifest_org.id,
'lifecycle-environment-id': module_lce.id,
'activationkey-id': errata_host_ak.id,
'content-view-id': module_cv.id,
Expand All @@ -271,11 +272,11 @@ def registered_contenthost(
custom_repos.append(custom_repo_info['repository-id'])

# Publish new version and promote with all content
cv_publish_promote(module_target_sat, module_org, module_cv, module_lce)
cv_publish_promote(module_target_sat, module_sca_manifest_org, module_cv, module_lce)
result = rhel_contenthost.register(
activation_keys=errata_host_ak.name,
target=module_target_sat,
org=module_org,
org=module_sca_manifest_org,
loc=None,
)
assert result.status == 0, f'Failed to register host:\n{result.stderr}'
Expand All @@ -292,23 +293,24 @@ def registered_contenthost(
yield rhel_contenthost

@request.addfinalizer
# Cleanup for in between parameterized runs
# Cleanup for in-between parameterized session
def cleanup():
nonlocal rhel_contenthost, module_cv, custom_repos, custom_products, errata_host_ak
nonlocal rhel_contenthost, module_cv, custom_repos, custom_products, errata_host_ak, module_ak, module_sca_manifest_org
rhel_contenthost.unregister()
errata_host_ak.delete()
module_ak.delete()
# Remove CV from all lifecycle-environments
module_target_sat.cli.ContentView.remove_from_environment(
{
'id': module_cv.id,
'organization-id': module_org.id,
'organization-id': module_sca_manifest_org.id,
'lifecycle-environment-id': module_lce.id,
}
)
module_target_sat.cli.ContentView.remove_from_environment(
{
'id': module_cv.id,
'organization-id': module_org.id,
'organization-id': module_sca_manifest_org.id,
'lifecycle-environment': 'Library',
}
)
Expand All @@ -327,9 +329,6 @@ def cleanup():
module_target_sat.api.Repository(id=repo_id).delete()
for product_id in custom_products:
module_target_sat.api.Product(id=product_id).delete()
# Publish a new CV version with no content
module_cv = module_cv.read()
module_cv.publish()


@pytest.mark.e2e
Expand Down Expand Up @@ -1119,7 +1118,7 @@ def test_positive_check_errata(session, module_org_with_parameter, registered_co
[[CUSTOM_REPO_URL]],
indirect=True,
)
def test_positive_errata_search_type(session, registered_contenthost):
def test_positive_errata_search_type(session, module_sca_manifest_org, registered_contenthost):
"""Search for errata on a host's page content-errata tab by type.
:id: f278f0e8-3b64-4dbf-a0c8-b9b289474a76
Expand Down Expand Up @@ -1292,7 +1291,7 @@ def test_positive_show_count_on_host_pages(session, module_org, registered_conte
)
def test_positive_check_errata_counts_by_type_on_host_details_page(
session,
module_org,
module_sca_manifest_org,
registered_contenthost,
):
"""Errata count on host page
Expand Down

0 comments on commit 3c9e557

Please sign in to comment.