Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.15.z] bz2220965 #13946

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading