Skip to content

Commit

Permalink
[6.12.5] Cherry-pick for uploading expired manifest (#12264)
Browse files Browse the repository at this point in the history
* added test for expired manifest

* Pr fixes to upload manifest

* updated assertion to new error message

* removed outdated import

* updating assertion to older return message
  • Loading branch information
ColeHiggins2 authored Aug 17, 2023
1 parent 450707b commit 67a557d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/foreman/api/test_repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
:Upstream: No
"""
import pytest
from manifester import Manifester
from nailgun import entities
from nailgun.entity_mixins import call_entity_method_with_timeout
from requests.exceptions import HTTPError

from robottelo import constants
from robottelo.api.utils import enable_rhrepo_and_fetchid
from robottelo.cli.base import CLIReturnCodeError
from robottelo.config import settings
from robottelo.constants import MIRRORING_POLICIES
from robottelo.utils.datafactory import parametrized
Expand Down Expand Up @@ -191,3 +193,29 @@ def test_positive_sync_kickstart_repo(module_entitlement_manifest_org, target_sa
rh_repo = rh_repo.read()
assert rh_repo.content_counts['package_group'] > 0
assert rh_repo.content_counts['rpm'] > 0


@pytest.mark.tier1
def test_negative_upload_expired_manifest(module_org, target_sat):
"""Upload an expired manifest and attempt to refresh it
:id: d6e652d8-5f46-4d15-9191-d842466d45d0
:Steps:
1. Upload a manifest
2. Delete the Subscription Allocation on RHSM
3. Attempt to refresh the manifest
:expectedresults: Manifest refresh should fail and return error message
"""
manifester = Manifester(manifest_category=settings.manifest.entitlement)
manifest = manifester.get_manifest()
target_sat.upload_manifest(module_org.id, manifest.content)
manifester.delete_subscription_allocation()
with pytest.raises(CLIReturnCodeError) as error:
target_sat.cli.Subscription.refresh_manifest({'organization-id': module_org.id})
assert (
'The Subscription Allocation providing the imported manifest has been removed. '
'Please create a new Subscription Allocation and import the new manifest'
in error.value.stderr
)

0 comments on commit 67a557d

Please sign in to comment.