mc.cache_test.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package roomAdmin
  2. import (
  3. "context"
  4. "go-common/app/service/live/xuser/model"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestRoomAdminCacheRoomAdminRoom(t *testing.T) {
  9. convey.Convey("CacheRoomAdminRoom", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. id = int64(0)
  13. )
  14. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  15. res, err := d.CacheRoomAdminRoom(c, id)
  16. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldBeNil)
  18. ctx.So(res, convey.ShouldNotBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestRoomAdminCacheRoomAdminUser(t *testing.T) {
  24. convey.Convey("CacheRoomAdminUser", t, func(ctx convey.C) {
  25. var (
  26. c = context.Background()
  27. id = int64(0)
  28. )
  29. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  30. res, err := d.CacheRoomAdminUser(c, id)
  31. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  32. ctx.So(err, convey.ShouldBeNil)
  33. ctx.So(res, convey.ShouldNotBeNil)
  34. })
  35. })
  36. })
  37. }
  38. func TestRoomAdminAddCacheKeyAnchorRoom(t *testing.T) {
  39. convey.Convey("AddCacheKeyAnchorRoom", t, func(ctx convey.C) {
  40. var (
  41. c = context.Background()
  42. id = int64(0)
  43. val = []*model.RoomAdmin{}
  44. )
  45. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  46. err := d.AddCacheKeyAnchorRoom(c, id, val)
  47. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  48. ctx.So(err, convey.ShouldBeNil)
  49. })
  50. })
  51. })
  52. }
  53. func TestRoomAdminAddCacheRoomAdminUser(t *testing.T) {
  54. convey.Convey("AddCacheRoomAdminUser", t, func(ctx convey.C) {
  55. var (
  56. c = context.Background()
  57. id = int64(0)
  58. val = []*model.RoomAdmin{}
  59. )
  60. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  61. err := d.AddCacheRoomAdminUser(c, id, val)
  62. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  63. ctx.So(err, convey.ShouldBeNil)
  64. })
  65. })
  66. })
  67. }
  68. func TestRoomAdminDelCacheKeyAnchorRoom(t *testing.T) {
  69. convey.Convey("DelCacheKeyAnchorRoom", t, func(ctx convey.C) {
  70. var (
  71. c = context.Background()
  72. id = int64(0)
  73. )
  74. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  75. err := d.DelCacheKeyAnchorRoom(c, id)
  76. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  77. ctx.So(err, convey.ShouldBeNil)
  78. })
  79. })
  80. })
  81. }
  82. func TestRoomAdminDelCacheRoomAdminUser(t *testing.T) {
  83. convey.Convey("DelCacheRoomAdminUser", t, func(ctx convey.C) {
  84. var (
  85. c = context.Background()
  86. id = int64(0)
  87. )
  88. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  89. err := d.DelCacheRoomAdminUser(c, id)
  90. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  91. ctx.So(err, convey.ShouldBeNil)
  92. })
  93. })
  94. })
  95. }