门禁兼容修复
This commit is contained in:
1 parent
f60b416949
commit
801c0af692
18 files changed
+257
-87
No files matched your search
@@ -22,6 +22,10 @@ func TestNewDashScopeChatHandlerRejectsUnsafeOptions(t *testing.T) {
|
||||
{AppID: "app/other", AuthToken: testChatToken, MaxBodyBytes: 1, RunTimeout: time.Second},
|
||||
{AppID: "app.other", AuthToken: testChatToken, MaxBodyBytes: 1, RunTimeout: time.Second},
|
||||
{AppID: testDashScopeAppID, AuthToken: "short", MaxBodyBytes: 1, RunTimeout: time.Second},
|
||||
{AppID: testDashScopeAppID, AuthToken: "", AllowLegacyShortToken: true, MaxBodyBytes: 1, RunTimeout: time.Second},
|
||||
{AppID: testDashScopeAppID, AuthToken: "delivered\tkey", AllowLegacyShortToken: true, MaxBodyBytes: 1, RunTimeout: time.Second},
|
||||
{AppID: testDashScopeAppID, AuthToken: "delivered密钥", AllowLegacyShortToken: true, MaxBodyBytes: 1, RunTimeout: time.Second},
|
||||
{AppID: testDashScopeAppID, AuthToken: strings.Repeat("a", 4097), AllowLegacyShortToken: true, MaxBodyBytes: 1, RunTimeout: time.Second},
|
||||
{AppID: testDashScopeAppID, AuthToken: testChatToken, MaxBodyBytes: maximumChatBodyBytes + 1, RunTimeout: time.Second},
|
||||
{AppID: testDashScopeAppID, AuthToken: testChatToken, MaxBodyBytes: 1, RunTimeout: maximumChatRunTime + time.Second},
|
||||
{AppID: testDashScopeAppID, AuthToken: testChatToken, AllowedOrigins: []string{"*"}, MaxBodyBytes: 1, RunTimeout: time.Second},
|
||||
@@ -38,6 +42,19 @@ func TestNewDashScopeChatHandlerRejectsUnsafeOptions(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewDashScopeChatHandlerAllowsExplicitLegacyShortToken(t *testing.T) {
|
||||
_, err := NewDashScopeChatHandler(&fakeChatUseCase{}, DashScopeChatOptions{
|
||||
AppID: testDashScopeAppID,
|
||||
AuthToken: "delivered-key",
|
||||
AllowLegacyShortToken: true,
|
||||
MaxBodyBytes: 1,
|
||||
RunTimeout: time.Second,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("NewDashScopeChatHandler() error = %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDashScopeChatStreamsCompatibleResultAfterStrictSuccess(t *testing.T) {
|
||||
turn := &fakeChatTurn{
|
||||
conversationID: "conv_0123456789abcdef01234567",
|
||||
|
||||
Reference in new issue
Block a user