memcache_test.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/workflow/model/search"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaopingMC(t *testing.T) {
  9. convey.Convey("pingMC", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. err := d.pingMC(c)
  15. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. })
  18. })
  19. })
  20. }
  21. func TestDaoChallCountCache(t *testing.T) {
  22. convey.Convey("ChallCountCache", t, func(ctx convey.C) {
  23. var (
  24. c = context.Background()
  25. uid = int64(0)
  26. )
  27. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  28. _, err := d.ChallCountCache(c, uid)
  29. ctx.Convey("Then err should be nil.challCount should not be nil.", func(ctx convey.C) {
  30. ctx.So(err, convey.ShouldBeNil)
  31. })
  32. })
  33. })
  34. }
  35. func TestDaoUpChallCountCache(t *testing.T) {
  36. convey.Convey("UpChallCountCache", t, func(ctx convey.C) {
  37. var (
  38. c = context.Background()
  39. challCount = &search.ChallCount{}
  40. uid = int64(0)
  41. )
  42. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  43. err := d.UpChallCountCache(c, challCount, uid)
  44. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  45. ctx.So(err, convey.ShouldBeNil)
  46. })
  47. })
  48. })
  49. }