@@ -237,30 +237,31 @@ func TestGoogleProviderGetEmailAddressEmailMissing(t *testing.T) {
237237
238238func TestGoogleProvider_userInGroup(t *testing.T) {
239239 ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
240− if r.URL.Path == "/admin/directory/v1/groups/group@example.com/hasMember/member-in-domain@example.com" {
240+ switch r.URL.Path {
241+ case "/admin/directory/v1/groups/group@example.com/hasMember/member-in-domain@example.com":
241242 fmt.Fprintln(w, `{"isMember":true}`)
242− } else if r.URL.Path == "/admin/directory/v1/groups/group@example.com/hasMember/non-member-in-domain@example.com" {
243+ case "/admin/directory/v1/groups/group@example.com/hasMember/non-member-in-domain@example.com":
243244 fmt.Fprintln(w, `{"isMember":false}`)
244− } else if r.URL.Path == "/admin/directory/v1/groups/group@example.com/hasMember/member-out-of-domain@otherexample.com" {
245+ case "/admin/directory/v1/groups/group@example.com/hasMember/member-out-of-domain@otherexample.com":
245246 http.Error(
246247 w,
247248 `{"error":{"errors":[{"domain":"global","reason":"invalid","message":"Invalid Input: memberKey"}],"code":400,"message":"Invalid Input: memberKey"}}`,
248249 http.StatusBadRequest,
249250 )
250− } else if r.URL.Path == "/admin/directory/v1/groups/group@example.com/hasMember/non-member-out-of-domain@otherexample.com" {
251+ case "/admin/directory/v1/groups/group@example.com/hasMember/non-member-out-of-domain@otherexample.com":
251252 http.Error(
252253 w,
253254 `{"error":{"errors":[{"domain":"global","reason":"invalid","message":"Invalid Input: memberKey"}],"code":400,"message":"Invalid Input: memberKey"}}`,
254255 http.StatusBadRequest,
255256 )
256− } else if r.URL.Path == "/admin/directory/v1/groups/group@example.com/members/non-member-out-of-domain@otherexample.com" {
257+ case "/admin/directory/v1/groups/group@example.com/members/non-member-out-of-domain@otherexample.com":
257258 // note that the client currently doesn't care what this response text or code is - any error here results in failure to match the group
258259 http.Error(
259260 w,
260261 `{"kind":"admin#directory#member","etag":"12345","id":"1234567890","email":"member-out-of-domain@otherexample.com","role":"MEMBER","type":"USER","status":"ACTIVE","delivery_settings":"ALL_MAIL"}`,
261262 http.StatusNotFound,
262263 )
263− } else if r.URL.Path == "/admin/directory/v1/groups/group@example.com/members/member-out-of-domain@otherexample.com" {
264+ case "/admin/directory/v1/groups/group@example.com/members/member-out-of-domain@otherexample.com":
264265 fmt.Fprintln(w,
265266 `{"kind":"admin#directory#member","etag":"12345","id":"1234567890","email":"member-out-of-domain@otherexample.com","role":"MEMBER","type":"USER","status":"ACTIVE","delivery_settings":"ALL_MAIL"}`,
266267 )