From 0d604df6d9c19ca085a2a424864d61bda1d49a9f Mon Sep 17 00:00:00 2001 From: Lukas Hellebrandt Date: Fri, 22 Dec 2023 13:07:58 +0100 Subject: [PATCH] bz2220965 --- pytest_fixtures/core/ui.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pytest_fixtures/core/ui.py b/pytest_fixtures/core/ui.py index f87f4cec0ad..1c321e93d12 100644 --- a/pytest_fixtures/core/ui.py +++ b/pytest_fixtures/core/ui.py @@ -6,7 +6,7 @@ @pytest.fixture(scope='module') -def ui_user(request, module_org, module_location, module_target_sat): +def ui_user(request, module_org, module_location, module_target_sat, admin=True): """Creates admin user with default org set to module org and shares that user for all tests in the same test module. User's login contains test module name as a prefix. @@ -19,7 +19,7 @@ def ui_user(request, module_org, module_location, module_target_sat): password = gen_string('alphanumeric') logger.debug('Creating session user %r', login) user = module_target_sat.api.User( - admin=True, + admin=admin, default_organization=module_org, default_location=module_location, description=f'created automatically by airgun for module "{test_module_name}"', @@ -27,6 +27,9 @@ def ui_user(request, module_org, module_location, module_target_sat): password=password, ).create() user.password = password + if not admin: + # give all the permissions + pass yield user try: logger.debug('Deleting session user %r', user.login)