Files
query-orchestration/api/queryAPI/test_helpers.go
T
Jay Brown 720a84be92 Merged in feature/doc_import (pull request #177)
integration of background processor

* integration part 1

* feature working

* fix mimetype issue
2025-08-20 19:01:13 +00:00

91 lines
6.4 KiB
Go

package queryapi
import (
"context"
"io"
"log/slog"
"queryorchestration/internal/backgroundtask"
"queryorchestration/internal/serviceconfig/aws"
"queryorchestration/internal/serviceconfig/objectstore"
)
// mockAuthConfig provides a minimal implementation of auth.ConfigProvider for testing
type mockAuthConfig struct{}
func (m *mockAuthConfig) GetAuthRegion() string { return "us-east-1" }
func (m *mockAuthConfig) SetAuthRegion(string) {}
func (m *mockAuthConfig) GetAuthUserPoolID() string { return "test-pool" }
func (m *mockAuthConfig) SetAuthUserPoolID(string) {}
func (m *mockAuthConfig) GetAuthClientSecret() string { return "test-secret" }
func (m *mockAuthConfig) SetAuthClientSecret(string) {}
func (m *mockAuthConfig) GetAuthDomain() string { return "test-domain" }
func (m *mockAuthConfig) SetAuthDomain(string) {}
func (m *mockAuthConfig) GetAuthClientID() string { return "test-client-id" }
func (m *mockAuthConfig) SetAuthClientID(string) {}
func (m *mockAuthConfig) GetAuthRedirectURI() string { return "http://localhost/callback" }
func (m *mockAuthConfig) SetAuthRedirectURI(string) {}
func (m *mockAuthConfig) GetAuthTokenURL() string { return "http://localhost/token" }
func (m *mockAuthConfig) SetAuthTokenURL(string) {}
func (m *mockAuthConfig) GetAuthJwksURL() string { return "http://localhost/jwks" }
func (m *mockAuthConfig) SetAuthJwksURL(string) {}
func (m *mockAuthConfig) GetAuthURL() string { return "http://localhost/auth" }
func (m *mockAuthConfig) SetAuthURL(string) {}
func (m *mockAuthConfig) GetAuthLogoutURL() string { return "http://localhost/logout" }
func (m *mockAuthConfig) SetAuthLogoutURL(string) {}
func (m *mockAuthConfig) GetAuthLoginPath() string { return "/login" }
func (m *mockAuthConfig) SetAuthLoginPath(string) {}
func (m *mockAuthConfig) GetAuthCallbackPath() string { return "/callback" }
func (m *mockAuthConfig) SetAuthCallbackPath(string) {}
func (m *mockAuthConfig) GetAuthHomePath() string { return "/home" }
func (m *mockAuthConfig) SetAuthHomePath(string) {}
func (m *mockAuthConfig) GetAuthLogoutPath() string { return "/logout" }
func (m *mockAuthConfig) SetAuthLogoutPath(string) {}
func (m *mockAuthConfig) GetHealthPath() string { return "/health" }
func (m *mockAuthConfig) SetHealthPath(string) {}
func (m *mockAuthConfig) GetAuthLogger() *slog.Logger { return slog.Default() }
func (m *mockAuthConfig) SetAuthLogger(*slog.Logger) {}
func (m *mockAuthConfig) GetAuthRoutePermissions() map[string][]string { return nil }
func (m *mockAuthConfig) SetAuthRoutePermissions(map[string][]string) {}
func (m *mockAuthConfig) GetPermitIOAPIKey() string { return "test-permit-key" }
func (m *mockAuthConfig) SetPermitIOAPIKey(string) {}
func (m *mockAuthConfig) GetPermitIOPDPURL() string { return "http://localhost:7766" }
func (m *mockAuthConfig) SetPermitIOPDPURL(string) {}
func (m *mockAuthConfig) InitializeAuthConfig(string, *slog.Logger) error { return nil }
func (m *mockAuthConfig) GetNoJWTValidation() bool { return false }
func (m *mockAuthConfig) SetNoJWTValidation(bool) {}
// Objectstore interface methods
func (m *mockAuthConfig) GetAWSKeyID() string { return "test-key" }
func (m *mockAuthConfig) SetAWSKeyID(string) {}
func (m *mockAuthConfig) GetAWSSecretKey() string { return "test-secret" }
func (m *mockAuthConfig) SetAWSSecretKey(string) {}
func (m *mockAuthConfig) GetAWSSessionToken() string { return "" }
func (m *mockAuthConfig) SetAWSSessionToken(string) {}
func (m *mockAuthConfig) GetAWSRegion() string { return "us-east-1" }
func (m *mockAuthConfig) SetAWSRegion(string) {}
func (m *mockAuthConfig) GetAWSEndpoint() string { return "http://localhost:4566" }
func (m *mockAuthConfig) SetAWSEndpoint(string) {}
func (m *mockAuthConfig) SetStoreClient(context.Context) error { return nil }
func (m *mockAuthConfig) SetStoreClientFromS3Cfg(objectstore.S3Client) {}
func (m *mockAuthConfig) SetStoreClientAndPingByName(context.Context, string) error { return nil }
func (m *mockAuthConfig) GetStoreClient() objectstore.S3Client { return nil }
func (m *mockAuthConfig) PingStoreByName(context.Context, string) error { return nil }
func (m *mockAuthConfig) SetS3Endpoint(string) {}
func (m *mockAuthConfig) GetS3Endpoint() string { return "http://localhost:4566" }
func (m *mockAuthConfig) SetS3UsePathStyle(bool) {}
func (m *mockAuthConfig) CalculateETag(context.Context, io.Reader) (string, error) {
return "test-etag", nil
}
func (m *mockAuthConfig) GetDirectoryPart(uint16, int64) uint16 { return 0 }
func (m *mockAuthConfig) GetBucket() string { return "test-bucket" }
func (m *mockAuthConfig) SetBucket(string) {}
func (m *mockAuthConfig) GetAWSProfile() aws.Profile { return aws.Profile("default") }
func (m *mockAuthConfig) SetAWSProfile(aws.Profile) {}
func (m *mockAuthConfig) GetBackgroundRunner() *backgroundtask.Runner { return nil }
// NewTestControllers creates a Controllers instance for testing with a mock auth config
func NewTestControllers(services *Services) *Controllers {
return NewControllers(services, &mockAuthConfig{})
}