Skip to content

Commit

Permalink
Fix cli contenthost tests (#15991)
Browse files Browse the repository at this point in the history
if a key's value is zero the key is not displayed anymore
but removed.
  • Loading branch information
dosas committed Sep 5, 2024
1 parent 57e34a2 commit 706ae54
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions tests/foreman/cli/test_contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def test_positive_remove_lce_by_id_and_reassign_ak(self, module_org, module_targ
source_cv = module_target_sat.cli.ContentView.info({'id': source_cv['id']})
assert source_cv['activation-keys'][0] == ac_key['name']
destination_cv = module_target_sat.cli.ContentView.info({'id': destination_cv['id']})
assert len(destination_cv['activation-keys']) == 0
assert 'activation-keys' not in destination_cv

module_target_sat.cli.ContentView.remove(
{
Expand All @@ -515,7 +515,7 @@ def test_positive_remove_lce_by_id_and_reassign_ak(self, module_org, module_targ
}
)
source_cv = module_target_sat.cli.ContentView.info({'id': source_cv['id']})
assert len(source_cv['activation-keys']) == 0
assert 'activation-keys' not in source_cv
destination_cv = module_target_sat.cli.ContentView.info({'id': destination_cv['id']})
assert destination_cv['activation-keys'][0] == ac_key['name']

Expand Down Expand Up @@ -670,7 +670,7 @@ def test_positive_remove_repository_by_id(self, module_org, module_product, modu
{'id': new_cv['id'], 'repository-id': new_repo['id']}
)
new_cv = module_target_sat.cli.ContentView.info({'id': new_cv['id']})
assert len(new_cv['yum-repositories']) == 0
assert 'yum-repositories' not in new_cv

@pytest.mark.tier1
def test_positive_remove_repository_by_name(
Expand Down Expand Up @@ -702,7 +702,7 @@ def test_positive_remove_repository_by_name(
{'id': new_cv['id'], 'repository': new_repo['name']}
)
new_cv = module_target_sat.cli.ContentView.info({'id': new_cv['id']})
assert len(new_cv['yum-repositories']) == 0
assert 'yum-repositories' not in new_cv

@pytest.mark.tier2
def test_positive_remove_version_by_id_from_composite(
Expand Down Expand Up @@ -807,7 +807,7 @@ def test_positive_remove_component_by_name(self, module_org, module_product, mod
}
)
comp_cv = module_target_sat.cli.ContentView.info({'id': comp_cv['id']})
assert len(comp_cv['components']) == 0
assert 'components' not in comp_cv

@pytest.mark.tier3
def test_positive_create_composite_with_component_ids(self, module_org, module_target_sat):
Expand Down Expand Up @@ -1296,9 +1296,7 @@ def test_negative_promote_default_cv(self, module_org, module_target_sat):
{'organization-id': module_org.id}
)
print("Hello, the org ID is currently", module_org.id)
result = module_target_sat.cli.ContentView.list(
{'organization-id': module_org.id}, per_page=False
)
result = module_target_sat.cli.ContentView.list({'organization-id': module_org.id})
content_view = random.choice([cv for cv in result if cv['name'] == constants.DEFAULT_CV])
cvv = module_target_sat.cli.ContentView.version_list(
{'content-view-id': content_view['content-view-id']}
Expand Down Expand Up @@ -1571,7 +1569,7 @@ def test_positive_republish_after_content_removed(
'yum-repositories',
'container-image-repositories',
]:
assert len(new_cv[repo_type]) == 0
assert repo_type not in new_cv
# Publish a new version of CV
module_target_sat.cli.ContentView.publish({'id': new_cv['id']})
new_cv = module_target_sat.cli.ContentView.info({'id': new_cv['id']})
Expand Down

0 comments on commit 706ae54

Please sign in to comment.