123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- package dao
- import (
- "context"
- "go-common/app/service/video/stream-mng/model"
- "testing"
- "github.com/smartystreets/goconvey/convey"
- )
- func TestDaoCreateUpStreamDispatch(t *testing.T) {
- convey.Convey("CreateUpStreamDispatch", t, func(ctx convey.C) {
- var (
- c = context.Background()
- info = &model.UpStreamInfo{
- RoomID: 11891462,
- CDN: 1,
- PlatForm: "ios",
- Country: "中国",
- City: "上海",
- ISP: "电信",
- IP: "12.12.12.12",
- }
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- err := d.CreateUpStreamDispatch(c, info)
- ctx.Convey("Then err should be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- })
- })
- })
- }
- func TestDaoGetSummaryUpStreamRtmp(t *testing.T) {
- convey.Convey("GetSummaryUpStreamRtmp", t, func(ctx convey.C) {
- var (
- c = context.Background()
- start = int64(1546593007)
- end = int64(1546830611)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- infos, err := d.GetSummaryUpStreamRtmp(c, start, end)
- ctx.Convey("Then err should be nil.infos should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(infos, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoGetSummaryUpStreamISP(t *testing.T) {
- convey.Convey("GetSummaryUpStreamISP", t, func(ctx convey.C) {
- var (
- c = context.Background()
- start = int64(1546593007)
- end = int64(1546830611)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- infos, err := d.GetSummaryUpStreamISP(c, start, end)
- ctx.Convey("Then err should be nil.infos should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(infos, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoGetSummaryUpStreamCountry(t *testing.T) {
- convey.Convey("GetSummaryUpStreamCountry", t, func(ctx convey.C) {
- var (
- c = context.Background()
- start = int64(1546593007)
- end = int64(1546830611)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- infos, err := d.GetSummaryUpStreamCountry(c, start, end)
- ctx.Convey("Then err should be nil.infos should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(infos, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoGetSummaryUpStreamPlatform(t *testing.T) {
- convey.Convey("GetSummaryUpStreamPlatform", t, func(ctx convey.C) {
- var (
- c = context.Background()
- start = int64(1546593007)
- end = int64(1546830611)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- infos, err := d.GetSummaryUpStreamPlatform(c, start, end)
- ctx.Convey("Then err should be nil.infos should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(infos, convey.ShouldNotBeNil)
- })
- })
- })
- }
- func TestDaoGetSummaryUpStreamCity(t *testing.T) {
- convey.Convey("GetSummaryUpStreamCity", t, func(ctx convey.C) {
- var (
- c = context.Background()
- start = int64(1546593007)
- end = int64(1546830611)
- )
- ctx.Convey("When everything gose positive", func(ctx convey.C) {
- infos, err := d.GetSummaryUpStreamCity(c, start, end)
- ctx.Convey("Then err should be nil.infos should not be nil.", func(ctx convey.C) {
- ctx.So(err, convey.ShouldBeNil)
- ctx.So(infos, convey.ShouldNotBeNil)
- })
- })
- })
- }
|