api_test.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448
  1. package datadao
  2. import (
  3. "context"
  4. "go-common/app/interface/main/mcn/tool/datacenter"
  5. "testing"
  6. "time"
  7. "github.com/smartystreets/goconvey/convey"
  8. "go-common/app/interface/main/mcn/model/datamodel"
  9. )
  10. func TestDatadaocallDataAPI(t *testing.T) {
  11. convey.Convey("callDataAPI", t, func(ctx convey.C) {
  12. var (
  13. c = context.Background()
  14. api = APIMcnSummary
  15. query = &datacenter.Query{}
  16. res []*datamodel.DmConMcnArchiveD
  17. )
  18. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  19. err := d.callDataAPI(c, api, query, res)
  20. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  21. ctx.So(err, convey.ShouldBeNil)
  22. })
  23. })
  24. })
  25. }
  26. func TestDatadaoGetMcnSummary(t *testing.T) {
  27. convey.Convey("GetMcnSummary", t, func(ctx convey.C) {
  28. var (
  29. c = context.Background()
  30. signID = int64(0)
  31. date = time.Now()
  32. )
  33. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  34. res, err := d.GetMcnSummary(c, signID, date)
  35. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  36. ctx.So(err, convey.ShouldBeNil)
  37. ctx.So(res, convey.ShouldNotBeNil)
  38. })
  39. })
  40. })
  41. }
  42. func TestDatadaoGetMcnSummaryCache(t *testing.T) {
  43. convey.Convey("GetMcnSummaryCache", t, func(ctx convey.C) {
  44. var (
  45. c = context.Background()
  46. signID = int64(0)
  47. date = time.Now()
  48. )
  49. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  50. res, err := d.GetMcnSummaryCache(c, signID, date)
  51. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  52. ctx.So(err, convey.ShouldBeNil)
  53. ctx.So(res, convey.ShouldNotBeNil)
  54. })
  55. })
  56. })
  57. }
  58. func TestDatadaoGetIndexInc(t *testing.T) {
  59. convey.Convey("GetIndexInc", t, func(ctx convey.C) {
  60. var (
  61. c = context.Background()
  62. signID = int64(0)
  63. date = time.Now()
  64. tp = ""
  65. )
  66. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  67. res, err := d.GetIndexInc(c, signID, date, tp)
  68. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  69. ctx.So(err, convey.ShouldBeNil)
  70. ctx.So(res, convey.ShouldNotBeNil)
  71. })
  72. })
  73. })
  74. }
  75. func TestDatadaoGetIndexIncCache(t *testing.T) {
  76. convey.Convey("GetIndexIncCache", t, func(ctx convey.C) {
  77. var (
  78. c = context.Background()
  79. signID = int64(0)
  80. date = time.Now()
  81. tp = ""
  82. )
  83. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  84. res, err := d.GetIndexIncCache(c, signID, date, tp)
  85. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  86. ctx.So(err, convey.ShouldBeNil)
  87. ctx.So(res, convey.ShouldNotBeNil)
  88. })
  89. })
  90. })
  91. }
  92. func TestDatadaoGetIndexSource(t *testing.T) {
  93. convey.Convey("GetIndexSource", t, func(ctx convey.C) {
  94. var (
  95. c = context.Background()
  96. signID = int64(0)
  97. date = time.Now()
  98. tp = ""
  99. )
  100. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  101. res, err := d.GetIndexSource(c, signID, date, tp)
  102. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  103. ctx.So(err, convey.ShouldBeNil)
  104. ctx.So(res, convey.ShouldNotBeNil)
  105. })
  106. })
  107. })
  108. }
  109. func TestDatadaoGetIndexSourceCache(t *testing.T) {
  110. convey.Convey("GetIndexSourceCache", t, func(ctx convey.C) {
  111. var (
  112. c = context.Background()
  113. signID = int64(0)
  114. date = time.Now()
  115. tp = ""
  116. )
  117. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  118. res, err := d.GetIndexSourceCache(c, signID, date, tp)
  119. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  120. ctx.So(err, convey.ShouldBeNil)
  121. ctx.So(res, convey.ShouldNotBeNil)
  122. })
  123. })
  124. })
  125. }
  126. func TestDatadaoGetPlaySource(t *testing.T) {
  127. convey.Convey("GetPlaySource", t, func(ctx convey.C) {
  128. var (
  129. c = context.Background()
  130. signID = int64(0)
  131. date = time.Now()
  132. )
  133. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  134. res, err := d.GetPlaySource(c, signID, date)
  135. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  136. ctx.So(err, convey.ShouldBeNil)
  137. ctx.So(res, convey.ShouldNotBeNil)
  138. })
  139. })
  140. })
  141. }
  142. func TestDatadaoGetPlaySourceCache(t *testing.T) {
  143. convey.Convey("GetPlaySourceCache", t, func(ctx convey.C) {
  144. var (
  145. c = context.Background()
  146. signID = int64(0)
  147. date = time.Now()
  148. )
  149. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  150. res, err := d.GetPlaySourceCache(c, signID, date)
  151. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  152. ctx.So(err, convey.ShouldBeNil)
  153. ctx.So(res, convey.ShouldNotBeNil)
  154. })
  155. })
  156. })
  157. }
  158. func TestDatadaoGetMcnFans(t *testing.T) {
  159. convey.Convey("GetMcnFans", t, func(ctx convey.C) {
  160. var (
  161. c = context.Background()
  162. signID = int64(0)
  163. date = time.Now()
  164. )
  165. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  166. res, err := d.GetMcnFans(c, signID, date)
  167. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  168. ctx.So(err, convey.ShouldBeNil)
  169. ctx.So(res, convey.ShouldNotBeNil)
  170. })
  171. })
  172. })
  173. }
  174. func TestDatadaoGetMcnFansCache(t *testing.T) {
  175. convey.Convey("GetMcnFansCache", t, func(ctx convey.C) {
  176. var (
  177. c = context.Background()
  178. signID = int64(0)
  179. date = time.Now()
  180. )
  181. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  182. res, err := d.GetMcnFansCache(c, signID, date)
  183. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  184. ctx.So(err, convey.ShouldBeNil)
  185. ctx.So(res, convey.ShouldNotBeNil)
  186. })
  187. })
  188. })
  189. }
  190. func TestDatadaoGetMcnFansInc(t *testing.T) {
  191. convey.Convey("GetMcnFansInc", t, func(ctx convey.C) {
  192. var (
  193. c = context.Background()
  194. signID = int64(0)
  195. date = time.Now()
  196. )
  197. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  198. res, err := d.GetMcnFansInc(c, signID, date)
  199. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  200. ctx.So(err, convey.ShouldBeNil)
  201. ctx.So(res, convey.ShouldNotBeNil)
  202. })
  203. })
  204. })
  205. }
  206. func TestDatadaoGetMcnFansIncCache(t *testing.T) {
  207. convey.Convey("GetMcnFansIncCache", t, func(ctx convey.C) {
  208. var (
  209. c = context.Background()
  210. signID = int64(0)
  211. date = time.Now()
  212. )
  213. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  214. res, err := d.GetMcnFansIncCache(c, signID, date)
  215. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  216. ctx.So(err, convey.ShouldBeNil)
  217. ctx.So(res, convey.ShouldNotBeNil)
  218. })
  219. })
  220. })
  221. }
  222. func TestDatadaoGetMcnFansDec(t *testing.T) {
  223. convey.Convey("GetMcnFansDec", t, func(ctx convey.C) {
  224. var (
  225. c = context.Background()
  226. signID = int64(0)
  227. date = time.Now()
  228. )
  229. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  230. res, err := d.GetMcnFansDec(c, signID, date)
  231. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  232. ctx.So(err, convey.ShouldBeNil)
  233. ctx.So(res, convey.ShouldNotBeNil)
  234. })
  235. })
  236. })
  237. }
  238. func TestDatadaoGetMcnFansDecCache(t *testing.T) {
  239. convey.Convey("GetMcnFansDecCache", t, func(ctx convey.C) {
  240. var (
  241. c = context.Background()
  242. signID = int64(0)
  243. date = time.Now()
  244. )
  245. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  246. res, err := d.GetMcnFansDecCache(c, signID, date)
  247. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  248. ctx.So(err, convey.ShouldBeNil)
  249. ctx.So(res, convey.ShouldNotBeNil)
  250. })
  251. })
  252. })
  253. }
  254. func TestDatadaoGetMcnFansAttentionWay(t *testing.T) {
  255. convey.Convey("GetMcnFansAttentionWay", t, func(ctx convey.C) {
  256. var (
  257. c = context.Background()
  258. signID = int64(0)
  259. date = time.Now()
  260. )
  261. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  262. res, err := d.GetMcnFansAttentionWay(c, signID, date)
  263. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  264. ctx.So(err, convey.ShouldBeNil)
  265. ctx.So(res, convey.ShouldNotBeNil)
  266. })
  267. })
  268. })
  269. }
  270. func TestDatadaoGetMcnFansAttentionWayCache(t *testing.T) {
  271. convey.Convey("GetMcnFansAttentionWayCache", t, func(ctx convey.C) {
  272. var (
  273. c = context.Background()
  274. signID = int64(0)
  275. date = time.Now()
  276. )
  277. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  278. res, err := d.GetMcnFansAttentionWayCache(c, signID, date)
  279. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  280. ctx.So(err, convey.ShouldBeNil)
  281. ctx.So(res, convey.ShouldNotBeNil)
  282. })
  283. })
  284. })
  285. }
  286. func TestDatadaoGetFansBaseFansAttr(t *testing.T) {
  287. convey.Convey("GetFansBaseFansAttr", t, func(ctx convey.C) {
  288. var (
  289. c = context.Background()
  290. signID = int64(0)
  291. date = time.Now()
  292. tp = ""
  293. )
  294. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  295. res, err := d.GetFansBaseFansAttr(c, signID, date, tp)
  296. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  297. ctx.So(err, convey.ShouldBeNil)
  298. ctx.So(res, convey.ShouldNotBeNil)
  299. })
  300. })
  301. })
  302. }
  303. func TestDatadaoGetFansBaseFansAttrCache(t *testing.T) {
  304. convey.Convey("GetFansBaseFansAttrCache", t, func(ctx convey.C) {
  305. var (
  306. c = context.Background()
  307. signID = int64(0)
  308. date = time.Now()
  309. tp = ""
  310. )
  311. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  312. res, err := d.GetFansBaseFansAttrCache(c, signID, date, tp)
  313. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  314. ctx.So(err, convey.ShouldBeNil)
  315. ctx.So(res, convey.ShouldNotBeNil)
  316. })
  317. })
  318. })
  319. }
  320. func TestDatadaoGetFansArea(t *testing.T) {
  321. convey.Convey("GetFansArea", t, func(ctx convey.C) {
  322. var (
  323. c = context.Background()
  324. signID = int64(0)
  325. date = time.Now()
  326. tp = ""
  327. )
  328. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  329. res, err := d.GetFansArea(c, signID, date, tp)
  330. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  331. ctx.So(err, convey.ShouldBeNil)
  332. ctx.So(res, convey.ShouldNotBeNil)
  333. })
  334. })
  335. })
  336. }
  337. func TestDatadaoGetFansAreaCache(t *testing.T) {
  338. convey.Convey("GetFansAreaCache", t, func(ctx convey.C) {
  339. var (
  340. c = context.Background()
  341. signID = int64(0)
  342. date = time.Now()
  343. tp = ""
  344. )
  345. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  346. res, err := d.GetFansAreaCache(c, signID, date, tp)
  347. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  348. ctx.So(err, convey.ShouldBeNil)
  349. ctx.So(res, convey.ShouldNotBeNil)
  350. })
  351. })
  352. })
  353. }
  354. func TestDatadaoGetFansType(t *testing.T) {
  355. convey.Convey("GetFansType", t, func(ctx convey.C) {
  356. var (
  357. c = context.Background()
  358. signID = int64(0)
  359. date = time.Now()
  360. tp = ""
  361. )
  362. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  363. res, err := d.GetFansType(c, signID, date, tp)
  364. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  365. ctx.So(err, convey.ShouldBeNil)
  366. ctx.So(res, convey.ShouldNotBeNil)
  367. })
  368. })
  369. })
  370. }
  371. func TestDatadaoGetFansTypeCache(t *testing.T) {
  372. convey.Convey("GetFansTypeCache", t, func(ctx convey.C) {
  373. var (
  374. c = context.Background()
  375. signID = int64(0)
  376. date = time.Now()
  377. tp = ""
  378. )
  379. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  380. res, err := d.GetFansTypeCache(c, signID, date, tp)
  381. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  382. ctx.So(err, convey.ShouldBeNil)
  383. ctx.So(res, convey.ShouldNotBeNil)
  384. })
  385. })
  386. })
  387. }
  388. func TestDatadaoGetFansTag(t *testing.T) {
  389. convey.Convey("GetFansTag", t, func(ctx convey.C) {
  390. var (
  391. c = context.Background()
  392. signID = int64(0)
  393. date = time.Now()
  394. tp = ""
  395. )
  396. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  397. res, err := d.GetFansTag(c, signID, date, tp)
  398. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  399. ctx.So(err, convey.ShouldBeNil)
  400. ctx.So(res, convey.ShouldNotBeNil)
  401. })
  402. })
  403. })
  404. }
  405. func TestDatadaoGetFansTagCache(t *testing.T) {
  406. convey.Convey("GetFansTagCache", t, func(ctx convey.C) {
  407. var (
  408. c = context.Background()
  409. signID = int64(0)
  410. date = time.Now()
  411. tp = ""
  412. )
  413. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  414. res, err := d.GetFansTagCache(c, signID, date, tp)
  415. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  416. ctx.So(err, convey.ShouldBeNil)
  417. ctx.So(res, convey.ShouldNotBeNil)
  418. })
  419. })
  420. })
  421. }