pgc_load_test.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package cms
  2. import (
  3. "context"
  4. "fmt"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestCmsLoadSnsAuthMap(t *testing.T) {
  9. var (
  10. ctx = context.Background()
  11. sids = []int64{}
  12. )
  13. convey.Convey("LoadSnsAuthMap", t, func(c convey.C) {
  14. resMetas, err := d.LoadSnsAuthMap(ctx, sids)
  15. c.Convey("Then err should be nil.resMetas should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. ctx.So(resMetas, convey.ShouldNotBeNil)
  18. })
  19. })
  20. }
  21. func TestCmsLoadEpsAuthMap(t *testing.T) {
  22. var (
  23. ctx = context.Background()
  24. epids = []int64{}
  25. )
  26. convey.Convey("LoadEpsAuthMap", t, func(c convey.C) {
  27. resMetas, err := d.LoadEpsAuthMap(ctx, epids)
  28. c.Convey("Then err should be nil.resMetas should not be nil.", func(ctx convey.C) {
  29. ctx.So(err, convey.ShouldBeNil)
  30. ctx.So(resMetas, convey.ShouldNotBeNil)
  31. })
  32. })
  33. }
  34. func TestCmsLoadSnsCMSMap(t *testing.T) {
  35. var (
  36. ctx = context.Background()
  37. sids = []int64{}
  38. )
  39. convey.Convey("LoadSnsCMSMap", t, func(c convey.C) {
  40. resMetas, err := d.LoadSnsCMSMap(ctx, sids)
  41. c.Convey("Then err should be nil.resMetas should not be nil.", func(ctx convey.C) {
  42. ctx.So(err, convey.ShouldBeNil)
  43. ctx.So(resMetas, convey.ShouldNotBeNil)
  44. })
  45. })
  46. }
  47. func TestCmsLoadSnsCMS(t *testing.T) {
  48. var (
  49. ctx = context.Background()
  50. sids = []int64{}
  51. err error
  52. )
  53. convey.Convey("LoadSnsCMS", t, func(c convey.C) {
  54. c.Convey("Then err should be nil.seasons,newestEpids should not be nil.", func(cx convey.C) {
  55. if sids, err = pickIDs(d.db, _pickSids); err != nil || len(sids) == 0 {
  56. fmt.Println("Empty Sids ", err)
  57. return
  58. }
  59. seasons, newestEpids, err := d.LoadSnsCMS(ctx, sids)
  60. cx.So(err, convey.ShouldBeNil)
  61. cx.So(newestEpids, convey.ShouldNotBeNil)
  62. cx.So(seasons, convey.ShouldNotBeNil)
  63. })
  64. })
  65. }
  66. func TestCmsLoadSnCMS(t *testing.T) {
  67. var (
  68. ctx = context.Background()
  69. sid = int64(0)
  70. )
  71. convey.Convey("LoadSnCMS", t, func(c convey.C) {
  72. sn, err := d.LoadSnCMS(ctx, sid)
  73. c.Convey("Then err should be nil.sn should not be nil.", func(ctx convey.C) {
  74. ctx.So(err, convey.ShouldBeNil)
  75. ctx.So(sn, convey.ShouldNotBeNil)
  76. })
  77. })
  78. }
  79. func TestCmsLoadEpCMS(t *testing.T) {
  80. var (
  81. ctx = context.Background()
  82. epid = int64(0)
  83. )
  84. convey.Convey("LoadEpCMS", t, func(c convey.C) {
  85. ep, err := d.LoadEpCMS(ctx, epid)
  86. c.Convey("Then err should be nil.ep should not be nil.", func(c convey.C) {
  87. c.So(err, convey.ShouldBeNil)
  88. c.So(ep, convey.ShouldNotBeNil)
  89. })
  90. })
  91. }
  92. func TestCmsLoadEpsCMS(t *testing.T) {
  93. var (
  94. ctx = context.Background()
  95. epids = []int64{}
  96. )
  97. convey.Convey("LoadEpsCMS", t, func(c convey.C) {
  98. resMetas, err := d.LoadEpsCMS(ctx, epids)
  99. c.Convey("Then err should be nil.resMetas should not be nil.", func(c convey.C) {
  100. c.So(err, convey.ShouldBeNil)
  101. c.So(resMetas, convey.ShouldNotBeNil)
  102. })
  103. })
  104. }