video_test.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. package archive
  2. import (
  3. "context"
  4. "go-common/app/job/main/videoup/model/archive"
  5. _ "github.com/go-sql-driver/mysql"
  6. . "github.com/smartystreets/goconvey/convey"
  7. "testing"
  8. )
  9. func Test_NewVideo(t *testing.T) {
  10. var (
  11. c = context.TODO()
  12. err error
  13. sub *archive.Video
  14. )
  15. Convey("NewVideo", t, WithDao(func(d *Dao) {
  16. sub, err = d.NewVideo(c, "2333")
  17. So(err, ShouldBeNil)
  18. So(sub, ShouldBeNil)
  19. }))
  20. }
  21. func Test_NewSumDuration(t *testing.T) {
  22. var (
  23. c = context.TODO()
  24. err error
  25. sub int64
  26. )
  27. Convey("NewVideo", t, WithDao(func(d *Dao) {
  28. sub, err = d.NewSumDuration(c, 2333)
  29. So(err, ShouldBeNil)
  30. So(sub, ShouldBeZeroValue)
  31. }))
  32. }
  33. func Test_NewVideoByAid(t *testing.T) {
  34. var (
  35. c = context.TODO()
  36. err error
  37. sub *archive.Video
  38. )
  39. Convey("NewVideoByAid", t, WithDao(func(d *Dao) {
  40. sub, err = d.NewVideoByAid(c, "filename", 2333)
  41. So(err, ShouldBeNil)
  42. So(sub, ShouldBeNil)
  43. }))
  44. }
  45. func Test_NewVideoCount(t *testing.T) {
  46. var (
  47. c = context.TODO()
  48. err error
  49. sub int
  50. )
  51. Convey("NewVideoCount", t, WithDao(func(d *Dao) {
  52. sub, err = d.NewVideoCount(c, 2333)
  53. So(err, ShouldBeNil)
  54. So(sub, ShouldBeZeroValue)
  55. }))
  56. }
  57. func Test_NewVideoCountCapable(t *testing.T) {
  58. var (
  59. c = context.TODO()
  60. err error
  61. sub int
  62. )
  63. Convey("NewVideoCountCapable", t, WithDao(func(d *Dao) {
  64. sub, err = d.NewVideoCountCapable(c, 2333)
  65. So(err, ShouldBeNil)
  66. So(sub, ShouldBeZeroValue)
  67. }))
  68. }
  69. // old TODO deprecated
  70. func Test_Video(t *testing.T) {
  71. var (
  72. c = context.TODO()
  73. err error
  74. sub *archive.Video
  75. )
  76. Convey("Video", t, WithDao(func(d *Dao) {
  77. sub, err = d.NewVideo(c, "2333")
  78. So(err, ShouldBeNil)
  79. So(sub, ShouldBeNil)
  80. }))
  81. }
  82. func Test_SumDuration(t *testing.T) {
  83. var (
  84. c = context.TODO()
  85. err error
  86. sub int64
  87. )
  88. Convey("Video", t, WithDao(func(d *Dao) {
  89. sub, err = d.SumDuration(c, 2333)
  90. So(err, ShouldBeNil)
  91. So(sub, ShouldBeZeroValue)
  92. }))
  93. }
  94. func Test_VideoByAid(t *testing.T) {
  95. var (
  96. c = context.TODO()
  97. err error
  98. sub *archive.Video
  99. )
  100. Convey("VideoByAid", t, WithDao(func(d *Dao) {
  101. sub, err = d.VideoByAid(c, "filename", 2333)
  102. So(err, ShouldBeNil)
  103. So(sub, ShouldBeNil)
  104. }))
  105. }
  106. func Test_VideoCount(t *testing.T) {
  107. var (
  108. c = context.TODO()
  109. err error
  110. )
  111. Convey("VideoCount", t, WithDao(func(d *Dao) {
  112. _, err = d.VideoCount(c, 2333)
  113. So(err, ShouldBeNil)
  114. }))
  115. }
  116. func Test_VideoCountCapable(t *testing.T) {
  117. var (
  118. c = context.TODO()
  119. err error
  120. sub int
  121. )
  122. Convey("VideoCountCapable", t, WithDao(func(d *Dao) {
  123. sub, err = d.VideoCountCapable(c, 2333)
  124. So(err, ShouldBeNil)
  125. So(sub, ShouldBeZeroValue)
  126. }))
  127. }
  128. func Test_Reason(t *testing.T) {
  129. var (
  130. c = context.TODO()
  131. err error
  132. sub string
  133. )
  134. Convey("Reason", t, WithDao(func(d *Dao) {
  135. sub, err = d.Reason(c, 2333)
  136. So(err, ShouldBeNil)
  137. So(sub, ShouldBeEmpty)
  138. }))
  139. }