mc_subtitle_test.go 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/interface/main/dm2/model"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaosubtitleKey(t *testing.T) {
  9. convey.Convey("subtitleKey", t, func(ctx convey.C) {
  10. var (
  11. oid = int64(0)
  12. subtitleID = int64(0)
  13. )
  14. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  15. p1 := testDao.subtitleKey(oid, subtitleID)
  16. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  17. ctx.So(p1, convey.ShouldNotBeNil)
  18. })
  19. })
  20. })
  21. }
  22. func TestDaosubtitleVideoKey(t *testing.T) {
  23. convey.Convey("subtitleVideoKey", t, func(ctx convey.C) {
  24. var (
  25. oid = int64(0)
  26. tp = int32(0)
  27. )
  28. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  29. p1 := testDao.subtitleVideoKey(oid, tp)
  30. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  31. ctx.So(p1, convey.ShouldNotBeNil)
  32. })
  33. })
  34. })
  35. }
  36. func TestDaosubtitleDraftKey(t *testing.T) {
  37. convey.Convey("subtitleDraftKey", t, func(ctx convey.C) {
  38. var (
  39. oid = int64(0)
  40. tp = int32(0)
  41. mid = int64(0)
  42. lan = uint8(0)
  43. )
  44. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  45. p1 := testDao.subtitleDraftKey(oid, tp, mid, lan)
  46. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  47. ctx.So(p1, convey.ShouldNotBeNil)
  48. })
  49. })
  50. })
  51. }
  52. func TestDaosubtitleSubjectKey(t *testing.T) {
  53. convey.Convey("subtitleSubjectKey", t, func(ctx convey.C) {
  54. var (
  55. aid = int64(0)
  56. )
  57. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  58. p1 := testDao.subtitleSubjectKey(aid)
  59. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  60. ctx.So(p1, convey.ShouldNotBeNil)
  61. })
  62. })
  63. })
  64. }
  65. func TestDaosubtitleReportTagKey(t *testing.T) {
  66. convey.Convey("subtitleReportTagKey", t, func(ctx convey.C) {
  67. var (
  68. bid = int64(0)
  69. rid = int64(0)
  70. )
  71. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  72. p1 := testDao.subtitleReportTagKey(bid, rid)
  73. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  74. ctx.So(p1, convey.ShouldNotBeNil)
  75. })
  76. })
  77. })
  78. }
  79. func TestDaoSetVideoSubtitleCache(t *testing.T) {
  80. convey.Convey("SetVideoSubtitleCache", t, func(ctx convey.C) {
  81. var (
  82. c = context.Background()
  83. oid = int64(0)
  84. tp = int32(0)
  85. res = &model.VideoSubtitleCache{}
  86. )
  87. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  88. err := testDao.SetVideoSubtitleCache(c, oid, tp, res)
  89. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  90. ctx.So(err, convey.ShouldBeNil)
  91. })
  92. })
  93. })
  94. }
  95. func TestDaoVideoSubtitleCache(t *testing.T) {
  96. convey.Convey("VideoSubtitleCache", t, func(ctx convey.C) {
  97. var (
  98. c = context.Background()
  99. oid = int64(0)
  100. tp = int32(0)
  101. )
  102. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  103. res, err := testDao.VideoSubtitleCache(c, oid, tp)
  104. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  105. ctx.So(err, convey.ShouldBeNil)
  106. ctx.So(res, convey.ShouldNotBeNil)
  107. })
  108. })
  109. })
  110. }
  111. func TestDaoDelVideoSubtitleCache(t *testing.T) {
  112. convey.Convey("DelVideoSubtitleCache", t, func(ctx convey.C) {
  113. var (
  114. c = context.Background()
  115. oid = int64(0)
  116. tp = int32(0)
  117. )
  118. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  119. err := testDao.DelVideoSubtitleCache(c, oid, tp)
  120. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  121. ctx.So(err, convey.ShouldBeNil)
  122. })
  123. })
  124. })
  125. }
  126. func TestDaoSubtitleDraftCache(t *testing.T) {
  127. convey.Convey("SubtitleDraftCache", t, func(ctx convey.C) {
  128. var (
  129. c = context.Background()
  130. oid = int64(0)
  131. tp = int32(0)
  132. mid = int64(0)
  133. lan = uint8(0)
  134. )
  135. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  136. testDao.SubtitleDraftCache(c, oid, tp, mid, lan)
  137. })
  138. })
  139. }
  140. func TestDaoSetSubtitleDraftCache(t *testing.T) {
  141. convey.Convey("SetSubtitleDraftCache", t, func(ctx convey.C) {
  142. var (
  143. c = context.Background()
  144. subtitle = &model.Subtitle{}
  145. )
  146. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  147. err := testDao.SetSubtitleDraftCache(c, subtitle)
  148. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  149. ctx.So(err, convey.ShouldBeNil)
  150. })
  151. })
  152. })
  153. }
  154. func TestDaoDelSubtitleDraftCache(t *testing.T) {
  155. convey.Convey("DelSubtitleDraftCache", t, func(ctx convey.C) {
  156. var (
  157. c = context.Background()
  158. oid = int64(0)
  159. tp = int32(0)
  160. mid = int64(0)
  161. lan = uint8(0)
  162. )
  163. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  164. err := testDao.DelSubtitleDraftCache(c, oid, tp, mid, lan)
  165. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  166. ctx.So(err, convey.ShouldBeNil)
  167. })
  168. })
  169. })
  170. }
  171. func TestDaoSubtitlesCache(t *testing.T) {
  172. convey.Convey("SubtitlesCache", t, func(ctx convey.C) {
  173. var (
  174. c = context.Background()
  175. oid = int64(0)
  176. subtitleIds = []int64{}
  177. )
  178. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  179. res, missed, err := testDao.SubtitlesCache(c, oid, subtitleIds)
  180. ctx.Convey("Then err should be nil.res,missed should not be nil.", func(ctx convey.C) {
  181. ctx.So(err, convey.ShouldBeNil)
  182. ctx.So(missed, convey.ShouldNotBeNil)
  183. ctx.So(res, convey.ShouldNotBeNil)
  184. })
  185. })
  186. })
  187. }
  188. func TestDaoSubtitleCache(t *testing.T) {
  189. convey.Convey("SubtitleCache", t, func(ctx convey.C) {
  190. var (
  191. c = context.Background()
  192. oid = int64(0)
  193. subtitleID = int64(0)
  194. )
  195. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  196. testDao.SubtitleCache(c, oid, subtitleID)
  197. })
  198. })
  199. }
  200. func TestDaoSetSubtitleCache(t *testing.T) {
  201. convey.Convey("SetSubtitleCache", t, func(ctx convey.C) {
  202. var (
  203. c = context.Background()
  204. subtitle = &model.Subtitle{}
  205. )
  206. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  207. err := testDao.SetSubtitleCache(c, subtitle)
  208. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  209. ctx.So(err, convey.ShouldBeNil)
  210. })
  211. })
  212. })
  213. }
  214. func TestDaoDelSubtitleCache(t *testing.T) {
  215. convey.Convey("DelSubtitleCache", t, func(ctx convey.C) {
  216. var (
  217. c = context.Background()
  218. oid = int64(0)
  219. subtitleID = int64(0)
  220. )
  221. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  222. err := testDao.DelSubtitleCache(c, oid, subtitleID)
  223. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  224. ctx.So(err, convey.ShouldBeNil)
  225. })
  226. })
  227. })
  228. }
  229. func TestDaoSetSubtitleSubjectCache(t *testing.T) {
  230. convey.Convey("SetSubtitleSubjectCache", t, func(ctx convey.C) {
  231. var (
  232. c = context.Background()
  233. subtitleSubject = &model.SubtitleSubject{}
  234. )
  235. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  236. err := testDao.SetSubtitleSubjectCache(c, subtitleSubject)
  237. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  238. ctx.So(err, convey.ShouldBeNil)
  239. })
  240. })
  241. })
  242. }
  243. func TestDaoSubtitleSubjectCache(t *testing.T) {
  244. convey.Convey("SubtitleSubjectCache", t, func(ctx convey.C) {
  245. var (
  246. c = context.Background()
  247. aid = int64(0)
  248. )
  249. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  250. subtitleSubject, err := testDao.SubtitleSubjectCache(c, aid)
  251. ctx.Convey("Then err should be nil.subtitleSubject should not be nil.", func(ctx convey.C) {
  252. ctx.So(err, convey.ShouldBeNil)
  253. ctx.So(subtitleSubject, convey.ShouldNotBeNil)
  254. })
  255. })
  256. })
  257. }
  258. func TestDaoDelSubtitleSubjectCache(t *testing.T) {
  259. convey.Convey("DelSubtitleSubjectCache", t, func(ctx convey.C) {
  260. var (
  261. c = context.Background()
  262. aid = int64(0)
  263. )
  264. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  265. err := testDao.DelSubtitleSubjectCache(c, aid)
  266. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  267. ctx.So(err, convey.ShouldBeNil)
  268. })
  269. })
  270. })
  271. }
  272. func TestDaoSubtitleWorlFlowTagCache(t *testing.T) {
  273. convey.Convey("SubtitleWorlFlowTagCache", t, func(ctx convey.C) {
  274. var (
  275. c = context.Background()
  276. bid = int64(0)
  277. rid = int64(0)
  278. )
  279. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  280. testDao.SubtitleWorlFlowTagCache(c, bid, rid)
  281. })
  282. })
  283. }
  284. func TestDaoSetSubtitleWorlFlowTagCache(t *testing.T) {
  285. convey.Convey("SetSubtitleWorlFlowTagCache", t, func(ctx convey.C) {
  286. var (
  287. c = context.Background()
  288. bid = int64(0)
  289. rid = int64(0)
  290. data = []*model.WorkFlowTag{}
  291. )
  292. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  293. err := testDao.SetSubtitleWorlFlowTagCache(c, bid, rid, data)
  294. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  295. ctx.So(err, convey.ShouldBeNil)
  296. })
  297. })
  298. })
  299. }