From 84357498837b5550e4b61ccab9d9630f79b048df Mon Sep 17 00:00:00 2001 From: vijaysawant Date: Fri, 22 Nov 2024 22:54:16 +0530 Subject: [PATCH 1/6] multi cv ak displays content view environments information --- tests/foreman/cli/test_activationkey.py | 60 +++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/foreman/cli/test_activationkey.py b/tests/foreman/cli/test_activationkey.py index 2910395d328..7a4c9cb24eb 100644 --- a/tests/foreman/cli/test_activationkey.py +++ b/tests/foreman/cli/test_activationkey.py @@ -1581,3 +1581,63 @@ 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 + """ + # 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 From a5c5f68b02199d446ac33a24c3fb65f0f7b08c00 Mon Sep 17 00:00:00 2001 From: vijaysawant Date: Fri, 22 Nov 2024 23:03:58 +0530 Subject: [PATCH 2/6] added testimony tocken --- tests/foreman/cli/test_activationkey.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/foreman/cli/test_activationkey.py b/tests/foreman/cli/test_activationkey.py index 7a4c9cb24eb..c4f5188c088 100644 --- a/tests/foreman/cli/test_activationkey.py +++ b/tests/foreman/cli/test_activationkey.py @@ -1605,6 +1605,8 @@ def test_positive_multi_cv_info( :team: Phoenix-subscriptions :parametrized: No + + :Verifies: SAT-27863 """ # Create two lifecycle environments lce1 = session_multicv_sat.api.LifecycleEnvironment(organization=session_multicv_org).create() From b66f5a91cf1838d657d960dcbf788f9e59c5e1d2 Mon Sep 17 00:00:00 2001 From: vijaysawant Date: Mon, 25 Nov 2024 15:06:58 +0530 Subject: [PATCH 3/6] addressed review comments --- tests/foreman/cli/test_activationkey.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/foreman/cli/test_activationkey.py b/tests/foreman/cli/test_activationkey.py index c4f5188c088..a2eb8513d8e 100644 --- a/tests/foreman/cli/test_activationkey.py +++ b/tests/foreman/cli/test_activationkey.py @@ -1587,25 +1587,19 @@ def test_positive_invalid_release_version(module_sca_manifest_org, module_target 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 + """Verify that multi content view environment details displays 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' + 3. Check that 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 From 8e656dfdafdd5d27dcc91ae28e8f5b5adfa5a0d2 Mon Sep 17 00:00:00 2001 From: vijaysawant Date: Tue, 26 Nov 2024 14:13:50 +0530 Subject: [PATCH 4/6] worked on review comments, used list comprehension instead of simple repeated statements --- tests/foreman/cli/test_activationkey.py | 28 ++++++++++++++----------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/tests/foreman/cli/test_activationkey.py b/tests/foreman/cli/test_activationkey.py index a2eb8513d8e..143b9dea1f8 100644 --- a/tests/foreman/cli/test_activationkey.py +++ b/tests/foreman/cli/test_activationkey.py @@ -1603,19 +1603,23 @@ def test_positive_multi_cv_info( :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() - + lces_list = [ + session_multicv_sat.api.LifecycleEnvironment(organization=session_multicv_org).create() + for i in range(2) + ] + lce1 = lces_list[0] + lce2 = lces_list[1] # 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}) + cvs_list = [ + session_multicv_sat.api.ContentView(organization=session_multicv_org).create() + for i in range(2) + ] + for i in range(2): + cvs_list[i].publish() + cvs_list[i] = cvs_list[i].read() + cvs_list[i].version[0].promote(data={'environment_ids': lces_list[i].id}) + cv1 = cvs_list[0] + cv2 = cvs_list[1] # Update ak with multiple content view environments ak = session_multicv_default_ak From 73262a6a21150f25d75c8663564acd70685102f1 Mon Sep 17 00:00:00 2001 From: vijay sawant Date: Tue, 26 Nov 2024 14:51:35 +0530 Subject: [PATCH 5/6] Update tests/foreman/cli/test_activationkey.py Co-authored-by: vsedmik <46570670+vsedmik@users.noreply.github.com> --- tests/foreman/cli/test_activationkey.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/foreman/cli/test_activationkey.py b/tests/foreman/cli/test_activationkey.py index 143b9dea1f8..65491185b77 100644 --- a/tests/foreman/cli/test_activationkey.py +++ b/tests/foreman/cli/test_activationkey.py @@ -1607,8 +1607,7 @@ def test_positive_multi_cv_info( session_multicv_sat.api.LifecycleEnvironment(organization=session_multicv_org).create() for i in range(2) ] - lce1 = lces_list[0] - lce2 = lces_list[1] + lce1, lce2 = lces_list # Create two content views cvs_list = [ session_multicv_sat.api.ContentView(organization=session_multicv_org).create() From a86e724c1b20b5b9b8cc46865f72760006dc8980 Mon Sep 17 00:00:00 2001 From: vijay sawant Date: Tue, 26 Nov 2024 14:52:01 +0530 Subject: [PATCH 6/6] Update tests/foreman/cli/test_activationkey.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ladislav VaĊĦina --- tests/foreman/cli/test_activationkey.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/foreman/cli/test_activationkey.py b/tests/foreman/cli/test_activationkey.py index 65491185b77..b6c7f984ddd 100644 --- a/tests/foreman/cli/test_activationkey.py +++ b/tests/foreman/cli/test_activationkey.py @@ -1617,8 +1617,7 @@ def test_positive_multi_cv_info( cvs_list[i].publish() cvs_list[i] = cvs_list[i].read() cvs_list[i].version[0].promote(data={'environment_ids': lces_list[i].id}) - cv1 = cvs_list[0] - cv2 = cvs_list[1] + cv1, cv2 = cvs_list # Update ak with multiple content view environments ak = session_multicv_default_ak