memcache_test.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/admin/main/laser/model"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaokeyTaskInfo(t *testing.T) {
  9. convey.Convey("keyTaskInfo", t, func(ctx convey.C) {
  10. var (
  11. mid = int64(0)
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. p1 := keyTaskInfo(mid)
  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 TestDaoTaskInfoCache(t *testing.T) {
  22. convey.Convey("TaskInfoCache", t, func(ctx convey.C) {
  23. var (
  24. c = context.Background()
  25. mid = int64(0)
  26. )
  27. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  28. d.TaskInfoCache(c, mid)
  29. ctx.Convey("Then err should be nil.ti should not be nil.", func(ctx convey.C) {
  30. })
  31. })
  32. })
  33. }
  34. func TestDaoAddTaskInfoCache(t *testing.T) {
  35. convey.Convey("AddTaskInfoCache", t, func(ctx convey.C) {
  36. var (
  37. c = context.Background()
  38. mid = int64(0)
  39. ti = &model.TaskInfo{}
  40. )
  41. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  42. d.AddTaskInfoCache(c, mid, ti)
  43. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  44. })
  45. })
  46. })
  47. }
  48. func TestDaoRemoveTaskInfoCache(t *testing.T) {
  49. convey.Convey("RemoveTaskInfoCache", t, func(ctx convey.C) {
  50. var (
  51. c = context.Background()
  52. mid = int64(0)
  53. )
  54. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  55. d.RemoveTaskInfoCache(c, mid)
  56. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  57. })
  58. })
  59. })
  60. }