diff --git a/server/deviceflowhandlers_test.go b/server/deviceflowhandlers_test.go index 6d1ed7e3..f82b15db 100644 --- a/server/deviceflowhandlers_test.go +++ b/server/deviceflowhandlers_test.go @@ -61,7 +61,7 @@ func TestHandleDeviceCode(t *testing.T) { }, } for _, tc := range tests { - func() { + t.Run(tc.testName, func(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -105,7 +105,7 @@ func TestHandleDeviceCode(t *testing.T) { if tc.expectedResponseCode == http.StatusBadRequest || tc.expectedResponseCode == http.StatusUnauthorized { expectErrorResponse(tc.testName, body, tc.expectedServerResponse, t) } - }() + }) } } @@ -310,7 +310,7 @@ func TestDeviceCallback(t *testing.T) { }, } for _, tc := range tests { - func() { + t.Run(tc.testName, func(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -360,7 +360,7 @@ func TestDeviceCallback(t *testing.T) { if rr.Code != tc.expectedResponseCode { t.Errorf("%s: Unexpected Response Type. Expected %v got %v", tc.testName, tc.expectedResponseCode, rr.Code) } - }() + }) } } @@ -494,7 +494,7 @@ func TestDeviceTokenResponse(t *testing.T) { }, } for _, tc := range tests { - func() { + t.Run(tc.testName, func(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -544,7 +544,7 @@ func TestDeviceTokenResponse(t *testing.T) { } else if string(body) != tc.expectedServerResponse { t.Errorf("Unexpected Server Response. Expected %v got %v", tc.expectedServerResponse, string(body)) } - }() + }) } } @@ -625,7 +625,7 @@ func TestVerifyCodeResponse(t *testing.T) { }, } for _, tc := range tests { - func() { + t.Run(tc.testName, func(t *testing.T) { ctx, cancel := context.WithCancel(context.Background()) defer cancel() @@ -667,6 +667,6 @@ func TestVerifyCodeResponse(t *testing.T) { if rr.Code == http.StatusFound && !strings.HasPrefix(location, u.Path) { t.Errorf("Invalid Redirect. Expected %v got %v", u.Path, location) } - }() + }) } } diff --git a/server/server_test.go b/server/server_test.go index 8b0447fe..114d1fc8 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -1337,9 +1337,6 @@ func TestOAuth2DeviceFlow(t *testing.T) { data := url.Values{} data.Set("client_id", clientID) data.Add("scope", strings.Join(requestedScopes, " ")) - //for _, scope := range requestedScopes { - // data.Add("scope", scope) - //} resp, err := http.PostForm(codeURL.String(), data) if err != nil { t.Errorf("Could not request device code: %v", err)