From 1fb8fbe043af70a92671cff7f4f5ae3e10207607 Mon Sep 17 00:00:00 2001 From: Adarsh Dubey Date: Tue, 21 Mar 2023 17:31:03 +0530 Subject: [PATCH] Adding finalizer for custome role cleanup Signed-off-by: Adarsh Dubey --- tests/foreman/ui/test_ansible.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/foreman/ui/test_ansible.py b/tests/foreman/ui/test_ansible.py index 2f0d7bc4ef..5a3e21f75c 100644 --- a/tests/foreman/ui/test_ansible.py +++ b/tests/foreman/ui/test_ansible.py @@ -186,7 +186,7 @@ def test_positive_config_report_ansible(session, target_sat, module_org, rhel_co @pytest.mark.no_containers @pytest.mark.rhel_ver_match('9') -def test_positive_ansible_custom_role(target_sat, session, module_org, rhel_contenthost): +def test_positive_ansible_custom_role(target_sat, session, module_org, rhel_contenthost, request): """ Test Config report generation with Custom Ansible Role @@ -261,3 +261,8 @@ def test_positive_ansible_custom_role(target_sat, session, module_org, rhel_cont session.configreport.search(rhel_contenthost.hostname) session.configreport.delete(rhel_contenthost.hostname) assert len(session.configreport.read()['table']) == 0 + + @request.addfinalizer + def _finalize(): + result = target_sat.cli.Ansible.roles_delete({'name': SELECTED_ROLE}) + assert f'Ansible role [{SELECTED_ROLE}] was deleted.' in result[0]['message']