Skip to content

Commit

Permalink
fix tests from repositories component
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaysawant committed Sep 5, 2024
1 parent 706ae54 commit 7310f16
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tests/foreman/api/test_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ def test_positive_filter_product_list(module_sca_manifest_org, module_target_sat
query={'redhat_only': True, 'per_page': 1000}
)

assert len(custom_products) == 1
assert product.name == custom_products[0].name
assert len(custom_products) >= 1
assert product.name in (custom_prod.name for custom_prod in custom_products)
assert 'Red Hat Beta' not in (prod.name for prod in custom_products)

assert len(rh_products) > 1
Expand Down
12 changes: 10 additions & 2 deletions tests/foreman/api/test_repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def test_positive_sync_upstream_repo_with_zst_compression(

@pytest.mark.tier1
@pytest.mark.manifester
def test_negative_upload_expired_manifest(module_org, target_sat):
def test_negative_upload_expired_manifest(request, module_org, target_sat):
"""Upload an expired manifest and attempt to refresh it
:id: d6e652d8-5f46-4d15-9191-d842466d45d0
Expand All @@ -241,6 +241,9 @@ def test_negative_upload_expired_manifest(module_org, target_sat):
manifester = Manifester(manifest_category=settings.manifest.golden_ticket)
manifest = manifester.get_manifest()
target_sat.upload_manifest(module_org.id, manifest.content)
request.addfinalizer(
lambda: target_sat.cli.Subscription.delete_manifest({'organization-id': module_org.id})
)
manifester.delete_subscription_allocation()
with pytest.raises(CLIReturnCodeError) as error:
target_sat.cli.Subscription.refresh_manifest({'organization-id': module_org.id})
Expand Down Expand Up @@ -296,6 +299,7 @@ def test_positive_sync_mulitple_large_repos(module_target_sat, module_sca_manife
"""
repo_names = ['rhel8_bos', 'rhel8_aps']
kickstart_names = ['rhel8_bos', 'rhel8_aps']
all_repo_ids = []
for name in repo_names:
rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch=DEFAULT_ARCHITECTURE,
Expand All @@ -305,6 +309,7 @@ def test_positive_sync_mulitple_large_repos(module_target_sat, module_sca_manife
reposet=REPOS[name]['reposet'],
releasever=REPOS[name]['releasever'],
)
all_repo_ids.append(rh_repo_id)

for name in kickstart_names:
rh_repo_id = module_target_sat.api_factory.enable_rhrepo_and_fetchid(
Expand All @@ -315,9 +320,12 @@ def test_positive_sync_mulitple_large_repos(module_target_sat, module_sca_manife
reposet=constants.REPOS['kickstart'][name]['reposet'],
releasever=constants.REPOS['kickstart'][name]['version'],
)
all_repo_ids.append(rh_repo_id)
rh_repos = module_target_sat.api.Repository(id=rh_repo_id).read()
rh_products = module_target_sat.api.Product(id=rh_repos.product.id).read()
assert len(rh_products.repository) == 4
assert len(rh_products.repository) >= 4
for repo in rh_products.repository:
assert repo.id in all_repo_ids, f'repository id {repo.id} not in {all_repo_ids}'
res = module_target_sat.api.ProductBulkAction().sync(
data={'ids': [rh_products.id]}, timeout=2000
)
Expand Down

0 comments on commit 7310f16

Please sign in to comment.