Skip to content

Commit

Permalink
[Comp Eval] Change CV CLI/API tests to use SCA Org (#15032)
Browse files Browse the repository at this point in the history
Change CV CLI/API tests to use SCA Org
  • Loading branch information
sambible authored May 13, 2024
1 parent cced351 commit 01808a8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 36 deletions.
10 changes: 4 additions & 6 deletions tests/foreman/api/test_contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,14 +911,12 @@ class TestContentViewRedHatContent:
"""Tests for publishing and promoting content views."""

@pytest.fixture(scope='class', autouse=True)
def initiate_testclass(
self, request, module_cv, module_entitlement_manifest_org, class_target_sat
):
def initiate_testclass(self, request, module_cv, module_sca_manifest_org, class_target_sat):
"""Set up organization, product and repositories for tests."""

repo_id = class_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch='x86_64',
org_id=module_entitlement_manifest_org.id,
org_id=module_sca_manifest_org.id,
product=PRDS['rhel'],
repo=REPOS['rhst7']['name'],
reposet=REPOSET['rhst7'],
Expand Down Expand Up @@ -1322,12 +1320,12 @@ class TestContentViewRedHatOstreeContent:
"""Tests for publishing and promoting cv with RH ostree contents."""

@pytest.fixture(scope='class', autouse=True)
def initiate_testclass(self, request, module_entitlement_manifest_org, class_target_sat):
def initiate_testclass(self, request, module_sca_manifest_org, class_target_sat):
"""Set up organization, product and repositories for tests."""

repo_id = class_target_sat.api_factory.enable_rhrepo_and_fetchid(
basearch=None,
org_id=module_entitlement_manifest_org.id,
org_id=module_sca_manifest_org.id,
product=PRDS['rhah'],
repo=REPOS['rhaht']['name'],
reposet=REPOSET['rhaht'],
Expand Down
60 changes: 30 additions & 30 deletions tests/foreman/cli/test_contentview.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@


@pytest.fixture(scope='module')
def module_rhel_content(module_entitlement_manifest_org, module_target_sat):
def module_rhel_content(module_sca_manifest_org, module_target_sat):
"""Returns RH repo after syncing it"""
product = entities.Product(
name=constants.PRDS['rhel'], organization=module_entitlement_manifest_org
name=constants.PRDS['rhel'], organization=module_sca_manifest_org
).search()[0]
reposet = entities.RepositorySet(name=constants.REPOSET['rhva6'], product=product).search()[0]
data = {'basearch': 'x86_64', 'releasever': '6Server', 'product_id': product.id}
Expand All @@ -48,14 +48,14 @@ def module_rhel_content(module_entitlement_manifest_org, module_target_sat):
repo = module_target_sat.cli.Repository.info(
{
'name': constants.REPOS['rhva6']['name'],
'organization-id': module_entitlement_manifest_org.id,
'organization-id': module_sca_manifest_org.id,
'product': product.name,
}
)
module_target_sat.cli.Repository.synchronize(
{
'name': constants.REPOS['rhva6']['name'],
'organization-id': module_entitlement_manifest_org.id,
'organization-id': module_sca_manifest_org.id,
'product': product.name,
}
)
Expand Down Expand Up @@ -837,7 +837,7 @@ def test_positive_update_composite_with_component_ids(module_org, module_target_
@pytest.mark.tier3
@pytest.mark.upgrade
def test_positive_add_rh_repo_by_id_and_create_filter(
self, module_entitlement_manifest_org, module_rhel_content, module_target_sat
self, module_sca_manifest_org, module_rhel_content, module_target_sat
):
"""Associate Red Hat content to a content view and create filter
Expand All @@ -856,13 +856,13 @@ def test_positive_add_rh_repo_by_id_and_create_filter(
"""
# Create CV
new_cv = module_target_sat.cli_factory.make_content_view(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)
# Associate repo to CV
module_target_sat.cli.ContentView.add_repository(
{
'id': new_cv['id'],
'organization-id': module_entitlement_manifest_org.id,
'organization-id': module_sca_manifest_org.id,
'repository-id': module_rhel_content['id'],
}
)
Expand Down Expand Up @@ -997,7 +997,7 @@ def test_negative_add_same_yum_repo_twice(self, module_org, module_product, modu
@pytest.mark.run_in_one_thread
@pytest.mark.tier2
def test_positive_promote_rh_content(
self, module_entitlement_manifest_org, module_rhel_content, module_target_sat
self, module_sca_manifest_org, module_rhel_content, module_target_sat
):
"""attempt to promote a content view containing RH content
Expand All @@ -1012,7 +1012,7 @@ def test_positive_promote_rh_content(
"""
# Create CV
new_cv = module_target_sat.cli_factory.make_content_view(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)
# Associate repo to CV
module_target_sat.cli.ContentView.add_repository(
Expand All @@ -1022,7 +1022,7 @@ def test_positive_promote_rh_content(
module_target_sat.cli.ContentView.publish({'id': new_cv['id']})
new_cv = module_target_sat.cli.ContentView.info({'id': new_cv['id']})
env1 = module_target_sat.cli_factory.make_lifecycle_environment(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)
# Promote the Published version of CV to the next env
module_target_sat.cli.ContentView.version_promote(
Expand All @@ -1035,7 +1035,7 @@ def test_positive_promote_rh_content(
@pytest.mark.run_in_one_thread
@pytest.mark.tier3
def test_positive_promote_rh_and_custom_content(
self, module_entitlement_manifest_org, module_rhel_content, module_target_sat
self, module_sca_manifest_org, module_rhel_content, module_target_sat
):
"""attempt to promote a content view containing RH content and
custom content using filters
Expand All @@ -1054,15 +1054,15 @@ def test_positive_promote_rh_and_custom_content(
{
'content-type': 'yum',
'product-id': module_target_sat.cli_factory.make_product(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)['id'],
}
)
# Sync custom repo
module_target_sat.cli.Repository.synchronize({'id': new_repo['id']})
# Create CV
new_cv = module_target_sat.cli_factory.make_content_view(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)
# Associate repos with CV
module_target_sat.cli.ContentView.add_repository(
Expand All @@ -1085,7 +1085,7 @@ def test_positive_promote_rh_and_custom_content(
module_target_sat.cli.ContentView.publish({'id': new_cv['id']})
new_cv = module_target_sat.cli.ContentView.info({'id': new_cv['id']})
env1 = module_target_sat.cli_factory.make_lifecycle_environment(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)
# Promote the Published version of CV to the next env
module_target_sat.cli.ContentView.version_promote(
Expand Down Expand Up @@ -1272,7 +1272,7 @@ def test_negative_promote_with_invalid_lce(self, module_org, module_product, mod
@pytest.mark.pit_server
@pytest.mark.tier3
def test_positive_publish_rh_and_custom_content(
self, module_entitlement_manifest_org, module_rhel_content, module_target_sat
self, module_sca_manifest_org, module_rhel_content, module_target_sat
):
"""attempt to publish a content view containing a RH and custom
repos and has filters
Expand All @@ -1291,15 +1291,15 @@ def test_positive_publish_rh_and_custom_content(
{
'content-type': 'yum',
'product-id': module_target_sat.cli_factory.make_product(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)['id'],
}
)
# Sync custom repo
module_target_sat.cli.Repository.synchronize({'id': new_repo['id']})
# Create CV
new_cv = module_target_sat.cli_factory.make_content_view(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)
# Associate repos with CV
module_target_sat.cli.ContentView.add_repository(
Expand Down Expand Up @@ -1499,7 +1499,7 @@ def test_positive_republish_after_content_removed(
@pytest.mark.run_in_one_thread
@pytest.mark.tier2
def test_positive_republish_after_rh_content_removed(
self, module_entitlement_manifest_org, module_rhel_content, module_target_sat
self, module_sca_manifest_org, module_rhel_content, module_target_sat
):
"""Attempt to re-publish content view after all RH associated content
was removed from that CV
Expand All @@ -1518,13 +1518,13 @@ def test_positive_republish_after_rh_content_removed(
:CaseImportance: Medium
"""
new_cv = module_target_sat.cli_factory.make_content_view(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)
# Associate repo to CV
module_target_sat.cli.ContentView.add_repository(
{
'id': new_cv['id'],
'organization-id': module_entitlement_manifest_org.id,
'organization-id': module_sca_manifest_org.id,
'repository-id': module_rhel_content['id'],
}
)
Expand Down Expand Up @@ -1668,7 +1668,7 @@ def test_positive_auto_update_composite_to_latest_cv_version(
@pytest.mark.run_in_one_thread
@pytest.mark.tier3
def test_positive_subscribe_chost_by_id_using_rh_content(
self, module_entitlement_manifest_org, module_rhel_content, module_target_sat
self, module_sca_manifest_org, module_rhel_content, module_target_sat
):
"""Attempt to subscribe content host to content view that has
Red Hat repository assigned to it
Expand All @@ -1681,15 +1681,15 @@ def test_positive_subscribe_chost_by_id_using_rh_content(
:CaseImportance: Medium
"""
env = module_target_sat.cli_factory.make_lifecycle_environment(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)
content_view = module_target_sat.cli_factory.make_content_view(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)
module_target_sat.cli.ContentView.add_repository(
{
'id': content_view['id'],
'organization-id': module_entitlement_manifest_org.id,
'organization-id': module_sca_manifest_org.id,
'repository-id': module_rhel_content['id'],
}
)
Expand All @@ -1708,7 +1708,7 @@ def test_positive_subscribe_chost_by_id_using_rh_content(
'content-view-id': content_view['id'],
'lifecycle-environment-id': env['id'],
'name': gen_alphanumeric(),
'organization-id': module_entitlement_manifest_org.id,
'organization-id': module_sca_manifest_org.id,
}
)
content_view = module_target_sat.cli.ContentView.info({'id': content_view['id']})
Expand All @@ -1718,7 +1718,7 @@ def test_positive_subscribe_chost_by_id_using_rh_content(
@pytest.mark.tier3
@pytest.mark.upgrade
def test_positive_subscribe_chost_by_id_using_rh_content_and_filters(
self, module_entitlement_manifest_org, module_rhel_content, module_target_sat
self, module_sca_manifest_org, module_rhel_content, module_target_sat
):
"""Attempt to subscribe content host to filtered content view
that has Red Hat repository assigned to it
Expand All @@ -1733,15 +1733,15 @@ def test_positive_subscribe_chost_by_id_using_rh_content_and_filters(
:CaseImportance: Low
"""
env = module_target_sat.cli_factory.make_lifecycle_environment(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)
content_view = module_target_sat.cli_factory.make_content_view(
{'organization-id': module_entitlement_manifest_org.id}
{'organization-id': module_sca_manifest_org.id}
)
module_target_sat.cli.ContentView.add_repository(
{
'id': content_view['id'],
'organization-id': module_entitlement_manifest_org.id,
'organization-id': module_sca_manifest_org.id,
'repository-id': module_rhel_content['id'],
}
)
Expand Down Expand Up @@ -1781,7 +1781,7 @@ def test_positive_subscribe_chost_by_id_using_rh_content_and_filters(
'content-view-id': content_view['id'],
'lifecycle-environment-id': env['id'],
'name': gen_alphanumeric(),
'organization-id': module_entitlement_manifest_org.id,
'organization-id': module_sca_manifest_org.id,
}
)
content_view = module_target_sat.cli.ContentView.info({'id': content_view['id']})
Expand Down

0 comments on commit 01808a8

Please sign in to comment.