dao_test.go 567 B

123456789101112131415161718192021222324252627282930313233343536373839
  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/conf"
  9. )
  10. var (
  11. d *Dao
  12. )
  13. func init() {
  14. dir, _ := filepath.Abs("../../cmd/videoup-job-test.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_Uppers(t *testing.T) {
  25. var (
  26. c = context.TODO()
  27. )
  28. Convey("Uppers", t, WithDao(func(d *Dao) {
  29. um, err := d.Uppers(c)
  30. So(err, ShouldBeNil)
  31. So(um, ShouldNotBeNil)
  32. }))
  33. }