diff options
| author | Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> | 2025-05-06 12:40:47 +0200 |
|---|---|---|
| committer | Jeroen Wijenbergh <jeroen.wijenbergh@geant.org> | 2025-05-06 12:40:47 +0200 |
| commit | 347b20fc91505584bc9efbeca89590a411b95e79 (patch) | |
| tree | 9dfc600e957c4a881115f8bc8a9cc107a4f0cc9c /internal/api/api_test.go | |
| parent | 9c4985368aee638d982f30ea7bc5c7ee71ae3ab3 (diff) | |
All: Run modernize --test --fix
Diffstat (limited to 'internal/api/api_test.go')
| -rw-r--r-- | internal/api/api_test.go | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/internal/api/api_test.go b/internal/api/api_test.go index 2170743..f611f07 100644 --- a/internal/api/api_test.go +++ b/internal/api/api_test.go @@ -21,6 +21,7 @@ import ( "codeberg.org/eduVPN/eduvpn-common/types/protocol" "codeberg.org/eduVPN/eduvpn-common/types/server" "github.com/jwijenbergh/eduoauth-go" + "slices" ) func tokenHandler(t *testing.T, gt []string) func(http.ResponseWriter, *http.Request) { @@ -38,20 +39,18 @@ func tokenHandler(t *testing.T, gt []string) func(http.ResponseWriter, *http.Req } grant := parsed.Get("grant_type") - for _, v := range gt { - if v == grant { - _, err = w.Write([]byte(` + if slices.Contains(gt, grant) { + _, err = w.Write([]byte(` { "access_token": "validaccess", "refresh_token": "validrefresh", "expires_in": 3600 } `)) - if err != nil { - t.Fatalf("failed writing in token handler: %v", err) - } - return + if err != nil { + t.Fatalf("failed writing in token handler: %v", err) } + return } t.Fatalf("grant type: %v, not allowed", grant) } @@ -260,7 +259,7 @@ func TestAPIInfo(t *testing.T) { cases := []struct { hp test.HandlerPath info *profiles.Info - err interface{} + err any }{ { hp: test.HandlerPath{ |
