summaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
authorJeroen Wijenbergh <jeroen.wijenbergh@geant.org>2025-05-06 12:40:47 +0200
committerJeroen Wijenbergh <jeroen.wijenbergh@geant.org>2025-05-06 12:40:47 +0200
commit347b20fc91505584bc9efbeca89590a411b95e79 (patch)
tree9dfc600e957c4a881115f8bc8a9cc107a4f0cc9c /internal/api
parent9c4985368aee638d982f30ea7bc5c7ee71ae3ab3 (diff)
All: Run modernize --test --fix
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/api.go2
-rw-r--r--internal/api/api_test.go15
2 files changed, 8 insertions, 9 deletions
diff --git a/internal/api/api.go b/internal/api/api.go
index ea0fc6f..7111c45 100644
--- a/internal/api/api.go
+++ b/internal/api/api.go
@@ -378,7 +378,7 @@ func getEndpoints(ctx context.Context, url string, tp http.RoundTripper) (*endpo
type OAuthLogger struct{}
// Logf logs a message with parameters
-func (ol *OAuthLogger) Logf(msg string, params ...interface{}) {
+func (ol *OAuthLogger) Logf(msg string, params ...any) {
log.Logger.Debugf(msg, params...)
}
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{