test
This commit is contained in:
parent
ec8e8e4bb6
commit
0eeb2deef0
|
@ -31,12 +31,22 @@ func TestConfig(t *testing.T) {
|
|||
})
|
||||
}
|
||||
|
||||
func StrIdx(str string, substr string) string {
|
||||
substr = fmt.Sprintf("%s:", substr) // "order:" "result:"
|
||||
index := strings.Index(str, substr)
|
||||
if index == -1 {
|
||||
return ""
|
||||
}
|
||||
return str[index+len(substr):]
|
||||
}
|
||||
|
||||
func TestOrder(t *testing.T) {
|
||||
request := &proto.OrderRequest{
|
||||
Config: config(),
|
||||
Order: &proto.OrderRequest_Order{
|
||||
OrderNo: "test_zltx_4",
|
||||
Account: "18666666666",
|
||||
Quantity: 1,
|
||||
Extra: nil,
|
||||
},
|
||||
Product: &proto.OrderRequest_Product{
|
||||
|
@ -44,6 +54,10 @@ func TestOrder(t *testing.T) {
|
|||
Extra: []byte(`{}`),
|
||||
},
|
||||
}
|
||||
fmt.Println(request.String())
|
||||
//fmt.Println(StrIdx(request.String(), "order"))
|
||||
//fmt.Println(StrIdx(request.String(), "product"))
|
||||
|
||||
t.Run("TestOrder", func(t *testing.T) {
|
||||
got, err := zltx.Order(context.Background(), request)
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in New Issue