order_test.go 845 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package test
  2. import (
  3. "context"
  4. "log"
  5. "testing"
  6. "time"
  7. ordercenterclient "bp.jydev.jianyu360.cn/BaseService/orderCenter/rpc/ordercenter"
  8. "bp.jydev.jianyu360.cn/BaseService/orderCenter/rpc/pb"
  9. "github.com/zeromicro/go-zero/zrpc"
  10. "github.com/zeromicro/go-zero/core/conf"
  11. )
  12. type Config struct {
  13. FileSystemConf zrpc.RpcClientConf
  14. }
  15. var c Config
  16. func init() {
  17. conf.MustLoad("ordercenter.yaml", &c)
  18. }
  19. // go test -v -run Test_OrderList
  20. func Test_OrderList(t *testing.T) {
  21. ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
  22. FileSystem := ordercenterclient.NewOrderCenter(zrpc.MustNewClient(c.FileSystemConf))
  23. req := &pb.OrderListReq{
  24. Appid: "10000",
  25. UserId: 1,
  26. DataType: 2,
  27. PageNum: 1,
  28. PageSize: 10,
  29. }
  30. res, err := FileSystem.OrderList(ctx, req)
  31. log.Println("err ", err)
  32. log.Println("res:", res)
  33. }