Skip to content

Commit

Permalink
bz2220965
Browse files Browse the repository at this point in the history
  • Loading branch information
lhellebr committed Jan 30, 2024
1 parent 7f317a6 commit fccb953
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
9 changes: 8 additions & 1 deletion pytest_fixtures/core/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,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,
organization=[module_org],
location=[module_location],
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
user.role = module_target_sat.api.Role().search(query={'per_page': 'all'})
user.update(['role'])
yield user
try:
logger.debug('Deleting session user %r', user.login)
Expand Down
14 changes: 12 additions & 2 deletions tests/foreman/ui/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ 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
def test_positive_run_custom_job_template_by_ip(session, module_org, rex_contenthost):
@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, target_sat, default_location, ui_user, rex_contenthost
):
"""Run a job template on a host connected by ip
:id: 3a59eb15-67c4-46e1-ba5f-203496ec0b0c
Expand All @@ -93,8 +98,13 @@ def test_positive_run_custom_job_template_by_ip(session, module_org, rex_content
:expectedresults: Verify the job was successfully ran against the host
:parametrized: yes
"""
:bz: 2220965
:customerscenario: true
"""
ui_user.location.append(target_sat.api.Location(id=default_location.id))
ui_user.update(['location'])
hostname = rex_contenthost.hostname
job_template_name = gen_string('alpha')
with session:
Expand Down

0 comments on commit fccb953

Please sign in to comment.