From a988779d8e179cbf974b64ff8de1caead0c9feba Mon Sep 17 00:00:00 2001 From: amol patil Date: Wed, 20 Nov 2024 21:31:26 +0530 Subject: [PATCH] variable value should del after update --- tests/foreman/ui/test_ansible.py | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/tests/foreman/ui/test_ansible.py b/tests/foreman/ui/test_ansible.py index df00f9ec0a..0416edf29c 100644 --- a/tests/foreman/ui/test_ansible.py +++ b/tests/foreman/ui/test_ansible.py @@ -151,12 +151,14 @@ def test_positive_assign_ansible_role_variable_on_host( module_org, module_location, ): - """Verify ansible variable is added to the role and attached to the host. + """Verify ansible variable is added to the role and attached to the host and delete updated value in variable :id: 7ec4fe19-5a08-4b10-bb4e-7327dd68699a :BZ: 2170727 + :Verifies: SAT-23109 + :customerscenario: true :steps: @@ -164,8 +166,13 @@ def test_positive_assign_ansible_role_variable_on_host( 2. Enable both 'Merge Overrides' and 'Merge Default'. 3. Add the variable to a role and attach the role to the host. 4. Verify that ansible role and variable is added to the host. + 5. In variable override the value. + 6. Delete the overridden value. + - :expectedresults: The role and variable is successfully added to the host. + :expectedresults: + 1. The role and variable is successfully added to the host. + 2. The overridden value in the variable was successfully deleted, and the default value remains unchanged. """ @request.addfinalizer @@ -229,6 +236,27 @@ def _finalize(): (v['Name'], v['Ansible role'], v['Type'], v['Value']) for v in variable_table ] + new_key = gen_string('alpha') + session.ansiblevariables.create_with_overrides( + { + 'key': new_key, + 'ansible_role': SELECTED_ROLE[0], + 'override': 'true', + 'parameter_type': parameter_type, + 'default_value': default_value, + } + ) + new_value = '["test update"]' + # Returns the updated value stored in a variable. + update_value = session.host_new.read_update_value( + rhel_contenthost.hostname, new_key, new_value + ) + assert new_value in update_value + # Revert the updated value to its default state. + delete_value = session.host_new.read_delete_value(rhel_contenthost.hostname, new_key) + assert new_value not in delete_value + assert default_value in delete_value + @pytest.mark.tier3 @pytest.mark.parametrize('setting_update', ['ansible_roles_to_ignore'], indirect=True) def test_positive_ansible_roles_ignore_list(self, target_sat, setting_update):