upstream-summary_test.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/service/video/stream-mng/model"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoCreateUpStreamDispatch(t *testing.T) {
  9. convey.Convey("CreateUpStreamDispatch", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. info = &model.UpStreamInfo{
  13. RoomID: 11891462,
  14. CDN: 1,
  15. PlatForm: "ios",
  16. Country: "中国",
  17. City: "上海",
  18. ISP: "电信",
  19. IP: "12.12.12.12",
  20. }
  21. )
  22. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  23. err := d.CreateUpStreamDispatch(c, info)
  24. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  25. ctx.So(err, convey.ShouldBeNil)
  26. })
  27. })
  28. })
  29. }
  30. func TestDaoGetSummaryUpStreamRtmp(t *testing.T) {
  31. convey.Convey("GetSummaryUpStreamRtmp", t, func(ctx convey.C) {
  32. var (
  33. c = context.Background()
  34. start = int64(1546593007)
  35. end = int64(1546830611)
  36. )
  37. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  38. infos, err := d.GetSummaryUpStreamRtmp(c, start, end)
  39. ctx.Convey("Then err should be nil.infos should not be nil.", func(ctx convey.C) {
  40. ctx.So(err, convey.ShouldBeNil)
  41. ctx.So(infos, convey.ShouldNotBeNil)
  42. })
  43. })
  44. })
  45. }
  46. func TestDaoGetSummaryUpStreamISP(t *testing.T) {
  47. convey.Convey("GetSummaryUpStreamISP", t, func(ctx convey.C) {
  48. var (
  49. c = context.Background()
  50. start = int64(1546593007)
  51. end = int64(1546830611)
  52. )
  53. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  54. infos, err := d.GetSummaryUpStreamISP(c, start, end)
  55. ctx.Convey("Then err should be nil.infos should not be nil.", func(ctx convey.C) {
  56. ctx.So(err, convey.ShouldBeNil)
  57. ctx.So(infos, convey.ShouldNotBeNil)
  58. })
  59. })
  60. })
  61. }
  62. func TestDaoGetSummaryUpStreamCountry(t *testing.T) {
  63. convey.Convey("GetSummaryUpStreamCountry", t, func(ctx convey.C) {
  64. var (
  65. c = context.Background()
  66. start = int64(1546593007)
  67. end = int64(1546830611)
  68. )
  69. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  70. infos, err := d.GetSummaryUpStreamCountry(c, start, end)
  71. ctx.Convey("Then err should be nil.infos should not be nil.", func(ctx convey.C) {
  72. ctx.So(err, convey.ShouldBeNil)
  73. ctx.So(infos, convey.ShouldNotBeNil)
  74. })
  75. })
  76. })
  77. }
  78. func TestDaoGetSummaryUpStreamPlatform(t *testing.T) {
  79. convey.Convey("GetSummaryUpStreamPlatform", t, func(ctx convey.C) {
  80. var (
  81. c = context.Background()
  82. start = int64(1546593007)
  83. end = int64(1546830611)
  84. )
  85. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  86. infos, err := d.GetSummaryUpStreamPlatform(c, start, end)
  87. ctx.Convey("Then err should be nil.infos should not be nil.", func(ctx convey.C) {
  88. ctx.So(err, convey.ShouldBeNil)
  89. ctx.So(infos, convey.ShouldNotBeNil)
  90. })
  91. })
  92. })
  93. }
  94. func TestDaoGetSummaryUpStreamCity(t *testing.T) {
  95. convey.Convey("GetSummaryUpStreamCity", t, func(ctx convey.C) {
  96. var (
  97. c = context.Background()
  98. start = int64(1546593007)
  99. end = int64(1546830611)
  100. )
  101. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  102. infos, err := d.GetSummaryUpStreamCity(c, start, end)
  103. ctx.Convey("Then err should be nil.infos should not be nil.", func(ctx convey.C) {
  104. ctx.So(err, convey.ShouldBeNil)
  105. ctx.So(infos, convey.ShouldNotBeNil)
  106. })
  107. })
  108. })
  109. }