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

multi cv ak displays content view environments information #16991

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
62 changes: 62 additions & 0 deletions tests/foreman/cli/test_activationkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -1581,3 +1581,65 @@ def test_positive_invalid_release_version(module_sca_manifest_org, module_target
}
)
assert update_ak[0]['message'] == 'Activation key updated.'


# -------------------------- MULTI-CV SCENARIOS -------------------------
def test_positive_multi_cv_info(
session_multicv_sat, session_multicv_org, session_multicv_default_ak
):
"""Verify that multi-env AK display into hammer activation-key info commands output

:id: 6a1c3189-74f9-4a54-8579-f3b045870cd9

:steps:
1. Create two lifecycle environments and two content views, publish/promote to respective lce
2. Create activation key and update ak with multiple content view environments
3. Check ak info displays 'Multi Content View Environment' and 'Content View Environments'

:expectedresults: AK info displays 'Multi Content View Environment' and 'Content View Environments'

:CaseImportance: Medium

:CaseComponent: ActivationKeys

:team: Phoenix-subscriptions

:parametrized: No

:Verifies: SAT-27863
"""
# Create two lifecycle environments
lce1 = session_multicv_sat.api.LifecycleEnvironment(organization=session_multicv_org).create()
lce2 = session_multicv_sat.api.LifecycleEnvironment(organization=session_multicv_org).create()

# Create two content views
cv1 = session_multicv_sat.api.ContentView(organization=session_multicv_org).create()
cv1.publish()
cv1 = cv1.read()
cv1.version[0].promote(data={'environment_ids': lce1.id})

cv2 = session_multicv_sat.api.ContentView(organization=session_multicv_org).create()
cv2.publish()
cv2 = cv2.read()
cv2.version[0].promote(data={'environment_ids': lce2.id})

# Update ak with multiple content view environments
ak = session_multicv_default_ak
cv_envs = f'{lce1.name}/{cv1.name},{lce2.name}/{cv2.name}'
ak_info = session_multicv_sat.cli.ActivationKey.info({'id': ak.id})
assert ak_info['multi-content-view-environment'] == 'no'
assert ak_info['content-view-environment-labels'] == 'Library'

ret_val = session_multicv_sat.cli.ActivationKey.update(
{
'id': ak.id,
'organization-id': session_multicv_org.id,
'content-view-environments': cv_envs,
}
)
assert ret_val[0]['message'] == 'Activation key updated.'

# Verify ak info displays 'Multi Content View Environment' and 'Content View Environments'
ak_info = session_multicv_sat.cli.ActivationKey.info({'id': ak.id})
assert ak_info['multi-content-view-environment'] == 'yes'
assert ak_info['content-view-environment-labels'] == cv_envs