redis_test.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package archive
  2. import (
  3. "context"
  4. "go-common/app/interface/main/videoup/model/archive"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestArchivekeyUpFavTpsPrefix(t *testing.T) {
  9. convey.Convey("keyUpFavTpsPrefix", t, func(ctx convey.C) {
  10. var (
  11. mid = int64(2089809)
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. p1 := keyUpFavTpsPrefix(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 TestArchiveFilenameExpires(t *testing.T) {
  22. convey.Convey("FilenameExpires", t, func(ctx convey.C) {
  23. var (
  24. c = context.Background()
  25. vs = []*archive.VideoParam{}
  26. )
  27. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  28. ves, err := d.FilenameExpires(c, vs)
  29. ctx.Convey("Then err should be nil.ves should not be nil.", func(ctx convey.C) {
  30. ctx.So(err, convey.ShouldNotBeNil)
  31. ctx.So(ves, convey.ShouldBeNil)
  32. })
  33. })
  34. })
  35. }
  36. func TestArchiveFreshFavTypes(t *testing.T) {
  37. convey.Convey("FreshFavTypes", t, func(ctx convey.C) {
  38. var (
  39. c = context.Background()
  40. mid = int64(2089809)
  41. tp = int(162)
  42. )
  43. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  44. err := d.FreshFavTypes(c, mid, tp)
  45. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  46. ctx.So(err, convey.ShouldNotBeNil)
  47. })
  48. })
  49. })
  50. }
  51. func TestArchivepingRedis(t *testing.T) {
  52. convey.Convey("pingRedis", t, func(ctx convey.C) {
  53. var (
  54. c = context.Background()
  55. )
  56. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  57. err := d.pingRedis(c)
  58. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  59. ctx.So(err, convey.ShouldNotBeNil)
  60. })
  61. })
  62. })
  63. }