memcahe_test.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package mcndao
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestMcndaomcnSignCacheKey(t *testing.T) {
  9. convey.Convey("mcnSignCacheKey", t, func(ctx convey.C) {
  10. var (
  11. mcnmid = int64(0)
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. p1 := mcnSignCacheKey(mcnmid)
  15. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  16. ctx.So(p1, convey.ShouldNotBeNil)
  17. })
  18. })
  19. })
  20. }
  21. func TestMcndaoRawMcnSign(t *testing.T) {
  22. convey.Convey("RawMcnSign", t, func(ctx convey.C) {
  23. var (
  24. c = context.Background()
  25. mcnmid = int64(0)
  26. )
  27. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  28. up, err := d.RawMcnSign(c, mcnmid)
  29. ctx.Convey("Then err should be nil.up should not be nil.", func(ctx convey.C) {
  30. ctx.So(err, convey.ShouldBeNil)
  31. ctx.So(up, convey.ShouldBeNil)
  32. })
  33. })
  34. })
  35. }
  36. func TestMcndaoAsyncDelCacheMcnSign(t *testing.T) {
  37. convey.Convey("AsyncDelCacheMcnSign", t, func(ctx convey.C) {
  38. var (
  39. id = int64(0)
  40. )
  41. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  42. err := d.AsyncDelCacheMcnSign(id)
  43. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  44. ctx.So(err, convey.ShouldBeNil)
  45. })
  46. })
  47. })
  48. }
  49. func TestMcndaomcnDataCacheKey(t *testing.T) {
  50. convey.Convey("mcnDataCacheKey", t, func(ctx convey.C) {
  51. var (
  52. signID = int64(0)
  53. generateDate = time.Now()
  54. )
  55. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  56. p1 := mcnDataCacheKey(signID, generateDate)
  57. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  58. ctx.So(p1, convey.ShouldNotBeNil)
  59. })
  60. })
  61. })
  62. }
  63. func TestMcndaoRawMcnDataSummary(t *testing.T) {
  64. convey.Convey("RawMcnDataSummary", t, func(ctx convey.C) {
  65. var (
  66. c = context.Background()
  67. id = int64(0)
  68. generateDate = time.Now()
  69. )
  70. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  71. res, err := d.RawMcnDataSummary(c, id, generateDate)
  72. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  73. ctx.So(err, convey.ShouldBeNil)
  74. ctx.So(res, convey.ShouldBeNil)
  75. })
  76. })
  77. })
  78. }