new_video_test.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. package archive
  2. import (
  3. "context"
  4. "github.com/smartystreets/goconvey/convey"
  5. "testing"
  6. )
  7. func Test_videoSrcTypeByIDs(t *testing.T) {
  8. convey.Convey("根据cid获取最新的上传类型src_type", t, WithDao(func(d *Dao) {
  9. ids := []int64{385, 386, 387, 388}
  10. m, err := d.VideoSrcTypeByIDs(context.TODO(), ids)
  11. convey.So(err, convey.ShouldBeNil)
  12. convey.So(len(m), convey.ShouldBeLessThanOrEqualTo, len(ids))
  13. }))
  14. }
  15. func Test_vIDByAIDFilename(t *testing.T) {
  16. convey.Convey("根据aid+filename获取分p的vid", t, WithDao(func(d *Dao) {
  17. aid := int64(161)
  18. filename := "d74b1c1cda32e5740658a2517fd82965"
  19. _, err := d.VIDByAIDFilename(context.TODO(), aid, filename)
  20. convey.So(err, convey.ShouldBeNil)
  21. }))
  22. }
  23. func TestDao_VideoInfo(t *testing.T) {
  24. convey.Convey("VideoInfo", t, WithDao(func(d *Dao) {
  25. _, err := d.VideoInfo(context.Background(), 10098493, 10109201)
  26. convey.So(err, convey.ShouldBeNil)
  27. }))
  28. }
  29. func TestDao_VideoByCID(t *testing.T) {
  30. convey.Convey("VideoByCID", t, WithDao(func(d *Dao) {
  31. info, err := d.VideoByCID(context.Background(), 10109201)
  32. convey.So(err, convey.ShouldBeNil)
  33. convey.So(info, convey.ShouldNotBeNil)
  34. }))
  35. }
  36. func TestDao_VideoRelated(t *testing.T) {
  37. convey.Convey("VideoRelated", t, WithDao(func(d *Dao) {
  38. v, err := d.VideoRelated(context.Background(), 10098493)
  39. t.Logf("VideoRelated(%+v)\r\n", v)
  40. convey.So(err, convey.ShouldBeNil)
  41. convey.So(v, convey.ShouldNotBeNil)
  42. }))
  43. }
  44. func Test_TxUpRelation(t *testing.T) {
  45. var c = context.Background()
  46. convey.Convey("TxUpRelation", t, WithDao(func(d *Dao) {
  47. tx, _ := d.BeginTran(c)
  48. _, err := d.TxUpRelation(tx, 0, "", "")
  49. convey.So(err, convey.ShouldBeNil)
  50. tx.Commit()
  51. }))
  52. }
  53. func Test_TxUpRelationOrder(t *testing.T) {
  54. var c = context.Background()
  55. convey.Convey("TxUpRelationOrder", t, WithDao(func(d *Dao) {
  56. tx, _ := d.BeginTran(c)
  57. _, err := d.TxUpRelationOrder(tx, 0, 0)
  58. convey.So(err, convey.ShouldBeNil)
  59. tx.Commit()
  60. }))
  61. }
  62. func Test_TxUpRelationState(t *testing.T) {
  63. var c = context.Background()
  64. convey.Convey("TxUpRelationState", t, WithDao(func(d *Dao) {
  65. tx, _ := d.BeginTran(c)
  66. _, err := d.TxUpRelationState(tx, 0, 0)
  67. convey.So(err, convey.ShouldBeNil)
  68. tx.Commit()
  69. }))
  70. }
  71. func Test_TxUpWebLink(t *testing.T) {
  72. var c = context.Background()
  73. convey.Convey("TxUpWebLink", t, WithDao(func(d *Dao) {
  74. tx, _ := d.BeginTran(c)
  75. _, err := d.TxUpWebLink(tx, 0, "")
  76. convey.So(err, convey.ShouldBeNil)
  77. tx.Commit()
  78. }))
  79. }
  80. func Test_TxUpStatus(t *testing.T) {
  81. var c = context.Background()
  82. convey.Convey("TxUpStatus", t, WithDao(func(d *Dao) {
  83. tx, _ := d.BeginTran(c)
  84. _, err := d.TxUpStatus(tx, 0, 0)
  85. convey.So(err, convey.ShouldBeNil)
  86. tx.Commit()
  87. }))
  88. }
  89. func Test_TxUpAttr(t *testing.T) {
  90. var c = context.Background()
  91. convey.Convey("TxUpAttr", t, WithDao(func(d *Dao) {
  92. tx, _ := d.BeginTran(c)
  93. _, err := d.TxUpAttr(tx, 0, 0, 0)
  94. convey.So(err, convey.ShouldBeNil)
  95. tx.Commit()
  96. }))
  97. }
  98. func Test_VideoPlayurl(t *testing.T) {
  99. var c = context.Background()
  100. convey.Convey("VideoPlayurl", t, WithDao(func(d *Dao) {
  101. _, err := d.VideoPlayurl(c, 0)
  102. convey.So(err, convey.ShouldBeNil)
  103. }))
  104. }
  105. func Test_NewVideoByID(t *testing.T) {
  106. var c = context.Background()
  107. convey.Convey("NewVideoByID", t, WithDao(func(d *Dao) {
  108. _, err := d.NewVideoByID(c, 0)
  109. convey.So(err, convey.ShouldBeNil)
  110. }))
  111. }
  112. func Test_NewVideoByIDs(t *testing.T) {
  113. var c = context.Background()
  114. convey.Convey("NewVideoByIDs", t, WithDao(func(d *Dao) {
  115. _, err := d.NewVideoByIDs(c, []int64{1, 2, 3})
  116. convey.So(err, convey.ShouldBeNil)
  117. }))
  118. }
  119. func Test_NewVideosByAid(t *testing.T) {
  120. var c = context.Background()
  121. convey.Convey("NewVideosByAid", t, WithDao(func(d *Dao) {
  122. _, err := d.NewVideosByAid(c, 0)
  123. convey.So(err, convey.ShouldBeNil)
  124. }))
  125. }
  126. func Test_NewVideoCount(t *testing.T) {
  127. var c = context.Background()
  128. convey.Convey("NewVideoCount", t, WithDao(func(d *Dao) {
  129. _, err := d.NewVideoCount(c, 0)
  130. convey.So(err, convey.ShouldBeNil)
  131. }))
  132. }