bangumi_test.go 616 B

123456789101112131415161718192021222324252627282930313233343536
  1. package bangumi
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "go-common/app/interface/main/web-show/conf"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. var d *Dao
  11. func WithDao(f func(d *Dao)) func() {
  12. return func() {
  13. dir, _ := filepath.Abs("../cmd/web-show-test.toml")
  14. flag.Set("conf", dir)
  15. conf.Init()
  16. if d == nil {
  17. d = New(conf.Conf)
  18. }
  19. f(d)
  20. }
  21. }
  22. func TestDao_Bangumi(t *testing.T) {
  23. Convey("test Bangumi", t, WithDao(func(d *Dao) {
  24. mid := int64(5187977)
  25. aid := int64(2)
  26. data := d.IsBp(context.TODO(), mid, aid, "")
  27. So(data, ShouldNotBeNil)
  28. Printf("%+v", data)
  29. }))
  30. }