task_qa_video_test.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/admin/main/videoup-task/model"
  5. "testing"
  6. "time"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestDaoInsertQAVideo(t *testing.T) {
  10. var (
  11. tx, _ = d.BeginTran(context.TODO())
  12. dt = &model.VideoDetail{
  13. UPGroups: []int64{0},
  14. }
  15. )
  16. convey.Convey("InsertQAVideo", t, func(ctx convey.C) {
  17. id, err := d.InsertQAVideo(tx, dt)
  18. if err == nil {
  19. tx.Commit()
  20. } else {
  21. tx.Rollback()
  22. }
  23. ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  24. ctx.So(err, convey.ShouldBeNil)
  25. ctx.So(id, convey.ShouldNotBeNil)
  26. })
  27. })
  28. }
  29. func TestDaoQAVideoDetail(t *testing.T) {
  30. var (
  31. c = context.TODO()
  32. ids = []int64{437}
  33. )
  34. convey.Convey("QAVideoDetail", t, func(ctx convey.C) {
  35. list, arr, err := d.QAVideoDetail(c, ids)
  36. ctx.Convey("Then err should be nil.list,arr should not be nil.", func(ctx convey.C) {
  37. ctx.So(err, convey.ShouldBeNil)
  38. ctx.So(arr, convey.ShouldNotBeNil)
  39. ctx.So(list, convey.ShouldNotBeNil)
  40. })
  41. })
  42. }
  43. func TestDaoGetQAVideoID(t *testing.T) {
  44. var (
  45. c = context.TODO()
  46. aid = int64(10110610)
  47. cid = int64(10134188)
  48. taskID = int64(8725)
  49. )
  50. convey.Convey("GetQAVideoID", t, func(ctx convey.C) {
  51. id, err := d.GetQAVideoID(c, aid, cid, taskID)
  52. ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  53. ctx.So(err, convey.ShouldBeNil)
  54. ctx.So(id, convey.ShouldNotBeNil)
  55. })
  56. })
  57. }
  58. func TestDaoUpdateQAVideoUTime(t *testing.T) {
  59. var (
  60. c = context.TODO()
  61. aid = int64(10110610)
  62. cid = int64(10134188)
  63. taskID = int64(8725)
  64. utime = int64(10)
  65. )
  66. convey.Convey("UpdateQAVideoUTime", t, func(ctx convey.C) {
  67. err := d.UpdateQAVideoUTime(c, aid, cid, taskID, utime)
  68. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  69. ctx.So(err, convey.ShouldBeNil)
  70. })
  71. })
  72. }
  73. func TestDaoDelQAVideo(t *testing.T) {
  74. var (
  75. c = context.TODO()
  76. mtime = time.Now().AddDate(-1, -1, 0)
  77. limit = int(1)
  78. )
  79. convey.Convey("DelQAVideo", t, func(ctx convey.C) {
  80. _, err := d.DelQAVideo(c, mtime, limit)
  81. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  82. ctx.So(err, convey.ShouldBeNil)
  83. })
  84. })
  85. }
  86. func TestDaoDelQATask(t *testing.T) {
  87. var (
  88. c = context.TODO()
  89. mtime = time.Now().AddDate(-1, -1, 0)
  90. limit = int(1)
  91. )
  92. convey.Convey("DelQATask", t, func(ctx convey.C) {
  93. _, err := d.DelQATask(c, mtime, limit)
  94. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  95. ctx.So(err, convey.ShouldBeNil)
  96. })
  97. })
  98. }
  99. func TestDaoQATaskVideoByID(t *testing.T) {
  100. var (
  101. c = context.TODO()
  102. )
  103. convey.Convey("QATaskVideoByID", t, func(ctx convey.C) {
  104. _, err := d.QATaskVideoByID(c, 0)
  105. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  106. ctx.So(err, convey.ShouldBeNil)
  107. })
  108. })
  109. }
  110. func TestDaoQATaskVideoSimpleByID(t *testing.T) {
  111. var (
  112. c = context.TODO()
  113. )
  114. convey.Convey("QATaskVideoSimpleByID", t, func(ctx convey.C) {
  115. _, err := d.QATaskVideoSimpleByID(c, 0)
  116. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  117. ctx.So(err, convey.ShouldBeNil)
  118. })
  119. })
  120. }