Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Purpose addons related test code #17009

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions pytest_fixtures/component/rh_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ def rhcloud_manifest_org(module_target_sat, module_sca_manifest):
@pytest.fixture(scope='module')
def rhcloud_activation_key(module_target_sat, rhcloud_manifest_org):
"""A module-level fixture to create an Activation key in module_org"""
purpose_addons = "test-addon1, test-addon2"
return module_target_sat.api.ActivationKey(
content_view=rhcloud_manifest_org.default_content_view,
organization=rhcloud_manifest_org,
environment=module_target_sat.api.LifecycleEnvironment(id=rhcloud_manifest_org.library.id),
purpose_addons=[purpose_addons],
service_level='Self-Support',
purpose_usage='test-usage',
purpose_role='test-role',
Expand Down
9 changes: 0 additions & 9 deletions tests/foreman/cli/test_activationkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,22 +1051,19 @@ def test_create_ak_with_syspurpose_set(module_sca_manifest_org, module_target_sa
# Requires Cls org and manifest. Manifest is for self-support values.
new_ak = module_target_sat.cli_factory.make_activation_key(
{
'purpose-addons': "test-addon1, test-addon2",
'purpose-role': "test-role",
'purpose-usage': "test-usage",
'service-level': "Self-Support",
'organization-id': module_sca_manifest_org.id,
}
)
assert new_ak['system-purpose']['purpose-addons'] == "test-addon1, test-addon2"
assert new_ak['system-purpose']['purpose-role'] == "test-role"
assert new_ak['system-purpose']['purpose-usage'] == "test-usage"
assert new_ak['system-purpose']['service-level'] == "Self-Support"
# Check that system purpose values can be deleted.
module_target_sat.cli.ActivationKey.update(
{
'id': new_ak['id'],
'purpose-addons': '',
'purpose-role': '',
'purpose-usage': '',
'service-level': '',
Expand All @@ -1076,7 +1073,6 @@ def test_create_ak_with_syspurpose_set(module_sca_manifest_org, module_target_sa
updated_ak = module_target_sat.cli.ActivationKey.info(
{'id': new_ak['id'], 'organization-id': module_sca_manifest_org.id}
)
assert updated_ak['system-purpose']['purpose-addons'] == ''
assert updated_ak['system-purpose']['purpose-role'] == ''
assert updated_ak['system-purpose']['purpose-usage'] == ''

Expand Down Expand Up @@ -1106,15 +1102,13 @@ def test_update_ak_with_syspurpose_values(module_sca_manifest_org, module_target
org = module_sca_manifest_org
new_ak = module_target_sat.cli_factory.make_activation_key({'organization-id': org.id})
# Assert system purpose values are null after creating the AK and adding the manifest.
assert new_ak['system-purpose']['purpose-addons'] == ''
assert new_ak['system-purpose']['purpose-role'] == ''
assert new_ak['system-purpose']['purpose-usage'] == ''

# Check that system purpose values can be added to an AK.
module_target_sat.cli.ActivationKey.update(
{
'id': new_ak['id'],
'purpose-addons': "test-addon1, test-addon2",
'purpose-role': "test-role1",
'purpose-usage': "test-usage1",
'service-level': "Self-Support",
Expand All @@ -1124,15 +1118,13 @@ def test_update_ak_with_syspurpose_values(module_sca_manifest_org, module_target
updated_ak = module_target_sat.cli.ActivationKey.info(
{'id': new_ak['id'], 'organization-id': org.id}
)
assert updated_ak['system-purpose']['purpose-addons'] == "test-addon1, test-addon2"
assert updated_ak['system-purpose']['purpose-role'] == "test-role1"
assert updated_ak['system-purpose']['purpose-usage'] == "test-usage1"
assert updated_ak['system-purpose']['service-level'] == "Self-Support"
# Check that system purpose values can be updated
module_target_sat.cli.ActivationKey.update(
{
'id': new_ak['id'],
'purpose-addons': "test-addon3, test-addon4",
'purpose-role': "test-role2",
'purpose-usage': "test-usage2",
'service-level': "Premium",
Expand All @@ -1142,7 +1134,6 @@ def test_update_ak_with_syspurpose_values(module_sca_manifest_org, module_target
updated_ak = module_target_sat.cli.ActivationKey.info(
{'id': new_ak['id'], 'organization-id': org.id}
)
assert updated_ak['system-purpose']['purpose-addons'] == "test-addon3, test-addon4"
assert updated_ak['system-purpose']['purpose-role'] == "test-role2"
assert updated_ak['system-purpose']['purpose-usage'] == "test-usage2"
assert updated_ak['system-purpose']['service-level'] == "Premium"
Expand Down
5 changes: 0 additions & 5 deletions tests/foreman/cli/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -1992,12 +1992,10 @@ def test_syspurpose_end_to_end(
:parametrized: yes
"""
# Create an activation key with test values
purpose_addons = "test-addon1, test-addon2"
activation_key = target_sat.api.ActivationKey(
content_view=module_promoted_cv,
environment=module_lce,
organization=module_org,
purpose_addons=[purpose_addons],
purpose_role="test-role",
purpose_usage="test-usage",
service_level="Self-Support",
Expand All @@ -2009,14 +2007,12 @@ def test_syspurpose_end_to_end(
rhel_contenthost.enable_repo(module_rhst_repo)
host = target_sat.cli.Host.info({'name': rhel_contenthost.hostname})
# Assert system purpose values are set in the host as expected
assert host['subscription-information']['system-purpose']['purpose-addons'][0] == purpose_addons
assert host['subscription-information']['system-purpose']['purpose-role'] == "test-role"
assert host['subscription-information']['system-purpose']['purpose-usage'] == "test-usage"
assert host['subscription-information']['system-purpose']['service-level'] == "Self-Support"
# Change system purpose values in the host
target_sat.cli.Host.update(
{
'purpose-addons': "test-addon3",
'purpose-role': "test-role2",
'purpose-usage': "test-usage2",
'service-level': "Self-Support2",
Expand All @@ -2025,7 +2021,6 @@ def test_syspurpose_end_to_end(
)
host = target_sat.cli.Host.info({'id': host['id']})
# Assert system purpose values have been updated in the host as expected
assert host['subscription-information']['system-purpose']['purpose-addons'][0] == "test-addon3"
assert host['subscription-information']['system-purpose']['purpose-role'] == "test-role2"
assert host['subscription-information']['system-purpose']['purpose-usage'] == "test-usage2"
assert host['subscription-information']['system-purpose']['service-level'] == "Self-Support2"
Expand Down
Loading