dao.cache_test.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaostreamFullInfo(t *testing.T) {
  8. convey.Convey("streamFullInfo", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. id = int64(11891462)
  12. sname = ""
  13. )
  14. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  15. res, err := d.streamFullInfo(c, id, sname)
  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 TestDaostreamRIDByName(t *testing.T) {
  24. convey.Convey("streamRIDByName", t, func(ctx convey.C) {
  25. var (
  26. c = context.Background()
  27. id = "live_19148701_6447624"
  28. )
  29. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  30. res, err := d.streamRIDByName(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 TestDaomultiStreamInfo(t *testing.T) {
  39. convey.Convey("multiStreamInfo", t, func(ctx convey.C) {
  40. var (
  41. c = context.Background()
  42. keys = []int64{11891462}
  43. )
  44. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  45. res, err := d.multiStreamInfo(c, keys)
  46. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  47. ctx.So(err, convey.ShouldBeNil)
  48. ctx.So(res, convey.ShouldNotBeNil)
  49. })
  50. })
  51. })
  52. }