Skip to content

Commit

Permalink
add teardown condition to execute other test seamlessly (#16219)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaysawant authored Sep 5, 2024
1 parent 706ae54 commit 88e23d9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/foreman/cli/test_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def test_positive_auto_attach_disabled_golden_ticket(
assert "This host's organization is in Simple Content Access mode" in str(context.value)


def test_negative_check_katello_reimport(target_sat, function_org):
def test_negative_check_katello_reimport(request, target_sat, function_org):
"""Verify katello:reimport trace should not fail with an TypeError
:id: b7508a1c-7798-4649-83a3-cf94c7409c96
Expand All @@ -297,6 +297,7 @@ def test_negative_check_katello_reimport(target_sat, function_org):
:BZ: 2225534, 2253621
"""
request.addfinalizer(lambda: function_org.delete())
remote_path = f'/tmp/{EXPIRED_MANIFEST}'
target_sat.put(DataFile.EXPIRED_MANIFEST_FILE, remote_path)
# Import expired manifest & refresh
Expand All @@ -307,13 +308,16 @@ def test_negative_check_katello_reimport(target_sat, function_org):
'grep -i "Katello::HttpErrors::BadRequest: This Organization\'s subscription '
'manifest has expired. Please import a new manifest" /var/log/foreman/production.log'
)
assert exec_val.status
assert exec_val.status == 0
# Delete expired manifest
target_sat.cli.Subscription.delete_manifest({'organization-id': function_org.id})
# Re-import new manifest & refresh
manifester = Manifester(manifest_category=settings.manifest.golden_ticket)
manifest = manifester.get_manifest()
target_sat.upload_manifest(function_org.id, manifest.content)
request.addfinalizer(
lambda: target_sat.cli.Subscription.delete_manifest({'organization-id': function_org.id})
)
ret_val = target_sat.cli.Subscription.refresh_manifest({'organization-id': function_org.id})
assert 'Candlepin job status: SUCCESS' in ret_val
# Additional check, katello:reimport trace should not fail with TypeError
Expand Down

0 comments on commit 88e23d9

Please sign in to comment.