mc_test.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoorderKey(t *testing.T) {
  8. convey.Convey("orderKey", t, func(ctx convey.C) {
  9. var (
  10. id = ""
  11. )
  12. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  13. p1 := orderKey(id)
  14. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  15. ctx.So(p1, convey.ShouldNotBeNil)
  16. })
  17. })
  18. })
  19. }
  20. func TestDaoassetKey(t *testing.T) {
  21. convey.Convey("assetKey", t, func(ctx convey.C) {
  22. var (
  23. oid = int64(0)
  24. otype = ""
  25. currency = ""
  26. )
  27. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  28. p1 := assetKey(oid, otype, currency)
  29. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  30. ctx.So(p1, convey.ShouldNotBeNil)
  31. })
  32. })
  33. })
  34. }
  35. func TestDaotaskKey(t *testing.T) {
  36. convey.Convey("taskKey", t, func(ctx convey.C) {
  37. var (
  38. task = ""
  39. )
  40. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  41. p1 := taskKey(task)
  42. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  43. ctx.So(p1, convey.ShouldNotBeNil)
  44. })
  45. })
  46. })
  47. }
  48. func TestDaoDelCacheOrderUser(t *testing.T) {
  49. convey.Convey("DelCacheOrderUser", t, func(ctx convey.C) {
  50. var (
  51. c = context.Background()
  52. id = ""
  53. )
  54. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  55. err := d.DelCacheOrderUser(c, id)
  56. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  57. ctx.So(err, convey.ShouldBeNil)
  58. })
  59. })
  60. })
  61. }
  62. func TestDaoDelCacheAsset(t *testing.T) {
  63. convey.Convey("DelCacheAsset", t, func(ctx convey.C) {
  64. var (
  65. c = context.Background()
  66. oid = int64(0)
  67. otype = ""
  68. currency = ""
  69. )
  70. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  71. err := d.DelCacheAsset(c, oid, otype, currency)
  72. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  73. ctx.So(err, convey.ShouldBeNil)
  74. })
  75. })
  76. })
  77. }
  78. func TestDaoAddCacheTask(t *testing.T) {
  79. convey.Convey("AddCacheTask", t, func(ctx convey.C) {
  80. var (
  81. c = context.Background()
  82. task = ""
  83. ttl = int32(60)
  84. )
  85. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  86. ok, err := d.AddCacheTask(c, task, ttl)
  87. ctx.Convey("Then err should be nil.ok should not be nil.", func(ctx convey.C) {
  88. ctx.So(err, convey.ShouldBeNil)
  89. ctx.So(ok, convey.ShouldNotBeNil)
  90. })
  91. })
  92. })
  93. }
  94. func TestDaoDelCacheTask(t *testing.T) {
  95. convey.Convey("DelCacheTask", t, func(ctx convey.C) {
  96. var (
  97. c = context.Background()
  98. task = ""
  99. )
  100. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  101. err := d.DelCacheTask(c, task)
  102. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  103. ctx.So(err, convey.ShouldBeNil)
  104. })
  105. })
  106. })
  107. }
  108. func TestDaoDelCacheUserSetting(t *testing.T) {
  109. convey.Convey("DelCacheUserSetting", t, func(ctx convey.C) {
  110. var (
  111. c = context.Background()
  112. mid = int64(46333)
  113. )
  114. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  115. err := d.DelCacheUserSetting(c, mid)
  116. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  117. ctx.So(err, convey.ShouldBeNil)
  118. })
  119. })
  120. })
  121. }