dao_test.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package dao
  2. import (
  3. "context"
  4. "flag"
  5. "os"
  6. "testing"
  7. "go-common/app/interface/main/app-player/conf"
  8. "github.com/smartystreets/goconvey/convey"
  9. )
  10. var (
  11. d *Dao
  12. )
  13. func TestMain(m *testing.M) {
  14. if os.Getenv("DEPLOY_ENV") != "" {
  15. flag.Set("app_id", "main.app-svr.app-player")
  16. flag.Set("conf_token", "e477d98a7c5689623eca4f32f6af735c")
  17. flag.Set("tree_id", "52581")
  18. flag.Set("conf_version", "docker-1")
  19. flag.Set("deploy_env", "uat")
  20. flag.Set("conf_host", "config.bilibili.co")
  21. flag.Set("conf_path", "/tmp")
  22. flag.Set("region", "sh")
  23. flag.Set("zone", "sh001")
  24. }
  25. flag.Parse()
  26. if err := conf.Init(); err != nil {
  27. panic(err)
  28. }
  29. d = New(conf.Conf)
  30. m.Run()
  31. os.Exit(0)
  32. }
  33. func TestPlayurl(t *testing.T) {
  34. var (
  35. c = context.TODO()
  36. )
  37. convey.Convey("Playurl", t, func(ctx convey.C) {
  38. _, _, err := d.Playurl(c, 0, 1, 10109227, 32, 0, 0, 0, 0, 0, "json", "android", "dajskldasjkl", "", "", "")
  39. ctx.Convey("Then err should not be nil.", func(ctx convey.C) {
  40. ctx.So(err, convey.ShouldNotBeNil)
  41. })
  42. })
  43. }