From 347b20fc91505584bc9efbeca89590a411b95e79 Mon Sep 17 00:00:00 2001 From: Jeroen Wijenbergh Date: Tue, 6 May 2025 12:40:47 +0200 Subject: All: Run modernize --test --fix --- internal/api/api_test.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'internal/api/api_test.go') 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{ -- cgit v1.2.3