From f7f979f9421756d188f62e276d19097f6ab566d6 Mon Sep 17 00:00:00 2001 From: Stavros Date: Sun, 24 May 2026 18:47:03 +0300 Subject: [PATCH] tests: use ding in tests --- internal/controller/oidc_controller_test.go | 6 +++--- internal/controller/proxy_controller_test.go | 6 +++--- internal/controller/user_controller_test.go | 6 +++--- internal/controller/well_known_controller_test.go | 6 +++--- internal/middleware/context_middleware_test.go | 6 +++--- internal/service/oidc_service_test.go | 6 +++--- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/internal/controller/oidc_controller_test.go b/internal/controller/oidc_controller_test.go index 38fa2861..365431a3 100644 --- a/internal/controller/oidc_controller_test.go +++ b/internal/controller/oidc_controller_test.go @@ -8,11 +8,11 @@ import ( "net/http/httptest" "net/url" "strings" - "sync" "testing" "github.com/gin-gonic/gin" "github.com/google/go-querystring/query" + "github.com/steveiliop56/ding" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tinyauthapp/tinyauth/internal/controller" @@ -840,9 +840,9 @@ func TestOIDCController(t *testing.T) { store := memory.New() - wg := &sync.WaitGroup{} + dg := ding.New(context.TODO()) - oidcService, err := service.NewOIDCService(log, cfg, runtime, store, context.TODO(), wg) + oidcService, err := service.NewOIDCService(log, cfg, runtime, store, dg) require.NoError(t, err) for _, test := range tests { diff --git a/internal/controller/proxy_controller_test.go b/internal/controller/proxy_controller_test.go index ef004f8f..c7e283f1 100644 --- a/internal/controller/proxy_controller_test.go +++ b/internal/controller/proxy_controller_test.go @@ -3,10 +3,10 @@ package controller_test import ( "context" "net/http/httptest" - "sync" "testing" "github.com/gin-gonic/gin" + "github.com/steveiliop56/ding" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tinyauthapp/tinyauth/internal/controller" @@ -353,11 +353,11 @@ func TestProxyController(t *testing.T) { store := memory.New() - wg := &sync.WaitGroup{} ctx := context.TODO() + dg := ding.New(ctx) broker := service.NewOAuthBrokerService(log, map[string]model.OAuthServiceConfig{}, ctx) - authService := service.NewAuthService(log, cfg, runtime, ctx, wg, nil, store, broker, nil) + authService := service.NewAuthService(log, cfg, runtime, ctx, dg, nil, store, broker, nil) aclsService := service.NewAccessControlsService(log, cfg, nil) policyEngine, err := service.NewPolicyEngine(cfg, log) diff --git a/internal/controller/user_controller_test.go b/internal/controller/user_controller_test.go index 39b343c0..670620e7 100644 --- a/internal/controller/user_controller_test.go +++ b/internal/controller/user_controller_test.go @@ -6,12 +6,12 @@ import ( "net/http" "net/http/httptest" "strings" - "sync" "testing" "time" "github.com/gin-gonic/gin" "github.com/pquerna/otp/totp" + "github.com/steveiliop56/ding" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tinyauthapp/tinyauth/internal/controller" @@ -412,10 +412,10 @@ func TestUserController(t *testing.T) { } ctx := context.TODO() - wg := &sync.WaitGroup{} + dg := ding.New(ctx) broker := service.NewOAuthBrokerService(log, map[string]model.OAuthServiceConfig{}, ctx) - authService := service.NewAuthService(log, cfg, runtime, ctx, wg, nil, store, broker, nil) + authService := service.NewAuthService(log, cfg, runtime, ctx, dg, nil, store, broker, nil) beforeEach := func() { // Clear failed login attempts before each test diff --git a/internal/controller/well_known_controller_test.go b/internal/controller/well_known_controller_test.go index d5ec5147..f4685723 100644 --- a/internal/controller/well_known_controller_test.go +++ b/internal/controller/well_known_controller_test.go @@ -5,10 +5,10 @@ import ( "encoding/json" "fmt" "net/http/httptest" - "sync" "testing" "github.com/gin-gonic/gin" + "github.com/steveiliop56/ding" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tinyauthapp/tinyauth/internal/controller" @@ -89,11 +89,11 @@ func TestWellKnownController(t *testing.T) { } ctx := context.TODO() - wg := &sync.WaitGroup{} + dg := ding.New(ctx) store := memory.New() - oidcService, err := service.NewOIDCService(log, cfg, runtime, store, ctx, wg) + oidcService, err := service.NewOIDCService(log, cfg, runtime, store, dg) require.NoError(t, err) for _, test := range tests { diff --git a/internal/middleware/context_middleware_test.go b/internal/middleware/context_middleware_test.go index b672684f..8168cc96 100644 --- a/internal/middleware/context_middleware_test.go +++ b/internal/middleware/context_middleware_test.go @@ -5,11 +5,11 @@ import ( "encoding/base64" "net/http" "net/http/httptest" - "sync" "testing" "time" "github.com/gin-gonic/gin" + "github.com/steveiliop56/ding" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/tinyauthapp/tinyauth/internal/middleware" @@ -250,12 +250,12 @@ func TestContextMiddleware(t *testing.T) { } ctx := context.TODO() - wg := &sync.WaitGroup{} + dg := ding.New(ctx) store := memory.New() broker := service.NewOAuthBrokerService(log, map[string]model.OAuthServiceConfig{}, ctx) - authService := service.NewAuthService(log, cfg, runtime, ctx, wg, nil, store, broker, nil) + authService := service.NewAuthService(log, cfg, runtime, ctx, dg, nil, store, broker, nil) contextMiddleware := middleware.NewContextMiddleware(log, runtime, authService, broker, nil) diff --git a/internal/service/oidc_service_test.go b/internal/service/oidc_service_test.go index bc24c9be..d1921f48 100644 --- a/internal/service/oidc_service_test.go +++ b/internal/service/oidc_service_test.go @@ -3,9 +3,9 @@ package service_test import ( "context" "encoding/json" - "sync" "testing" + "github.com/steveiliop56/ding" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -70,9 +70,9 @@ func TestCompileUserinfo(t *testing.T) { log.Init() ctx := context.TODO() - wg := &sync.WaitGroup{} + dg := ding.New(ctx) - svc, err := service.NewOIDCService(log, cfg, runtime, nil, ctx, wg) + svc, err := service.NewOIDCService(log, cfg, runtime, nil, dg) require.NoError(t, err) type testCase struct {