medal_mc_test.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. package dao
  2. import (
  3. "context"
  4. "fmt"
  5. "testing"
  6. "time"
  7. "go-common/app/admin/main/usersuit/model"
  8. xtime "go-common/library/time"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. // TestMcJury .
  12. func Test_pingMC(t *testing.T) {
  13. Convey("should return err be nil", t, func() {
  14. err := d.pingMC(context.Background())
  15. So(err, ShouldBeNil)
  16. })
  17. }
  18. func Test_SetMedalOwnersache(t *testing.T) {
  19. Convey("should return err be nil", t, func() {
  20. nos := make([]*model.MedalOwner, 0)
  21. no := &model.MedalOwner{}
  22. no.ID = 1
  23. no.MID = 1
  24. no.NID = 2
  25. no.CTime = xtime.Time(time.Now().Second())
  26. no.MTime = xtime.Time(time.Now().Second())
  27. nos = append(nos, no)
  28. err := d.SetMedalOwnersache(context.Background(), 1, nos)
  29. So(err, ShouldBeNil)
  30. })
  31. Convey("should return err be nil", t, func() {
  32. res, err := d.MedalOwnersCache(context.Background(), 1)
  33. So(err, ShouldBeNil)
  34. So(res, ShouldNotBeNil)
  35. })
  36. }
  37. func Test_DelMedalOwnersCache(t *testing.T) {
  38. Convey("should return err be nil", t, func() {
  39. err := d.DelMedalOwnersCache(context.Background(), 1)
  40. So(err, ShouldBeNil)
  41. })
  42. }
  43. func Test_MedalActivatedCache(t *testing.T) {
  44. Convey("should return err be nil", t, func() {
  45. nid, err := d.MedalActivatedCache(context.Background(), 1)
  46. fmt.Printf("%+v\n", nid)
  47. So(nid, ShouldNotBeNil)
  48. So(err, ShouldBeNil)
  49. })
  50. }
  51. func Test_SetMedalActivatedCache(t *testing.T) {
  52. Convey("should return err be nil", t, func() {
  53. err := d.SetMedalActivatedCache(context.Background(), 1, 22)
  54. So(err, ShouldBeNil)
  55. })
  56. }
  57. func Test_DelMedalActivatedCache(t *testing.T) {
  58. Convey("should return err be nil", t, func() {
  59. err := d.DelMedalActivatedCache(context.Background(), 1)
  60. So(err, ShouldBeNil)
  61. })
  62. }
  63. func Test_PopupCache(t *testing.T) {
  64. Convey("should return err be nil", t, func() {
  65. nid, err := d.PopupCache(context.Background(), 1)
  66. fmt.Printf("%+v\n", nid)
  67. So(nid, ShouldNotBeNil)
  68. So(nid, ShouldBeGreaterThanOrEqualTo, 0)
  69. So(err, ShouldBeNil)
  70. })
  71. }
  72. func Test_SetPopupCache(t *testing.T) {
  73. Convey("should return err be nil", t, func() {
  74. err := d.SetPopupCache(context.Background(), 1, 3)
  75. So(err, ShouldBeNil)
  76. })
  77. }
  78. func Test_DelPopupCache(t *testing.T) {
  79. Convey("should return err be nil", t, func() {
  80. err := d.DelPopupCache(context.Background(), 1)
  81. So(err, ShouldBeNil)
  82. })
  83. }
  84. func Test_RedPointCache(t *testing.T) {
  85. Convey("should return err be nil", t, func() {
  86. nid, err := d.RedPointCache(context.Background(), 1)
  87. fmt.Printf("%+v\n", nid)
  88. So(nid, ShouldNotBeNil)
  89. So(nid, ShouldBeGreaterThanOrEqualTo, 0)
  90. So(err, ShouldBeNil)
  91. })
  92. }
  93. func Test_SetRedPointCache(t *testing.T) {
  94. Convey("should return err be nil", t, func() {
  95. err := d.SetRedPointCache(context.Background(), 1, 3)
  96. So(err, ShouldBeNil)
  97. })
  98. }
  99. func Test_DelRedPointCache(t *testing.T) {
  100. Convey("should return err be nil", t, func() {
  101. err := d.DelRedPointCache(context.Background(), 1)
  102. So(err, ShouldBeNil)
  103. })
  104. }