dao_test.go 577 B

123456789101112131415161718192021222324252627282930313233343536
  1. package bvc
  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. func Test_VideoCapable(t *testing.T) {
  11. Convey("Tool", t, WithDao(func(d *Dao) {
  12. err := d.VideoCapable(context.TODO(), int64(2), []int64{21477219}, 0)
  13. So(err, ShouldBeNil)
  14. }))
  15. }
  16. var (
  17. d *Dao
  18. )
  19. func init() {
  20. dir, _ := filepath.Abs("../../cmd/videoup-job-test.toml")
  21. flag.Set("conf", dir)
  22. conf.Init()
  23. d = New(conf.Conf)
  24. }
  25. func WithDao(f func(d *Dao)) func() {
  26. return func() {
  27. Reset(func() {})
  28. f(d)
  29. }
  30. }