Skip to content

Commit

Permalink
bz2220965
Browse files Browse the repository at this point in the history
  • Loading branch information
lhellebr committed Jan 2, 2024
1 parent d0c8193 commit be5c3ab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pytest_fixtures/core/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pytest
from requests.exceptions import HTTPError

from robottelo.constants import PERMISSIONS
from robottelo.logging import logger


Expand All @@ -17,16 +18,23 @@ def ui_user(request, module_org, module_location, module_target_sat):
test_module_name = request.module.__name__.split('.')[-1].split('_', 1)[-1]
login = f"{test_module_name}_{gen_string('alphanumeric')}"
password = gen_string('alphanumeric')
admin = request.param.get('admin', True)
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}"',
login=login,
password=password,
).create()
user.password = password
if not admin:
# give all the permissions
#all_perms = sum(PERMISSIONS.values(), [])
all_perms = module_target_sat.cli.Filter.available_permissions()
all_perms_role = module_target_sat.cli_factory.make_role()
module_target_sat.cli_factory.make_filter({'role': all_perms_role, 'permissions': all_permissions})
yield user
try:
logger.debug('Deleting session user %r', user.login)
Expand Down
1 change: 1 addition & 0 deletions tests/foreman/ui/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def test_positive_run_default_job_template_by_ip(session, rex_contenthost, modul
@pytest.mark.skip_if_open('BZ:2182353')
@pytest.mark.rhel_ver_match('8')
@pytest.mark.tier3
@pytest.mark.parametrize('ui_user', [{'admin': True}, {'admin': False}], indirect=True, ids=['adminuser', 'nonadminuser'])
def test_positive_run_custom_job_template_by_ip(session, module_org, rex_contenthost):
"""Run a job template on a host connected by ip
Expand Down

0 comments on commit be5c3ab

Please sign in to comment.