test
This commit is contained in:
parent
ec8e8e4bb6
commit
0eeb2deef0
|
@ -31,19 +31,33 @@ 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) {
|
func TestOrder(t *testing.T) {
|
||||||
request := &proto.OrderRequest{
|
request := &proto.OrderRequest{
|
||||||
Config: config(),
|
Config: config(),
|
||||||
Order: &proto.OrderRequest_Order{
|
Order: &proto.OrderRequest_Order{
|
||||||
OrderNo: "test_zltx_4",
|
OrderNo: "test_zltx_4",
|
||||||
Account: "18666666666",
|
Account: "18666666666",
|
||||||
Extra: nil,
|
Quantity: 1,
|
||||||
|
Extra: nil,
|
||||||
},
|
},
|
||||||
Product: &proto.OrderRequest_Product{
|
Product: &proto.OrderRequest_Product{
|
||||||
ProductNo: "106",
|
ProductNo: "106",
|
||||||
Extra: []byte(`{}`),
|
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) {
|
t.Run("TestOrder", func(t *testing.T) {
|
||||||
got, err := zltx.Order(context.Background(), request)
|
got, err := zltx.Order(context.Background(), request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue