vip_test.go 753 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package service
  2. import (
  3. "context"
  4. "flag"
  5. "testing"
  6. "time"
  7. "go-common/app/job/main/card/conf"
  8. "go-common/app/job/main/card/model"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. c = context.TODO()
  13. s *Service
  14. )
  15. func init() {
  16. var (
  17. err error
  18. )
  19. flag.Set("conf", "../cmd/test.toml")
  20. if err = conf.Init(); err != nil {
  21. panic(err)
  22. }
  23. c = context.Background()
  24. if s == nil {
  25. s = New(conf.Conf)
  26. }
  27. time.Sleep(time.Second)
  28. }
  29. // go test -test.v -test.run TestChangeEquipTime
  30. func TestChangeEquipTime(t *testing.T) {
  31. Convey("TestChangeEquipTime ", t, func() {
  32. So(s.ChangeEquipTime(c, &model.VipReq{
  33. Mid: 1,
  34. VipType: 2,
  35. VipStatus: 1,
  36. VipOverdueTime: time.Now().Unix(),
  37. }), ShouldBeNil)
  38. })
  39. }