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

Fix username for AD and IDM. Fix session contexts. #16382

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
3 changes: 3 additions & 0 deletions pytest_fixtures/component/satellite_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def _ad_data(version='2019'):
if version in supported_server_versions:
ad_server_details = {
'ldap_user_name': settings.ldap.username,
'ldap_user_shown_name': settings.ldap.user_shown_name,
'ldap_user_cn': settings.ldap.username,
'ldap_user_passwd': settings.ldap.password,
'base_dn': settings.ldap.basedn,
Expand All @@ -77,6 +78,7 @@ def _ad_data(version='2019'):
def ipa_data():
return {
'ldap_user_name': settings.ipa.user,
'ldap_user_shown_name': settings.ipa.user_shown_name,
'ldap_user_cn': settings.ipa.username,
'ipa_otp_username': settings.ipa.otp_user,
'ldap_user_passwd': settings.ipa.password,
Expand All @@ -94,6 +96,7 @@ def ipa_data():
def open_ldap_data():
return {
'ldap_user_name': settings.open_ldap.open_ldap_user,
'ldap_user_shown_name': settings.open_ldap.user_shown_name,
'ldap_user_cn': settings.open_ldap.username,
'ldap_hostname': settings.open_ldap.hostname,
'ldap_user_passwd': settings.open_ldap.password,
Expand Down
14 changes: 7 additions & 7 deletions tests/foreman/ui/test_ldap_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def test_positive_update_external_roles(
session.activationkey.create({'name': ak_name})
assert session.activationkey.search(ak_name)[0]['Name'] == ak_name
current_user = session.activationkey.read(ak_name, 'current_user')['current_user']
assert ldap_data['ldap_user_name'] in current_user
assert ldap_data['ldap_user_shown_name'] == current_user


@pytest.mark.parametrize('ldap_auth_source', ['AD', 'IPA'], indirect=True)
Expand Down Expand Up @@ -480,13 +480,13 @@ def test_positive_update_external_user_roles(
)
with target_sat.ui_session(
test_name, ldap_data['ldap_user_name'], ldap_data['ldap_user_passwd']
) as session:
) as ldapsession:
pnovotny marked this conversation as resolved.
Show resolved Hide resolved
with pytest.raises(NavigationTriesExceeded):
ldapsession.architecture.search('')
session.activationkey.create({'name': ak_name})
assert session.activationkey.search(ak_name)[0]['Name'] == ak_name
current_user = session.activationkey.read(ak_name, 'current_user')['current_user']
assert ldap_data['ldap_user_name'] in current_user
ldapsession.activationkey.create({'name': ak_name})
assert ldapsession.activationkey.search(ak_name)[0]['Name'] == ak_name
current_user = ldapsession.activationkey.read(ak_name, 'current_user')['current_user']
assert ldap_data['ldap_user_shown_name'] == current_user


@pytest.mark.parametrize('ldap_auth_source', ['AD', 'IPA'], indirect=True)
Expand Down Expand Up @@ -541,7 +541,7 @@ def test_positive_add_admin_role_with_org_loc(
session.location.create({'name': location_name})
assert session.location.search(location_name)[0]['Name'] == location_name
location = session.location.read(location_name, ['current_user', 'primary'])
assert ldap_data['ldap_user_name'] in location['current_user']
assert ldap_data['ldap_user_shown_name'] in location['current_user']
assert location['primary']['name'] == location_name
session.organization.select(module_org.name)
session.activationkey.create({'name': ak_name})
Expand Down