pgc_single_test.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package cms
  2. import (
  3. "fmt"
  4. "testing"
  5. "go-common/app/interface/main/tv/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDao_SetSnCMSCache(t *testing.T) {
  9. Convey("TestDao_SetSnCMSCache Test", t, WithDao(func(d *Dao) {
  10. err := d.SetSnCMSCache(ctx, &model.SeasonCMS{
  11. SeasonID: 6462,
  12. Cover: "Test_cover1",
  13. Title: "Test_title1",
  14. Desc: "Test_desc1",
  15. })
  16. So(err, ShouldBeNil)
  17. }))
  18. }
  19. func TestDao_GetSnCMSCache(t *testing.T) {
  20. Convey("TestDao_GetSnCMSCache Test", t, WithDao(func(d *Dao) {
  21. sids, errPick := pickIDs(d.db, _pickSids)
  22. if errPick != nil || len(sids) == 0 {
  23. fmt.Println("Empty sids ", errPick)
  24. return
  25. }
  26. sid := sids[0]
  27. d.LoadSnCMS(ctx, sid)
  28. season, err := d.GetSnCMSCache(ctx, sid)
  29. So(err, ShouldBeNil)
  30. So(season, ShouldNotBeNil)
  31. fmt.Println(*season)
  32. }))
  33. }
  34. func TestDao_GetEpCMSCache(t *testing.T) {
  35. Convey("TestDao_GetEpCMSCache Test", t, WithDao(func(d *Dao) {
  36. sids, errPick := pickIDs(d.db, _pickEpids)
  37. if errPick != nil || len(sids) == 0 {
  38. fmt.Println("Empty sids ", errPick)
  39. return
  40. }
  41. epid := sids[1]
  42. ep, err := d.GetEpCMSCache(ctx, epid)
  43. So(err, ShouldBeNil)
  44. So(ep, ShouldNotBeNil)
  45. fmt.Println(*ep)
  46. }))
  47. }
  48. func TestDao_SnCMSCacheKey(t *testing.T) {
  49. Convey("TestDao_SnCMSCacheKey Test", t, WithDao(func(d *Dao) {
  50. key := snCMSCacheKey(177)
  51. So(key, ShouldNotBeBlank)
  52. fmt.Println(key)
  53. }))
  54. }
  55. func TestDao_EPCMSCacheKey(t *testing.T) {
  56. Convey("TestDao_EPCMSCacheKey Test", t, WithDao(func(d *Dao) {
  57. key := epCMSCacheKey(1)
  58. So(key, ShouldNotBeBlank)
  59. fmt.Println(key)
  60. }))
  61. }
  62. func TestDao_ArcCMSCacheKey(t *testing.T) {
  63. Convey("TestDao_ArcCMSCacheKey Test", t, WithDao(func(d *Dao) {
  64. key := d.ArcCMSCacheKey(177)
  65. So(key, ShouldNotBeBlank)
  66. fmt.Println(key)
  67. }))
  68. }