task_test.go 665 B

123456789101112131415161718192021222324252627282930
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/interface/live/push-live/model"
  5. "math/rand"
  6. "testing"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func Test_task(t *testing.T) {
  10. initd()
  11. Convey("Parse Json To Struct", t, func() {
  12. task := &model.ApPushTask{
  13. Type: rand.Intn(9999) + 1,
  14. TargetID: rand.Int63n(9999) + 1,
  15. AlertTitle: "title",
  16. AlertBody: "body",
  17. MidSource: rand.Intn(15),
  18. LinkType: rand.Intn(10),
  19. LinkValue: "link_value",
  20. Total: rand.Intn(9999),
  21. }
  22. affected, err := d.CreateNewTask(context.TODO(), task)
  23. t.Logf("the result included(%v) err(%v)", affected, err)
  24. So(err, ShouldEqual, nil)
  25. })
  26. }