-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeature_test.go
More file actions
39 lines (35 loc) · 985 Bytes
/
feature_test.go
File metadata and controls
39 lines (35 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package iflytek_test
import (
"encoding/base64"
dgctx "github.com/darwinOrg/go-common/context"
dgkdxf "github.com/darwinOrg/go-iflytek"
"github.com/google/uuid"
"os"
"testing"
)
func TestRegisterFeature(t *testing.T) {
audioData, _ := os.ReadFile("test.wav")
audioDataStr := base64.StdEncoding.EncodeToString(audioData)
req := &dgkdxf.RegisterFeatureRequest{
AudioData: audioDataStr,
AudioType: dgkdxf.AudioTypeRaw,
Uid: uuid.NewString(),
}
host := "https://office-api-personal-dx.iflyaisol.com"
appId := os.Getenv("appId")
accessKeyId := os.Getenv("accessKeyId")
accessKeySecret := os.Getenv("accessKeySecret")
ctx := &dgctx.DgContext{TraceId: uuid.NewString()}
client := dgkdxf.NewClient(&dgkdxf.ClientConfig{
AppId: appId,
Host: host,
AccessKeyId: accessKeyId,
AccessKeySecret: accessKeySecret,
})
featureId, err := client.RegisterFeature(ctx, req)
if err != nil {
t.Error(err)
} else {
t.Log(featureId)
}
}