39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
package llm
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
"gitea.maximumdirect.net/eric/audita/internal/core/config"
|
|
)
|
|
|
|
func TestConfiguredSecretsNilConfig(t *testing.T) {
|
|
if got := ConfiguredSecrets(nil); got != nil {
|
|
t.Fatalf("expected nil secrets for nil config, got %v", got)
|
|
}
|
|
}
|
|
|
|
func TestConfiguredSecretsWithValidationOverride(t *testing.T) {
|
|
cfg := config.Default()
|
|
cfg.PrimaryLLM.APIKey = "primary-secret"
|
|
cfg.ValidationLLM.APIKey = "validation-secret"
|
|
|
|
got := ConfiguredSecrets(&cfg)
|
|
want := []string{"primary-secret", "validation-secret", "validation-secret"}
|
|
if !reflect.DeepEqual(got, want) {
|
|
t.Fatalf("unexpected secrets: got=%v want=%v", got, want)
|
|
}
|
|
}
|
|
|
|
func TestConfiguredSecretsWithInheritedValidationKey(t *testing.T) {
|
|
cfg := config.Default()
|
|
cfg.PrimaryLLM.APIKey = "primary-secret"
|
|
cfg.ValidationLLM.APIKey = ""
|
|
|
|
got := ConfiguredSecrets(&cfg)
|
|
want := []string{"primary-secret", "", "primary-secret"}
|
|
if !reflect.DeepEqual(got, want) {
|
|
t.Fatalf("unexpected inherited secrets: got=%v want=%v", got, want)
|
|
}
|
|
}
|