stream-change-log_test.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 TestDaoInsertChangeLog(t *testing.T) {
  9. convey.Convey("InsertChangeLog", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. change = &model.StreamChangeLog{
  13. RoomID: 11891462,
  14. FromOrigin: 1,
  15. ToOrigin: 2,
  16. Source: "app",
  17. OperateName: "yy",
  18. Reason: "auto",
  19. }
  20. )
  21. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  22. err := d.InsertChangeLog(c, change)
  23. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  24. ctx.So(err, convey.ShouldBeNil)
  25. })
  26. })
  27. })
  28. }
  29. func TestDaoGetChangeLogByRoomID(t *testing.T) {
  30. convey.Convey("GetChangeLogByRoomID", t, func(ctx convey.C) {
  31. var (
  32. c = context.Background()
  33. rid = int64(11891462)
  34. limit = int64(1)
  35. )
  36. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  37. infos, err := d.GetChangeLogByRoomID(c, rid, limit)
  38. ctx.Convey("Then err should be nil.infos should not be nil.", func(ctx convey.C) {
  39. ctx.So(err, convey.ShouldBeNil)
  40. ctx.So(infos, convey.ShouldNotBeNil)
  41. })
  42. })
  43. })
  44. }