service/library/contentaudit/video_moderation/sign_test.go

43 lines
1.4 KiB
Go
Raw Permalink Normal View History

2024-04-26 10:46:37 +08:00
package videomoderation
import (
"encoding/json"
"fmt"
"service/api/consts"
video_moderation_proto "service/api/proto/video_moderation/proto"
"service/app/mix/conf"
"service/library/configcenter"
"service/library/logger"
"testing"
green20220302 "github.com/alibabacloud-go/green-20220302/client"
)
func Test(t *testing.T) {
req := &video_moderation_proto.ExtVideoModerationReq{
CheckSum: "e3f8785911c10a53ccf21dfd9d5f5766f4f34dc626f5ced7ea694a9fa0dc7b0b",
Content: "%7B%22Code%22%3A200%2C%22Data%22%3A%7B%22AudioResult%22%3A%7B%22SliceDetails%22%3A%5B%5D%2C%22sliceNum%22%3A0%7D%2C%22DataId%22%3A%2220240426081600662af1e5425a49a65335ce8c%22%2C%22FrameResult%22%3A%7B%22FrameNum%22%3A0%2C%22Frames%22%3A%5B%5D%7D%2C%22TaskId%22%3A%22vi_f_vTaMyN4OY5vj6wcS9fYNXG-1zNv2j%22%7D%2C%22Message%22%3A%22success+finished%22%2C%22RequestId%22%3A%224241743c-f8fc-4a61-a85b-0a530ec73767%22%7D&taskId=vi_f_vTaMyN4OY5vj6wcS9fYNXG-1zNv2j",
}
configPath := consts.MainConfigPath
cfg := new(conf.ConfigSt)
err := configcenter.LoadConfig(configPath, cfg)
if err != nil {
msg := fmt.Sprintf("LoadConfig fail, path: %v, err: %v", configPath, err)
t.Fatal(msg)
}
Init(cfg.VideoModeration)
VerifySign(req)
result := &green20220302.VideoModerationResultResponseBody{}
err = json.Unmarshal([]byte(req.Content), result)
if err != nil {
logger.Error("json unmarshal failed, err: %v", err)
return
}
}