功能增加
This commit is contained in:
1 parent
b340fc7ad7
commit
f1993eb388
69 files changed
+2243
-162
No files matched your search
@@ -10,6 +10,8 @@ import (
|
||||
"sort"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.nianxx.cn/wangxuming/NianAIGC/backend/internal/providers"
|
||||
)
|
||||
|
||||
func TestFixtureIsConsumedByGo(t *testing.T) {
|
||||
@@ -27,7 +29,7 @@ func TestFixtureIsConsumedByGo(t *testing.T) {
|
||||
if err := json.Unmarshal(data, &fixture); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if fixture.Version != 1 || fixture.FileName != ".env.local" || len(fixture.AllowedKeys) != 25 || len(fixture.SecretKeys) != 8 {
|
||||
if fixture.Version != 1 || fixture.FileName != ".env.local" || len(fixture.AllowedKeys) != 27 || len(fixture.SecretKeys) != 9 {
|
||||
t.Fatalf("fixture = %#v", fixture)
|
||||
}
|
||||
wantDatabaseKeys := RuntimeSettingKeys()
|
||||
@@ -38,6 +40,23 @@ func TestFixtureIsConsumedByGo(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMinimaxSettingsAreDatabaseBackedAndReportedConnected(t *testing.T) {
|
||||
repository := &runtimeSettingsRepositoryStub{values: map[string]string{
|
||||
"MINIMAX_API_KEY": "secret",
|
||||
"MINIMAX_BASE_URL": "https://api.minimax.test",
|
||||
"VIDEO_GENERATE_ENGINE": "minimax",
|
||||
}}
|
||||
service := NewWithRuntimeRepository(filepath.Join(t.TempDir(), ".env.local"), nil, repository, nil)
|
||||
value, err := service.Get(context.Background())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
payload := value.(Payload)
|
||||
if !payload.Services.Minimax || payload.EngineAssignments[1].Engine != "minimax" || payload.EngineAssignments[1].ReqKey != providers.MinimaxH3Model {
|
||||
t.Fatalf("payload=%#v", payload)
|
||||
}
|
||||
}
|
||||
|
||||
func TestServiceSavePreservesSecretsAndUnrelatedEnvLines(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), ".env.local")
|
||||
original := "# operator note\nDATABASE_URL=postgres://untouched\nZHINIAN_AUTH_SESSION_SECRET=keep-me\nZHINIAN_BILLING_CONTACT=old # prior\nCUSTOM_QUOTED=\"a b\"\n"
|
||||
|
||||
Reference in new issue
Block a user