add unit tests for oidc.IntrospectionResponse

- Changed UserInfoAddress to pointer in UserInfo and
IntrospectionResponse.
This was needed to make omitempty work correctly.

- Copy or merge maps in IntrospectionResponse GetUserInfo
and SetUserInfo
This commit is contained in:
Tim Möhlmann 2023-03-02 15:44:27 +02:00
parent 3940b520a8
commit 72a108a33b
8 changed files with 99 additions and 14 deletions

View file

@ -10,7 +10,7 @@ import (
func TestUserInfoMarshal(t *testing.T) {
userinfo := &UserInfo{
Subject: "test",
Address: UserInfoAddress{
Address: &UserInfoAddress{
StreetAddress: "Test 789\nPostfach 2",
},
UserInfoEmail: UserInfoEmail{
@ -55,7 +55,7 @@ func TestUserInfoEmailVerifiedUnmarshal(t *testing.T) {
}, uie)
})
t.Run("unmarsha email_verified from json string true", func(t *testing.T) {
t.Run("unmarshal email_verified from json string true", func(t *testing.T) {
jsonBool := []byte(`{"email": "my@email.com", "email_verified": "true"}`)
var uie UserInfoEmail
@ -68,7 +68,7 @@ func TestUserInfoEmailVerifiedUnmarshal(t *testing.T) {
}, uie)
})
t.Run("unmarsha email_verified from json bool false", func(t *testing.T) {
t.Run("unmarshal email_verified from json bool false", func(t *testing.T) {
jsonBool := []byte(`{"email": "my@email.com", "email_verified": false}`)
var uie UserInfoEmail
@ -81,7 +81,7 @@ func TestUserInfoEmailVerifiedUnmarshal(t *testing.T) {
}, uie)
})
t.Run("unmarsha email_verified from json string false", func(t *testing.T) {
t.Run("unmarshal email_verified from json string false", func(t *testing.T) {
jsonBool := []byte(`{"email": "my@email.com", "email_verified": "false"}`)
var uie UserInfoEmail