server_test.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package grpc
  2. import (
  3. "context"
  4. "flag"
  5. "fmt"
  6. "path/filepath"
  7. "testing"
  8. sales "go-common/app/service/openplatform/ticket-sales/api/grpc/v1"
  9. "go-common/app/service/openplatform/ticket-sales/conf"
  10. "go-common/app/service/openplatform/ticket-sales/service"
  11. "go-common/app/service/openplatform/ticket-sales/api/grpc/type"
  12. "go-common/library/conf/paladin"
  13. . "github.com/smartystreets/goconvey/convey"
  14. )
  15. var (
  16. s *service.Service
  17. )
  18. func init() {
  19. dir, _ := filepath.Abs("../../cmd/ticket-sales.toml")
  20. flag.Set("conf", dir)
  21. if err := paladin.Init(); err != nil {
  22. panic(err)
  23. }
  24. if err := paladin.Watch("ticket-sales.toml", conf.Conf); err != nil {
  25. panic(err)
  26. }
  27. s = service.New(conf.Conf)
  28. }
  29. //Test_Info
  30. func TestInfo(t *testing.T) {
  31. Convey("get data", t, func() {
  32. data := &sales.UpBuyerRequest{}
  33. data.OrderID = 10000012002571
  34. data.Buyers = &_type.OrderBuyer{
  35. ID: 1,
  36. Name: "wlt",
  37. Tel: "1388888888",
  38. PersonalID: "360822199207227275",
  39. }
  40. res, err := s.UpdateBuyer(context.TODO(), data)
  41. fmt.Println(res)
  42. So(err, ShouldBeNil)
  43. So(res, ShouldNotBeNil)
  44. So(res, ShouldNotBeEmpty)
  45. })
  46. }