playurl_test.go 852 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package dao
  2. import (
  3. "context"
  4. "encoding/json"
  5. "testing"
  6. "gopkg.in/h2non/gock.v1"
  7. "go-common/app/interface/main/player/model"
  8. "github.com/smartystreets/goconvey/convey"
  9. )
  10. func TestDao_Playurl(t *testing.T) {
  11. convey.Convey("test playurl", t, func(ctx convey.C) {
  12. // aid 10108138
  13. mid := int64(908085)
  14. //cid=47083420&qn=80&type=&otype=json&fnver=0&fnval=8
  15. arg := &model.PlayurlArg{
  16. Aid: 10111420,
  17. Cid: 10151472,
  18. Qn: 0,
  19. OType: "xml",
  20. //Player: 1,
  21. Fnver: 0,
  22. Fnval: 8,
  23. }
  24. token := ""
  25. playurl := "http://uat-videodispatch-ugc.bilibili.co/v3/playurl"
  26. defer gock.OffAll()
  27. httpMock("GET", playurl).Reply(200).JSON(`{"code":0}`)
  28. data, err := d.Playurl(context.Background(), mid, arg, playurl, token)
  29. convey.So(err, convey.ShouldBeNil)
  30. str, _ := json.Marshal(data)
  31. convey.Println(string(str))
  32. })
  33. }