view_redis_test.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/interface/main/web/model"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaokeyArchive(t *testing.T) {
  9. convey.Convey("keyArchive", t, func(ctx convey.C) {
  10. var (
  11. aid = int64(0)
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. p1 := keyArchive(aid)
  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 TestDaoSetViewBakCache(t *testing.T) {
  22. convey.Convey("SetViewBakCache", t, func(ctx convey.C) {
  23. var (
  24. c = context.Background()
  25. aid = int64(0)
  26. a = &model.View{}
  27. )
  28. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  29. err := d.SetViewBakCache(c, aid, a)
  30. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. })
  33. })
  34. })
  35. }
  36. func TestDaoViewBakCache(t *testing.T) {
  37. convey.Convey("ViewBakCache", t, func(ctx convey.C) {
  38. var (
  39. c = context.Background()
  40. aid = int64(0)
  41. )
  42. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  43. rs, err := d.ViewBakCache(c, aid)
  44. ctx.Convey("Then err should be nil.rs should not be nil.", func(ctx convey.C) {
  45. ctx.So(err, convey.ShouldBeNil)
  46. ctx.So(rs, convey.ShouldNotBeNil)
  47. })
  48. })
  49. })
  50. }