mc.cache_test.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. package mcndao
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. "go-common/app/interface/main/mcn/model/mcnmodel"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestMcndaoAddCacheMcnSign(t *testing.T) {
  10. convey.Convey("AddCacheMcnSign", t, func(ctx convey.C) {
  11. var (
  12. c = context.Background()
  13. id = int64(0)
  14. val = &mcnmodel.McnSign{}
  15. )
  16. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  17. err := d.AddCacheMcnSign(c, id, val)
  18. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  19. ctx.So(err, convey.ShouldBeNil)
  20. })
  21. })
  22. })
  23. }
  24. func TestMcndaoCacheMcnSign(t *testing.T) {
  25. convey.Convey("CacheMcnSign", t, func(ctx convey.C) {
  26. var (
  27. c = context.Background()
  28. id = int64(0)
  29. )
  30. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  31. res, err := d.CacheMcnSign(c, id)
  32. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  33. ctx.So(err, convey.ShouldBeNil)
  34. ctx.So(res, convey.ShouldNotBeNil)
  35. })
  36. })
  37. })
  38. }
  39. func TestMcndaoDelCacheMcnSign(t *testing.T) {
  40. convey.Convey("DelCacheMcnSign", t, func(ctx convey.C) {
  41. var (
  42. c = context.Background()
  43. id = int64(0)
  44. )
  45. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  46. err := d.DelCacheMcnSign(c, id)
  47. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  48. ctx.So(err, convey.ShouldBeNil)
  49. })
  50. })
  51. })
  52. }
  53. func TestMcndaoAddCacheMcnDataSummary(t *testing.T) {
  54. convey.Convey("AddCacheMcnDataSummary", t, func(ctx convey.C) {
  55. var (
  56. c = context.Background()
  57. id = int64(0)
  58. val = &mcnmodel.McnGetDataSummaryReply{}
  59. generateDate = time.Now()
  60. )
  61. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  62. err := d.AddCacheMcnDataSummary(c, id, val, generateDate)
  63. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  64. ctx.So(err, convey.ShouldBeNil)
  65. })
  66. })
  67. })
  68. }
  69. func TestMcndaoCacheMcnDataSummary(t *testing.T) {
  70. convey.Convey("CacheMcnDataSummary", t, func(ctx convey.C) {
  71. var (
  72. c = context.Background()
  73. id = int64(0)
  74. generateDate = time.Now()
  75. )
  76. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  77. res, err := d.CacheMcnDataSummary(c, id, generateDate)
  78. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  79. ctx.So(err, convey.ShouldBeNil)
  80. ctx.So(res, convey.ShouldNotBeNil)
  81. })
  82. })
  83. })
  84. }
  85. func TestMcndaoDelMcnDataSummary(t *testing.T) {
  86. convey.Convey("DelMcnDataSummary", t, func(ctx convey.C) {
  87. var (
  88. c = context.Background()
  89. id = int64(0)
  90. generateDate = time.Now()
  91. )
  92. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  93. err := d.DelMcnDataSummary(c, id, generateDate)
  94. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  95. ctx.So(err, convey.ShouldBeNil)
  96. })
  97. })
  98. })
  99. }