mysql_test.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. "go-common/app/interface/main/space/model"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestDao_Channel(t *testing.T) {
  10. convey.Convey("test channel", t, func(ctx convey.C) {
  11. mid := int64(27515260)
  12. cid := int64(38)
  13. res, err := d.Channel(context.Background(), mid, cid)
  14. convey.So(err, convey.ShouldBeNil)
  15. convey.So(res, convey.ShouldHaveSameTypeAs, &model.Channel{})
  16. })
  17. }
  18. func TestDao_ChannelCnt(t *testing.T) {
  19. convey.Convey("test channel cnt", t, func(ctx convey.C) {
  20. mid := int64(27515260)
  21. res, err := d.ChannelCnt(context.Background(), mid)
  22. convey.So(err, convey.ShouldBeNil)
  23. convey.So(res, convey.ShouldNotBeNil)
  24. })
  25. }
  26. func TestDao_ChannelExtra(t *testing.T) {
  27. convey.Convey("test channel extra", t, func(ctx convey.C) {
  28. mid := int64(27515260)
  29. cid := int64(38)
  30. res, err := d.ChannelExtra(context.Background(), mid, cid)
  31. convey.So(err, convey.ShouldBeNil)
  32. convey.So(res, convey.ShouldHaveSameTypeAs, &model.ChannelExtra{})
  33. })
  34. }
  35. func TestDao_EditChannelArc(t *testing.T) {
  36. convey.Convey("test edit channel arc", t, func(ctx convey.C) {
  37. mid := int64(27515260)
  38. cid := int64(37)
  39. sort := []*model.ChannelArcSort{{Aid: 5462035, OrderNum: 4}, {Aid: 5461964, OrderNum: 3}}
  40. res, err := d.EditChannelArc(context.Background(), mid, cid, time.Now(), sort)
  41. convey.So(err, convey.ShouldBeNil)
  42. convey.Printf("%+v", res)
  43. })
  44. }
  45. func TestDao_ChannelList(t *testing.T) {
  46. convey.Convey("test channel list", t, func(ctx convey.C) {
  47. mid := int64(27515260)
  48. res, err := d.ChannelList(context.Background(), mid)
  49. convey.So(err, convey.ShouldBeNil)
  50. convey.Printf("%+v", res)
  51. })
  52. }
  53. func TestDao_ChannelVideos(t *testing.T) {
  54. convey.Convey("test channel video", t, func(ctx convey.C) {
  55. mid := int64(27515260)
  56. cid := int64(37)
  57. res1, err1 := d.ChannelVideos(context.Background(), mid, cid, true)
  58. convey.So(err1, convey.ShouldBeNil)
  59. convey.Printf("%+v", res1)
  60. res2, err2 := d.ChannelVideos(context.Background(), mid, cid, false)
  61. convey.So(err2, convey.ShouldBeNil)
  62. convey.Printf("%+v", res2)
  63. })
  64. }