## Merged Features from sub2apipro - Sora video generation integration (OpenAI Sora API) - Group management enhancements - Usage log improvements - Security headers middleware ## Chinese Model Pricing Updates - GLM-5, GLM-5-Turbo, GLM-5.1, GLM-4.7, GLM-4.5-Air - Baichuan4, Baichuan4-Turbo, Baichuan4-Air, Baichuan-M3-Plus - DeepSeek-V3, DeepSeek-V3.2, DeepSeek-R1 - Qwen3-8B (free), Qwen2.5-72B-Instruct ## URL Whitelist Additions - api.baichuan-ai.com (百川智能) - api.siliconflow.cn (硅基流动) - api.z.ai (智谱国际) - api.groq.com (Groq加速推理) ## Documentation - Added merge guide (docs/MERGE_GUIDE.md) - Added quick reference (docs/MERGE_QUICKREF.md) - Added review reports (docs/reviews/)
35 lines
888 B
Go
35 lines
888 B
Go
package service
|
|
|
|
import "testing"
|
|
|
|
func TestSoraMediaSignVerify(t *testing.T) {
|
|
key := "test-key"
|
|
path := "/tmp/abc.png"
|
|
query := "a=1&b=2"
|
|
expires := int64(1700000000)
|
|
|
|
signature := SignSoraMediaURL(path, query, expires, key)
|
|
if signature == "" {
|
|
t.Fatal("签名为空")
|
|
}
|
|
if !VerifySoraMediaURL(path, query, expires, signature, key) {
|
|
t.Fatal("签名校验失败")
|
|
}
|
|
if VerifySoraMediaURL(path, "a=1", expires, signature, key) {
|
|
t.Fatal("签名参数不同仍然通过")
|
|
}
|
|
if VerifySoraMediaURL(path, query, expires+1, signature, key) {
|
|
t.Fatal("签名过期校验未失败")
|
|
}
|
|
}
|
|
|
|
func TestSoraMediaSignWithEmptyKey(t *testing.T) {
|
|
signature := SignSoraMediaURL("/tmp/a.png", "a=1", 1, "")
|
|
if signature != "" {
|
|
t.Fatalf("空密钥不应生成签名")
|
|
}
|
|
if VerifySoraMediaURL("/tmp/a.png", "a=1", 1, "sig", "") {
|
|
t.Fatalf("空密钥不应通过校验")
|
|
}
|
|
}
|