dao_test.go 576 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package manager
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. . "github.com/smartystreets/goconvey/convey"
  8. "go-common/app/job/main/videoup-report/conf"
  9. )
  10. var (
  11. d *Dao
  12. )
  13. func init() {
  14. dir, _ := filepath.Abs("../../cmd/videoup-report-job.toml")
  15. flag.Set("conf", dir)
  16. conf.Init()
  17. d = New(conf.Conf)
  18. }
  19. func WithDao(f func(d *Dao)) func() {
  20. return func() {
  21. f(d)
  22. }
  23. }
  24. func Test_User(t *testing.T) {
  25. var (
  26. c = context.TODO()
  27. )
  28. Convey("User", t, WithDao(func(d *Dao) {
  29. um, err := d.User(c, 421)
  30. So(err, ShouldBeNil)
  31. So(um, ShouldNotBeNil)
  32. }))
  33. }