recent_redis_test.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoAddRctFollower(t *testing.T) {
  8. var (
  9. c = context.Background()
  10. mid = int64(0)
  11. fid = int64(0)
  12. )
  13. convey.Convey("AddRctFollower", t, func(cv convey.C) {
  14. err := d.AddRctFollower(c, mid, fid)
  15. cv.Convey("Then err should be nil.", func(cv convey.C) {
  16. cv.So(err, convey.ShouldBeNil)
  17. })
  18. })
  19. }
  20. func TestDaoDelRctFollower(t *testing.T) {
  21. var (
  22. c = context.Background()
  23. mid = int64(0)
  24. fid = int64(0)
  25. )
  26. convey.Convey("DelRctFollower", t, func(cv convey.C) {
  27. err := d.DelRctFollower(c, mid, fid)
  28. cv.Convey("Then err should be nil.", func(cv convey.C) {
  29. cv.So(err, convey.ShouldBeNil)
  30. })
  31. })
  32. }
  33. func TestDaoRctFollowerCount(t *testing.T) {
  34. var (
  35. ctx = context.Background()
  36. fid = int64(0)
  37. )
  38. convey.Convey("RctFollowerCount", t, func(cv convey.C) {
  39. p1, err := d.RctFollowerCount(ctx, fid)
  40. cv.Convey("Then err should be nil.p1 should not be nil.", func(cv convey.C) {
  41. cv.So(err, convey.ShouldBeNil)
  42. cv.So(p1, convey.ShouldNotBeNil)
  43. })
  44. })
  45. }
  46. func TestDaoEmptyRctFollower(t *testing.T) {
  47. var (
  48. ctx = context.Background()
  49. fid = int64(0)
  50. )
  51. convey.Convey("EmptyRctFollower", t, func(cv convey.C) {
  52. err := d.EmptyRctFollower(ctx, fid)
  53. cv.Convey("Then err should be nil.", func(cv convey.C) {
  54. cv.So(err, convey.ShouldBeNil)
  55. })
  56. })
  57. }
  58. func TestDaoRctFollowerNotify(t *testing.T) {
  59. var (
  60. c = context.Background()
  61. fid = int64(0)
  62. )
  63. convey.Convey("RctFollowerNotify", t, func(cv convey.C) {
  64. p1, err := d.RctFollowerNotify(c, fid)
  65. cv.Convey("Then err should be nil.p1 should not be nil.", func(cv convey.C) {
  66. cv.So(err, convey.ShouldBeNil)
  67. cv.So(p1, convey.ShouldNotBeNil)
  68. })
  69. })
  70. }
  71. func TestDaoSetRctFollowerNotify(t *testing.T) {
  72. var (
  73. c = context.Background()
  74. fid = int64(0)
  75. flag bool
  76. )
  77. convey.Convey("SetRctFollowerNotify", t, func(cv convey.C) {
  78. err := d.SetRctFollowerNotify(c, fid, flag)
  79. cv.Convey("Then err should be nil.", func(cv convey.C) {
  80. cv.So(err, convey.ShouldBeNil)
  81. })
  82. })
  83. }