Fix post_login_handler_test.go

Co-authored-by: Ryan Richard <richardry@vmware.com>
This commit is contained in:
Benjamin A. Petersen 2023-06-15 16:26:51 -04:00 committed by Ryan Richard
parent 793d1c6a5d
commit 6ef9cf273e

View File

@ -198,6 +198,8 @@ func TestPostLoginEndpoint(t *testing.T) {
ProviderUID: activeDirectoryUpstreamResourceUID,
ProviderName: activeDirectoryUpstreamName,
ProviderType: psession.ProviderTypeActiveDirectory,
UpstreamUsername: happyLDAPUsernameFromAuthenticator,
UpstreamGroups: happyLDAPGroups,
OIDC: nil,
LDAP: nil,
ActiveDirectory: &psession.ActiveDirectorySessionData{
@ -211,6 +213,8 @@ func TestPostLoginEndpoint(t *testing.T) {
ProviderUID: ldapUpstreamResourceUID,
ProviderName: ldapUpstreamName,
ProviderType: psession.ProviderTypeLDAP,
UpstreamUsername: happyLDAPUsernameFromAuthenticator,
UpstreamGroups: happyLDAPGroups,
OIDC: nil,
LDAP: &psession.LDAPSessionData{
UserDN: happyLDAPUserDN,
@ -944,14 +948,14 @@ func TestPostLoginEndpoint(t *testing.T) {
idps: oidctestutil.NewUpstreamIDPListerBuilder(), // empty
decodedState: happyLDAPDecodedState,
formParams: happyUsernamePasswordFormParams,
wantErr: "error finding upstream provider: provider not found",
wantErr: "error finding upstream provider: did not find IDP with name \"some-ldap-idp\"",
},
{
name: "upstream provider cannot be found by name and type",
idps: oidctestutil.NewUpstreamIDPListerBuilder().WithLDAP(upstreamLDAPIdentityProvider),
decodedState: happyActiveDirectoryDecodedState, // correct upstream IDP name, but wrong upstream IDP type
formParams: happyUsernamePasswordFormParams,
wantErr: "error finding upstream provider: provider not found",
wantErr: "error finding upstream provider: did not find IDP with name \"some-active-directory-idp\"",
},
}