memcache_test.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaopingMC(t *testing.T) {
  8. convey.Convey("pingMC", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. )
  12. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  13. err := d.pingMC(c)
  14. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. })
  17. })
  18. })
  19. }
  20. func TestDaoAppkeyCache(t *testing.T) {
  21. convey.Convey("AppkeyCache", t, func(ctx convey.C) {
  22. var (
  23. c = context.Background()
  24. )
  25. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  26. _, err := d.AppkeyCache(c)
  27. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  28. ctx.So(err, convey.ShouldBeNil)
  29. })
  30. })
  31. })
  32. }
  33. func TestDaoSetAppkeyCache(t *testing.T) {
  34. convey.Convey("SetAppkeyCache", t, func(ctx convey.C) {
  35. var (
  36. c = context.Background()
  37. newData map[string]string
  38. )
  39. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  40. err := d.SetAppkeyCache(c, newData)
  41. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  42. ctx.So(err, convey.ShouldBeNil)
  43. })
  44. })
  45. })
  46. }