fixup! Further pursue of perfection.

This commit is contained in:
2025-09-04 22:43:39 +01:00
parent 29ec26cbaa
commit f291dcca26
43 changed files with 3995 additions and 2916 deletions
+68
View File
@@ -0,0 +1,68 @@
package traefikoidc
import (
"testing"
)
// Additional tests to reach 75% coverage
// Test InputValidator creation and basic validation
func TestInputValidatorExtended(t *testing.T) {
config := DefaultInputValidationConfig()
logger := NewLogger("debug")
validator, err := NewInputValidator(config, logger)
if err != nil {
t.Fatalf("Failed to create validator: %v", err)
}
// Test SanitizeInput
sanitized := validator.SanitizeInput("test\x00with\x01control", 100)
if sanitized == "" {
t.Error("SanitizeInput should return sanitized string")
}
// Test ValidateBoundaryValues
result := validator.ValidateBoundaryValues(50, 1, 100)
if !result.IsValid {
t.Error("Valid boundary value should pass")
}
result = validator.ValidateBoundaryValues(150, 1, 100)
if result.IsValid {
t.Error("Invalid boundary value should fail")
}
}
// Test session manager creation
func TestSessionManagerCreation(t *testing.T) {
logger := NewLogger("debug")
sm, err := NewSessionManager("test-secret", false, "Lax", logger)
if err != nil {
t.Fatalf("NewSessionManager failed: %v", err)
}
if sm == nil {
t.Fatal("NewSessionManager returned nil")
}
}
// Test JWK cache creation
func TestJWKCacheCreation(t *testing.T) {
cache := NewJWKCache()
if cache == nil {
t.Fatal("NewJWKCache returned nil")
}
}
// Test security monitor creation
func TestSecurityMonitorCreation(t *testing.T) {
logger := NewLogger("debug")
config := DefaultSecurityMonitorConfig()
sm := NewSecurityMonitor(config, logger)
if sm == nil {
t.Fatal("NewSecurityMonitor returned nil")
}
}