mirror of
https://github.com/aykhans/slash-e.git
synced 2025-04-20 22:07:15 +00:00
chore: fix tests
This commit is contained in:
parent
647726fc2d
commit
61dd989df4
@ -116,15 +116,13 @@ func TestIdentityProvider(t *testing.T) {
|
|||||||
testClientID = "test-client-id"
|
testClientID = "test-client-id"
|
||||||
testCode = "test-code"
|
testCode = "test-code"
|
||||||
testAccessToken = "test-access-token"
|
testAccessToken = "test-access-token"
|
||||||
testSubject = "123456789"
|
|
||||||
testName = "John Doe"
|
testName = "John Doe"
|
||||||
testEmail = "john.doe@example.com"
|
testEmail = "john.doe@example.com"
|
||||||
)
|
)
|
||||||
userInfo, err := json.Marshal(
|
userInfo, err := json.Marshal(
|
||||||
map[string]any{
|
map[string]any{
|
||||||
"sub": testSubject,
|
|
||||||
"name": testName,
|
|
||||||
"email": testEmail,
|
"email": testEmail,
|
||||||
|
"name": testName,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -138,7 +136,7 @@ func TestIdentityProvider(t *testing.T) {
|
|||||||
TokenUrl: fmt.Sprintf("%s/oauth2/token", s.URL),
|
TokenUrl: fmt.Sprintf("%s/oauth2/token", s.URL),
|
||||||
UserInfoUrl: fmt.Sprintf("%s/oauth2/userinfo", s.URL),
|
UserInfoUrl: fmt.Sprintf("%s/oauth2/userinfo", s.URL),
|
||||||
FieldMapping: &storepb.IdentityProviderConfig_FieldMapping{
|
FieldMapping: &storepb.IdentityProviderConfig_FieldMapping{
|
||||||
Identifier: "sub",
|
Identifier: "email",
|
||||||
DisplayName: "name",
|
DisplayName: "name",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -154,9 +152,8 @@ func TestIdentityProvider(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
wantUserInfo := &idp.IdentityProviderUserInfo{
|
wantUserInfo := &idp.IdentityProviderUserInfo{
|
||||||
Identifier: testSubject,
|
Identifier: testEmail,
|
||||||
DisplayName: testName,
|
DisplayName: testName,
|
||||||
Email: testEmail,
|
|
||||||
}
|
}
|
||||||
assert.Equal(t, wantUserInfo, userInfoResult)
|
assert.Equal(t, wantUserInfo, userInfoResult)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user