add unit tests for oidc.Userinfo

- Add get methods for Address fields to handle nil pointers as we used to
This commit is contained in:
Tim Möhlmann 2023-03-02 17:35:06 +02:00
parent 72a108a33b
commit d41f4b5d21
6 changed files with 52 additions and 5 deletions

View file

@ -63,6 +63,15 @@ func TestIntrospectionResponse_SetUserInfo(t *testing.T) {
}
}
func TestIntrospectionResponse_GetAddress(t *testing.T) {
// nil address
i := new(IntrospectionResponse)
assert.Equal(t, &UserInfoAddress{}, i.GetAddress())
i.Address = &UserInfoAddress{PostalCode: "1234"}
assert.Equal(t, i.Address, i.GetAddress())
}
func TestIntrospectionResponse_MarshalJSON(t *testing.T) {
got, err := json.Marshal(&IntrospectionResponse{
UserInfoProfile: UserInfoProfile{