mobile_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package mobile
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "time"
  8. "go-common/app/interface/main/app-wall/conf"
  9. "go-common/app/interface/main/app-wall/model/mobile"
  10. . "github.com/smartystreets/goconvey/convey"
  11. )
  12. var (
  13. d *Dao
  14. )
  15. func ctx() context.Context {
  16. return context.Background()
  17. }
  18. func init() {
  19. dir, _ := filepath.Abs("../../cmd/app-wall-test.toml")
  20. flag.Set("conf", dir)
  21. conf.Init()
  22. d = New(conf.Conf)
  23. time.Sleep(time.Second)
  24. }
  25. func TestInOrdersSync(t *testing.T) {
  26. Convey("unicom InOrdersSync", t, func() {
  27. res, err := d.InOrdersSync(ctx(), &mobile.MobileXML{})
  28. So(err, ShouldBeNil)
  29. So(res, ShouldNotBeEmpty)
  30. })
  31. }
  32. func TestFlowSync(t *testing.T) {
  33. Convey("unicom FlowSync", t, func() {
  34. res, err := d.FlowSync(ctx(), &mobile.MobileXML{})
  35. So(err, ShouldBeNil)
  36. So(res, ShouldNotBeEmpty)
  37. })
  38. }
  39. func TestOrdersUserFlow(t *testing.T) {
  40. Convey("unicom OrdersUserFlow", t, func() {
  41. res, err := d.OrdersUserFlow(ctx(), "", time.Now())
  42. So(err, ShouldBeNil)
  43. So(res, ShouldNotBeEmpty)
  44. })
  45. }
  46. func TestMobileCache(t *testing.T) {
  47. Convey("unicom MobileCache", t, func() {
  48. res, err := d.MobileCache(ctx(), "")
  49. So(err, ShouldBeNil)
  50. So(res, ShouldNotBeEmpty)
  51. })
  52. }