task_qa_video_test.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package service
  2. import (
  3. "context"
  4. "encoding/json"
  5. "go-common/app/admin/main/videoup/model/archive"
  6. "testing"
  7. )
  8. func getQAVideo(s *Service) (qav *archive.QAVideo, err error) {
  9. vp := &archive.VideoParam{
  10. ID: 10005358,
  11. Aid: 10098493,
  12. Cid: 10109201,
  13. Status: 0,
  14. Encoding: 1,
  15. UID: 521,
  16. Oname: "chenxi01",
  17. Title: "测试添加qavideo",
  18. Filename: "j180311at3c5g5me6nt4h3zkbiltif35",
  19. RegionID: 23,
  20. Attrs: &archive.AttrParam{
  21. NoRank: 1,
  22. NoDynamic: 1,
  23. NoRecommend: 1,
  24. NoSearch: 1,
  25. OverseaLock: 1,
  26. PushBlog: 1,
  27. },
  28. }
  29. qav, err = s.fetchQAVideo(context.TODO(), vp)
  30. return
  31. }
  32. func Test_qavideoaddsingle(t *testing.T) {
  33. WithService(func(s *Service) {
  34. qav, err := getQAVideo(s)
  35. t.Logf("qavideo(%+v) err(%v)\r\n", qav, err)
  36. ctx := context.TODO()
  37. err = s.addQAVideo(ctx, qav)
  38. t.Logf("error(%v)", err)
  39. })()
  40. }
  41. func Test_qavideoadd(t *testing.T) {
  42. WithService(func(s *Service) {
  43. qav, err := getQAVideo(s)
  44. t.Logf("qavideo(%+v) error(%v)", qav, err)
  45. ctx := context.TODO()
  46. task, _ := json.Marshal(qav)
  47. err = s.arc.SendQAVideoAdd(ctx, task)
  48. if err != nil {
  49. t.Logf("s.arc.SendQAVideoAdd error(%v)", err)
  50. } else {
  51. t.Logf("s.arc.SendQAVideoAdd success")
  52. }
  53. })()
  54. }