dm_seg_test.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/job/main/dm2/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDmsByid(t *testing.T) {
  9. var (
  10. tp int32 = 1
  11. oid int64 = 1221
  12. missed = []int64{719150141, 719150142}
  13. )
  14. Convey("", t, func() {
  15. dms, err := svr.dmsByid(context.TODO(), tp, oid, missed)
  16. So(err, ShouldBeNil)
  17. So(dms, ShouldNotBeEmpty)
  18. for _, dm := range dms {
  19. t.Log(dm)
  20. }
  21. })
  22. }
  23. func TestDMSeg(t *testing.T) {
  24. var (
  25. tp int32 = 1
  26. oid int64 = 1221
  27. childpool int32 = 1
  28. limit int64 = 10
  29. p = &model.Page{Num: 1, Size: model.DefaultVideoEnd, Total: 1}
  30. )
  31. Convey("", t, func() {
  32. res, err := svr.dmSeg(context.TODO(), tp, oid, limit, childpool, p)
  33. So(err, ShouldBeNil)
  34. So(res, ShouldNotBeNil)
  35. t.Logf("%v,length:%d", res, len(res.Elems))
  36. })
  37. }
  38. func TestPageInfo(t *testing.T) {
  39. Convey("", t, func() {
  40. dm := &model.DM{ID: 719182141, Type: 1, Oid: 1221, Progress: 0, Pool: 2}
  41. p, err := svr.pageinfo(context.TODO(), 12345, dm)
  42. So(err, ShouldBeNil)
  43. t.Log(p)
  44. })
  45. }