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)