|
|
|
|
@ -72,12 +72,22 @@ func TestOpen(t *testing.T) {
|
|
|
|
|
assert.Nil(t, err) |
|
|
|
|
|
|
|
|
|
for name, reference := range map[string]testCase{ |
|
|
|
|
"not_requesting_groups": { |
|
|
|
|
config: &Config{ |
|
|
|
|
ClientID: "testClient", |
|
|
|
|
ClientSecret: "testSecret", |
|
|
|
|
RedirectURI: ts.URL + "/callback", |
|
|
|
|
Scopes: []string{"openid"}, |
|
|
|
|
}, |
|
|
|
|
expectedErr: "", |
|
|
|
|
}, |
|
|
|
|
"missing_admin_email": { |
|
|
|
|
config: &Config{ |
|
|
|
|
ClientID: "testClient", |
|
|
|
|
ClientSecret: "testSecret", |
|
|
|
|
RedirectURI: ts.URL + "/callback", |
|
|
|
|
Scopes: []string{"openid", "groups"}, |
|
|
|
|
Groups: []string{"someGroup"}, |
|
|
|
|
}, |
|
|
|
|
expectedErr: "requires adminEmail", |
|
|
|
|
}, |
|
|
|
|
@ -89,6 +99,7 @@ func TestOpen(t *testing.T) {
|
|
|
|
|
Scopes: []string{"openid", "groups"}, |
|
|
|
|
AdminEmail: "foo@bar.com", |
|
|
|
|
ServiceAccountFilePath: "not_found.json", |
|
|
|
|
Groups: []string{"someGroup"}, |
|
|
|
|
}, |
|
|
|
|
expectedErr: "error reading credentials", |
|
|
|
|
}, |
|
|
|
|
@ -100,6 +111,7 @@ func TestOpen(t *testing.T) {
|
|
|
|
|
Scopes: []string{"openid", "groups"}, |
|
|
|
|
AdminEmail: "foo@bar.com", |
|
|
|
|
ServiceAccountFilePath: serviceAccountFilePath, |
|
|
|
|
Groups: []string{"someGroup"}, |
|
|
|
|
}, |
|
|
|
|
expectedErr: "", |
|
|
|
|
}, |
|
|
|
|
@ -110,6 +122,7 @@ func TestOpen(t *testing.T) {
|
|
|
|
|
RedirectURI: ts.URL + "/callback", |
|
|
|
|
Scopes: []string{"openid", "groups"}, |
|
|
|
|
AdminEmail: "foo@bar.com", |
|
|
|
|
Groups: []string{"someGroup"}, |
|
|
|
|
}, |
|
|
|
|
adc: serviceAccountFilePath, |
|
|
|
|
expectedErr: "", |
|
|
|
|
@ -122,6 +135,7 @@ func TestOpen(t *testing.T) {
|
|
|
|
|
Scopes: []string{"openid", "groups"}, |
|
|
|
|
AdminEmail: "foo@bar.com", |
|
|
|
|
ServiceAccountFilePath: serviceAccountFilePath, |
|
|
|
|
Groups: []string{"someGroup"}, |
|
|
|
|
}, |
|
|
|
|
adc: "/dev/null", |
|
|
|
|
expectedErr: "", |
|
|
|
|
|