memcache_test.go 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. package weeklyhonor
  2. import (
  3. "context"
  4. model "go-common/app/interface/main/creative/model/weeklyhonor"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestWeeklyhonorstatKey(t *testing.T) {
  9. convey.Convey("statKey", t, func(ctx convey.C) {
  10. var (
  11. mid = int64(0)
  12. date = ""
  13. )
  14. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  15. p1 := statKey(mid, date)
  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 TestWeeklyhonorhonorKey(t *testing.T) {
  23. convey.Convey("honorKey", t, func(ctx convey.C) {
  24. var (
  25. mid = int64(0)
  26. date = ""
  27. )
  28. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  29. p1 := honorKey(mid, date)
  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 TestWeeklyhonorhonorClickKey(t *testing.T) {
  37. convey.Convey("honorClickKey", t, func(ctx convey.C) {
  38. var (
  39. mid = int64(0)
  40. )
  41. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  42. p1 := honorClickKey(mid)
  43. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  44. ctx.So(p1, convey.ShouldNotBeNil)
  45. })
  46. })
  47. })
  48. }
  49. func TestWeeklyhonorStatMC(t *testing.T) {
  50. convey.Convey("StatMC", t, func(ctx convey.C) {
  51. var (
  52. c = context.Background()
  53. mid = int64(0)
  54. date = ""
  55. )
  56. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  57. hs, err := d.StatMC(c, mid, date)
  58. ctx.Convey("Then err should be nil.hs should not be nil.", func(ctx convey.C) {
  59. ctx.So(err, convey.ShouldBeNil)
  60. ctx.So(hs, convey.ShouldNotBeNil)
  61. })
  62. })
  63. })
  64. }
  65. func TestWeeklyhonorHonorMC(t *testing.T) {
  66. convey.Convey("HonorMC", t, func(ctx convey.C) {
  67. var (
  68. c = context.Background()
  69. mid = int64(0)
  70. date = ""
  71. )
  72. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  73. res, err := d.HonorMC(c, mid, date)
  74. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  75. ctx.So(err, convey.ShouldBeNil)
  76. ctx.So(res, convey.ShouldNotBeNil)
  77. })
  78. })
  79. })
  80. }
  81. func TestWeeklyhonorSetStatMC(t *testing.T) {
  82. convey.Convey("SetStatMC", t, func(ctx convey.C) {
  83. var (
  84. c = context.Background()
  85. mid = int64(0)
  86. date = ""
  87. hs = &model.HonorStat{}
  88. )
  89. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  90. err := d.SetStatMC(c, mid, date, hs)
  91. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  92. ctx.So(err, convey.ShouldBeNil)
  93. })
  94. })
  95. })
  96. }
  97. func TestWeeklyhonorSetHonorMC(t *testing.T) {
  98. convey.Convey("SetHonorMC", t, func(ctx convey.C) {
  99. var (
  100. c = context.Background()
  101. mid = int64(0)
  102. date = ""
  103. hs = &model.HonorLog{}
  104. )
  105. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  106. err := d.SetHonorMC(c, mid, date, hs)
  107. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  108. ctx.So(err, convey.ShouldBeNil)
  109. })
  110. })
  111. })
  112. }
  113. func TestWeeklyhonorSetClickMC(t *testing.T) {
  114. convey.Convey("SetClickMC", t, func(ctx convey.C) {
  115. var (
  116. c = context.Background()
  117. mid = int64(0)
  118. )
  119. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  120. err := d.SetClickMC(c, mid)
  121. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  122. ctx.So(err, convey.ShouldBeNil)
  123. })
  124. })
  125. })
  126. }
  127. func TestWeeklyhonorClickMC(t *testing.T) {
  128. convey.Convey("ClickMC", t, func(ctx convey.C) {
  129. var (
  130. c = context.Background()
  131. mid = int64(0)
  132. )
  133. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  134. err := d.ClickMC(c, mid)
  135. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  136. ctx.So(err, convey.ShouldBeNil)
  137. })
  138. })
  139. })
  140. }