fav_test.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/interface/main/space/model"
  6. "github.com/smartystreets/goconvey/convey"
  7. "gopkg.in/h2non/gock.v1"
  8. )
  9. func TestDao_AlbumFavCount(t *testing.T) {
  10. convey.Convey("test album fav count", t, func(ctx convey.C) {
  11. defer gock.OffAll()
  12. httpMock("GET", d.favAlbumURL).Reply(200).JSON(`{"code": 0, "data":{"pageinfo":{"count":1}}}`)
  13. mid := int64(88895029)
  14. favType := 2
  15. data, err := d.LiveFavCount(context.Background(), mid, favType)
  16. convey.So(err, convey.ShouldBeNil)
  17. convey.Printf("%v", data)
  18. })
  19. }
  20. func TestDao_MovieFavCount(t *testing.T) {
  21. convey.Convey("test movie fav count", t, func(ctx convey.C) {
  22. mid := int64(88895029)
  23. favType := 2
  24. data, err := d.MovieFavCount(context.Background(), mid, favType)
  25. convey.So(err, convey.ShouldBeNil)
  26. convey.Printf("%v", data)
  27. })
  28. }
  29. func TestDao_FavFolder(t *testing.T) {
  30. convey.Convey("test fav folder", t, func(ctx convey.C) {
  31. defer gock.OffAll()
  32. httpMock("GET", d.favFolderURL).Reply(200).JSON(`{"code": 0, "data":[]}`)
  33. mid := int64(88895029)
  34. vmid := int64(0)
  35. data, err := d.FavFolder(context.Background(), mid, vmid)
  36. convey.So(err, convey.ShouldBeNil)
  37. convey.Printf("%v", data)
  38. })
  39. }
  40. func TestDao_FavArchive(t *testing.T) {
  41. convey.Convey("test fav archive", t, func(ctx convey.C) {
  42. defer gock.OffAll()
  43. httpMock("GET", d.favArcURL).Reply(200).JSON(`{"code": 0}`)
  44. mid := int64(88895029)
  45. arg := &model.FavArcArg{}
  46. data, err := d.FavArchive(context.Background(), mid, arg)
  47. convey.So(err, convey.ShouldBeNil)
  48. convey.Printf("%v", data)
  49. })
  50. }