(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestGinJWTMiddleware_RedisStore_Integration(t *testing.T) { |
| 46 | gin.SetMode(gin.TestMode) |
| 47 | |
| 48 | host, port := setupRedisContainerForJWT(t) |
| 49 | |
| 50 | // Create middleware with Redis store |
| 51 | middleware := createTestMiddleware(fmt.Sprintf("%s:%s", host, port)) |
| 52 | |
| 53 | // Initialize middleware |
| 54 | err := middleware.MiddlewareInit() |
| 55 | require.NoError(t, err, "middleware initialization should not fail") |
| 56 | |
| 57 | // Create test router |
| 58 | r := gin.New() |
| 59 | r.POST("/login", middleware.LoginHandler) |
| 60 | r.POST("/refresh", middleware.RefreshHandler) |
| 61 | |
| 62 | auth := r.Group("/auth") |
| 63 | auth.Use(middleware.MiddlewareFunc()) |
| 64 | { |
| 65 | auth.GET("/hello", func(c *gin.Context) { |
| 66 | c.JSON(200, gin.H{"message": "hello"}) |
| 67 | }) |
| 68 | } |
| 69 | |
| 70 | t.Run("LoginAndRefreshWithRedis", func(t *testing.T) { |
| 71 | testLoginAndRefreshFlow(t, r) |
| 72 | }) |
| 73 | |
| 74 | t.Run("TokenPersistenceAcrossRequests", func(t *testing.T) { |
| 75 | testTokenPersistenceAcrossRequests(t, r) |
| 76 | }) |
| 77 | |
| 78 | t.Run("RedisStoreOperations", func(t *testing.T) { |
| 79 | testRedisStoreOperations(t, middleware) |
| 80 | }) |
| 81 | } |
| 82 | |
| 83 | func TestGinJWTMiddleware_RedisStoreFallback(t *testing.T) { |
| 84 | gin.SetMode(gin.TestMode) |
nothing calls this directly
no test coverage detected
searching dependent graphs…