ugcpay_test.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package ugcpay
  2. import (
  3. "context"
  4. "flag"
  5. "os"
  6. "testing"
  7. "time"
  8. "go-common/app/interface/main/app-view/conf"
  9. "go-common/app/interface/main/app-view/model/view"
  10. . "github.com/smartystreets/goconvey/convey"
  11. )
  12. var (
  13. dao *Dao
  14. )
  15. func init() {
  16. if os.Getenv("DEPLOY_ENV") != "" {
  17. flag.Set("app_id", "main.app-svr.app-view")
  18. flag.Set("conf_token", "3a4CNLBhdFbRQPs7B4QftGvXHtJo92xw")
  19. flag.Set("tree_id", "4575")
  20. flag.Set("conf_version", "docker-1")
  21. flag.Set("deploy_env", "uat")
  22. flag.Set("conf_host", "config.bilibili.co")
  23. flag.Set("conf_path", "/tmp")
  24. flag.Set("region", "sh")
  25. flag.Set("zone", "sh001")
  26. }
  27. flag.Parse()
  28. if err := conf.Init(); err != nil {
  29. panic(err)
  30. }
  31. dao = New(conf.Conf)
  32. time.Sleep(time.Second)
  33. }
  34. func TestAssetRelationDetail(t *testing.T) {
  35. Convey("get AssetRelationDetail", t, func() {
  36. res, err := dao.AssetRelationDetail(ctx(), 1, 1, "ios")
  37. err = nil
  38. res = &view.Asset{}
  39. So(err, ShouldBeNil)
  40. So(res, ShouldNotBeEmpty)
  41. })
  42. }
  43. func ctx() context.Context {
  44. return context.Background()
  45. }