mysql_test.go 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 TestDaoRawStreamFullInfo(t *testing.T) {
  9. convey.Convey("RawStreamFullInfo", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. id = int64(11891462)
  13. sname = ""
  14. )
  15. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  16. res, err := d.RawStreamFullInfo(c, id, sname)
  17. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  18. ctx.So(err, convey.ShouldBeNil)
  19. ctx.So(res, convey.ShouldNotBeNil)
  20. })
  21. })
  22. })
  23. }
  24. func TestDaoRawStreamRIDByName(t *testing.T) {
  25. convey.Convey("RawStreamRIDByName", t, func(ctx convey.C) {
  26. var (
  27. c = context.Background()
  28. sname = "live_19148701_6447624"
  29. )
  30. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  31. res, err := d.RawStreamRIDByName(c, sname)
  32. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  33. ctx.So(err, convey.ShouldBeNil)
  34. ctx.So(res, convey.ShouldNotBeNil)
  35. })
  36. })
  37. })
  38. }
  39. func TestDaoRawMultiStreamInfo(t *testing.T) {
  40. convey.Convey("RawMultiStreamInfo", t, func(ctx convey.C) {
  41. var (
  42. c = context.Background()
  43. rids = []int64{11891462}
  44. )
  45. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  46. res, err := d.RawMultiStreamInfo(c, rids)
  47. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  48. ctx.So(err, convey.ShouldBeNil)
  49. ctx.So(res, convey.ShouldNotBeNil)
  50. })
  51. })
  52. })
  53. }
  54. func TestDaodiffStreamInfo(t *testing.T) {
  55. convey.Convey("diffStreamInfo", t, func(ctx convey.C) {
  56. var (
  57. c = context.Background()
  58. info = &model.StreamFullInfo{}
  59. main = &model.MainStream{}
  60. )
  61. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  62. d.diffStreamInfo(c, info, main)
  63. ctx.Convey("No return values", func(ctx convey.C) {
  64. })
  65. })
  66. })
  67. }