diff --git a/tests/foreman/api/test_ansible.py b/tests/foreman/api/test_ansible.py index 9cea42bab8..b62af49e31 100644 --- a/tests/foreman/api/test_ansible.py +++ b/tests/foreman/api/test_ansible.py @@ -21,7 +21,7 @@ @pytest.fixture -def filtered_user(target_sat, module_org, module_location): +def filtered_user(request, target_sat, module_org, module_location): """ :steps: 1. Create a role with a host view filtered @@ -48,8 +48,9 @@ def filtered_user(target_sat, module_org, module_location): user = target_sat.api.User( role=[role], password=password, location=[module_location], organization=[module_org] ).create() - - return user, password + if is_open('SAT-18656'): + request.addfinalizer(user.delete) + yield user, password @pytest.mark.upgrade @@ -296,7 +297,6 @@ def test_positive_read_facts_with_filter( host.organization = module_org host.location = module_location host.update(['organization', 'location']) - # gather ansible facts by running ansible roles on the host host.play_ansible_roles() if is_open('SAT-18656'):