diff --git a/internal/controller/context_controller_test.go b/internal/controller/context_controller_test.go index 42a37fa..9a1ba45 100644 --- a/internal/controller/context_controller_test.go +++ b/internal/controller/context_controller_test.go @@ -125,7 +125,7 @@ func TestContextController(t *testing.T) { router.ServeHTTP(recorder, request) - assert.Equal(t, recorder.Result().StatusCode, http.StatusOK) + assert.Equal(t, http.StatusOK, recorder.Code) assert.Equal(t, test.expected, recorder.Body.String()) }) } diff --git a/internal/controller/oidc_controller_test.go b/internal/controller/oidc_controller_test.go index d5ba10c..a00458b 100644 --- a/internal/controller/oidc_controller_test.go +++ b/internal/controller/oidc_controller_test.go @@ -329,7 +329,7 @@ func TestOIDCController(t *testing.T) { }, }, { - description: "Ensure token endpoint deletes code afer use", + description: "Ensure token endpoint deletes code after use", middlewares: []gin.HandlerFunc{ simpleCtx, }, diff --git a/internal/controller/proxy_controller_test.go b/internal/controller/proxy_controller_test.go index e23f585..70e5eb6 100644 --- a/internal/controller/proxy_controller_test.go +++ b/internal/controller/proxy_controller_test.go @@ -282,7 +282,7 @@ func TestProxyController(t *testing.T) { }, }, { - description: "Ensure user allow ACL allows correct user (should allow testuer)", + description: "Ensure user allow ACL allows correct user (should allow testuser)", middlewares: []gin.HandlerFunc{ simpleCtx, }, @@ -296,7 +296,7 @@ func TestProxyController(t *testing.T) { }, }, { - description: "Ensure user allow ACL blocks incorrect user (should block testuer)", + description: "Ensure user allow ACL blocks incorrect user (should block totpuser)", middlewares: []gin.HandlerFunc{ simpleCtxTotp, }, diff --git a/internal/controller/user_controller_test.go b/internal/controller/user_controller_test.go index e721e04..697364f 100644 --- a/internal/controller/user_controller_test.go +++ b/internal/controller/user_controller_test.go @@ -74,7 +74,7 @@ func TestUserController(t *testing.T) { assert.Equal(t, "tinyauth-session", cookie.Name) assert.True(t, cookie.HttpOnly) assert.Equal(t, "example.com", cookie.Domain) - assert.Equal(t, cookie.MaxAge, 10) + assert.Equal(t, 10, cookie.MaxAge) }, }, { @@ -163,7 +163,7 @@ func TestUserController(t *testing.T) { assert.Equal(t, "tinyauth-session", cookie.Name) assert.True(t, cookie.HttpOnly) assert.Equal(t, "example.com", cookie.Domain) - assert.Equal(t, cookie.MaxAge, 3600) // 1 hour, default for totp pending sessions + assert.Equal(t, 3600, cookie.MaxAge) // 1 hour, default for totp pending sessions }, }, { @@ -233,7 +233,7 @@ func TestUserController(t *testing.T) { assert.Equal(t, "tinyauth-session", totpCookie.Name) assert.True(t, totpCookie.HttpOnly) assert.Equal(t, "example.com", totpCookie.Domain) - assert.Equal(t, totpCookie.MaxAge, 10) // should use the regular session expiry time + assert.Equal(t, 10, totpCookie.MaxAge) // should use the regular session expiry time }, }, { diff --git a/internal/controller/well_known_controller_test.go b/internal/controller/well_known_controller_test.go index 51821f2..993e398 100644 --- a/internal/controller/well_known_controller_test.go +++ b/internal/controller/well_known_controller_test.go @@ -66,7 +66,7 @@ func TestWellKnownController(t *testing.T) { ServiceDocumentation: "https://tinyauth.app/docs/guides/oidc", } - assert.Equal(t, res, expected) + assert.Equal(t, expected, res) }, }, { diff --git a/internal/service/auth_service.go b/internal/service/auth_service.go index 3b9e102..1af63d1 100644 --- a/internal/service/auth_service.go +++ b/internal/service/auth_service.go @@ -801,5 +801,5 @@ func (auth *AuthService) lockdownMode() { func (auth *AuthService) ClearRateLimitsTestingOnly() { auth.loginMutex.Lock() auth.loginAttempts = make(map[string]*LoginAttempt) - auth.loginMutex.Unlock() + auth.loginMutex.Unlock() }