Skip to content

Commit

Permalink
[RFE] Remove remaining and unused fixtures around sca only (#15923)
Browse files Browse the repository at this point in the history
* Adding pit marker for tests

* remove fixtures part one

* removing unused fixtures

* removing spacing

* remove module_entitlement fixture

* Remove extra entitlement fixtures
  • Loading branch information
ColeHiggins2 authored Sep 3, 2024
1 parent 3d020bc commit b136ced
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 128 deletions.
70 changes: 0 additions & 70 deletions pytest_fixtures/component/taxonomy.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,6 @@ def module_org_with_manifest(module_org, module_target_sat):
return module_org


@pytest.fixture(scope='module')
def module_entitlement_manifest_org(module_org, module_entitlement_manifest, module_target_sat):
"""Creates an organization and uploads an entitlement mode manifest generated with manifester"""
module_org.sca_disable()
module_target_sat.upload_manifest(module_org.id, module_entitlement_manifest.content)
return module_org


@pytest.fixture(scope='module')
def module_sca_manifest_org(module_org, module_sca_manifest, module_target_sat):
"""Creates an organization and uploads an SCA mode manifest generated with manifester"""
Expand All @@ -110,27 +102,6 @@ def class_sca_manifest_org(class_org, class_sca_manifest, class_target_sat):
return class_org


@pytest.fixture(scope='module')
def module_extra_rhel_entitlement_manifest_org(
module_target_sat,
module_org,
module_extra_rhel_entitlement_manifest,
):
"""Creates an organization and uploads an entitlement mode manifest generated by manifester and
containing more RHEL entitlements than the default entitlement manifest"""
module_org.sca_disable()
module_target_sat.upload_manifest(module_org.id, module_extra_rhel_entitlement_manifest.content)
return module_org


@pytest.fixture
def function_entitlement_manifest_org(function_org, function_entitlement_manifest, target_sat):
"""Creates an organization and uploads an entitlement mode manifest generated with manifester"""
function_org.sca_disable()
target_sat.upload_manifest(function_org.id, function_entitlement_manifest.content)
return function_org


@pytest.fixture
def upgrade_entitlement_manifest_org(function_org, upgrade_entitlement_manifest, target_sat):
"""A Pytest fixture that creates an organization and uploads an entitlement mode manifest
Expand Down Expand Up @@ -173,14 +144,6 @@ def module_gt_manifest_org(module_target_sat):
# or stage RHSM accounts.


@pytest.fixture(scope='session')
def session_entitlement_manifest():
"""Yields a manifest in entitlement mode with subscriptions determined by the
`manifest_category.entitlement` setting in conf/manifest.yaml."""
with Manifester(manifest_category=settings.manifest.entitlement) as manifest:
yield manifest


@pytest.fixture(scope='session')
def session_sca_manifest():
"""Yields a manifest in entitlement mode with subscriptions determined by the
Expand All @@ -189,22 +152,6 @@ def session_sca_manifest():
yield manifest


@pytest.fixture(scope='module')
def module_entitlement_manifest():
"""Yields a manifest in entitlement mode with subscriptions determined by the
`manifest_category.entitlement` setting in conf/manifest.yaml."""
with Manifester(manifest_category=settings.manifest.entitlement) as manifest:
yield manifest


@pytest.fixture(scope='module')
def module_extra_rhel_entitlement_manifest():
"""Yields a manifest in entitlement mode with subscriptions determined by the
'manifest_category.extra_rhel_entitlement` setting in conf/manifest.yaml."""
with Manifester(manifest_category=settings.manifest.extra_rhel_entitlement) as manifest:
yield manifest


@pytest.fixture(scope='module')
def module_extra_rhel_sca_manifest():
"""Yields a manifest in sca mode with subscriptions determined by the
Expand All @@ -231,23 +178,6 @@ def class_sca_manifest():
yield manifest


@pytest.fixture
def function_entitlement_manifest():
"""Yields a manifest in entitlement mode with subscriptions determined by the
`manifest_category.entitlement` setting in conf/manifest.yaml."""
with Manifester(manifest_category=settings.manifest.entitlement) as manifest:
yield manifest


@pytest.fixture
def function_secondary_entitlement_manifest():
"""Yields a manifest in entitlement mode with subscriptions determined by the
`manifest_category.entitlement` setting in conf/manifest.yaml.
A different one than is used in `function_entitlement_manifest_org`."""
with Manifester(manifest_category=settings.manifest.entitlement) as manifest:
yield manifest


@pytest.fixture
def function_sca_manifest():
"""Yields a manifest in Simple Content Access mode with subscriptions determined by the
Expand Down
13 changes: 0 additions & 13 deletions robottelo/host_helpers/api_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,19 +379,6 @@ def template_update(self, temp):
template.locked = True
template.update(['locked'])

def attach_custom_product_subscription(self, prod_name=None, host_name=None):
"""Attach custom product subscription to client host
:param str prod_name: custom product name
:param str host_name: client host name
"""
host = self._satellite.api.Host().search(query={'search': f'{host_name}'})[0]
product_subscription = self._satellite.api.Subscription().search(
query={'search': f'name={prod_name}'}
)[0]
self._satellite.api.HostSubscription(host=host.id).add_subscriptions(
data={'subscriptions': [{'id': product_subscription.id, 'quantity': 1}]}
)

def wait_for_errata_applicability_task(
self,
host_id,
Expand Down
25 changes: 0 additions & 25 deletions tests/foreman/cli/test_contentaccess.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,31 +176,6 @@ def test_positive_erratum_installable(vm, module_target_sat):
assert erratum[0]['installable'] == 'true'


@pytest.mark.tier2
def test_negative_rct_not_shows_sca_enabled(
target_sat, function_org, function_entitlement_manifest
):
"""Assert restricted (entitlement) manifest does not show SCA enabled.
:id: 754c1be7-468e-4795-bcf9-258a38f3418b
:steps:
1. Run `rct cat-manifest /tmp/restricted_manifest.zip`.
:expectedresults:
1. Assert `Content Access Mode: Simple Content Access` is not present.
:CaseImportance: High
"""
# upload organization manifest with org environment access disabled
org = function_org
manifest = function_entitlement_manifest
target_sat.upload_manifest(org.id, manifest, interface='CLI')
result = target_sat.execute(f'rct cat-manifest {manifest.name}')
assert result.status == 0
assert 'Content Access Mode: Simple Content Access' not in result.stdout


@pytest.mark.tier2
@pytest.mark.upgrade
def test_positive_rct_shows_sca_enabled(module_sca_manifest, module_target_sat):
Expand Down
17 changes: 0 additions & 17 deletions tests/foreman/cli/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -1836,23 +1836,6 @@ def test_positive_install_package_via_rex(
assert len(installed_packages) == 1


# -------------------------- HOST SUBSCRIPTION SUBCOMMAND FIXTURES --------------------------


@pytest.fixture
def ak_with_subscription(
target_sat, module_org, module_promoted_cv, module_lce, default_subscription
):
activation_key = target_sat.api.ActivationKey(
content_view=module_promoted_cv,
organization=module_org,
environment=module_lce,
auto_attach=False,
).create()
activation_key.add_subscriptions(data={'subscription_id': default_subscription.id})
return activation_key


# -------------------------- HOST SUBSCRIPTION SUBCOMMAND SCENARIOS -------------------------
@pytest.mark.rhel_ver_match('9')
@pytest.mark.cli_host_subscription
Expand Down
3 changes: 1 addition & 2 deletions tests/foreman/ui/test_activationkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -1081,8 +1081,7 @@ def test_positive_ak_with_custom_product_on_rhel6(rhel_contenthost, target_sat):
:steps:
1. Create a custom repo
2. Create ak and add custom repo to ak
3. Add subscriptions to the ak
4. Register a rhel6 chost with the ak
3. Register a rhel6 chost with the ak
:expectedresults: Host is registered successfully
Expand Down
2 changes: 1 addition & 1 deletion tests/upgrades/test_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class TestScenarioCustomRepoCheck:
1. Before Satellite upgrade.
2. Create new Organization and Location.
3. Create Product, custom repo, cv.
4. Create activation key and add subscription in it.
4. Create activation key.
5. Create a content host, register and install package on it.
6. Upgrade Satellite.
7. Remove Old package and add new package into custom repo.
Expand Down

0 comments on commit b136ced

Please sign in to comment.