add tests when preferred username key is not set
Signed-off-by: Rui Yang <ruiya@vmware.com>
This commit is contained in:
parent
d9afb7e59c
commit
4812079647
@ -89,12 +89,10 @@ func TestHandleCallback(t *testing.T) {
|
||||
userIDKey: "name",
|
||||
expectUserID: "namevalue",
|
||||
expectUserName: "namevalue",
|
||||
expectPreferredUsername: "usernamevalue",
|
||||
expectedEmailField: "emailvalue",
|
||||
token: map[string]interface{}{
|
||||
"sub": "subvalue",
|
||||
"name": "namevalue",
|
||||
"preferred_username": "usernamevalue",
|
||||
"email": "emailvalue",
|
||||
"email_verified": true,
|
||||
},
|
||||
@ -127,6 +125,33 @@ func TestHandleCallback(t *testing.T) {
|
||||
"email_verified": true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "withoutPreferredUsernameKeyAndBackendReturns",
|
||||
expectUserID: "subvalue",
|
||||
expectUserName: "namevalue",
|
||||
expectPreferredUsername: "preferredusernamevalue",
|
||||
expectedEmailField: "emailvalue",
|
||||
token: map[string]interface{}{
|
||||
"sub": "subvalue",
|
||||
"name": "namevalue",
|
||||
"preferred_username": "preferredusernamevalue",
|
||||
"email": "emailvalue",
|
||||
"email_verified": true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "withoutPreferredUsernameKeyAndBackendNotReturn",
|
||||
expectUserID: "subvalue",
|
||||
expectUserName: "namevalue",
|
||||
expectPreferredUsername: "",
|
||||
expectedEmailField: "emailvalue",
|
||||
token: map[string]interface{}{
|
||||
"sub": "subvalue",
|
||||
"name": "namevalue",
|
||||
"email": "emailvalue",
|
||||
"email_verified": true,
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "emptyEmailScope",
|
||||
expectUserID: "subvalue",
|
||||
|
Reference in New Issue
Block a user