Skip to content

Commit

Permalink
Put user in the correct location so the UI navigation doesn't fail
Browse files Browse the repository at this point in the history
  • Loading branch information
lhellebr committed Jan 3, 2024
1 parent 2864226 commit 4d27824
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
6 changes: 2 additions & 4 deletions pytest_fixtures/core/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ def ui_user(request, module_org, module_location, module_target_sat):
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})
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
5 changes: 3 additions & 2 deletions tests/foreman/ui/test_remoteexecution.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def test_positive_run_default_job_template_by_ip(session, rex_contenthost, modul
@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):
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 @@ -104,7 +104,8 @@ def test_positive_run_custom_job_template_by_ip(session, module_org, rex_content
:CaseLevel: System
"""

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 4d27824

Please sign in to comment.