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:
parent
72a108a33b
commit
d41f4b5d21
6 changed files with 52 additions and 5 deletions
|
@ -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{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue