dao_test.go 957 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package bangumi
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "time"
  8. "go-common/app/interface/main/app-view/conf"
  9. . "github.com/smartystreets/goconvey/convey"
  10. )
  11. var (
  12. d *Dao
  13. )
  14. func init() {
  15. dir, _ := filepath.Abs("../../cmd/app-view-test.toml")
  16. flag.Set("conf", dir)
  17. conf.Init()
  18. d = New(conf.Conf)
  19. time.Sleep(time.Second)
  20. }
  21. func ctx() context.Context {
  22. return context.Background()
  23. }
  24. func TestMovie(t *testing.T) {
  25. Convey("get Movie all", t, func() {
  26. res, err := d.Movie(ctx(), 1, 1, 1, "iphone", "phone")
  27. So(err, ShouldBeNil)
  28. So(res, ShouldNotBeEmpty)
  29. })
  30. }
  31. func TestPGC(t *testing.T) {
  32. Convey("get PGC all", t, func() {
  33. res, err := d.PGC(ctx(), 1, 1, 1, "iphone", "phone")
  34. So(err, ShouldBeNil)
  35. So(res, ShouldNotBeEmpty)
  36. })
  37. }
  38. func TestSeasonidAid(t *testing.T) {
  39. Convey("get SeasonidAid all", t, func() {
  40. res, err := d.SeasonidAid(ctx(), 1, time.Now())
  41. So(err, ShouldBeNil)
  42. So(res, ShouldNotBeEmpty)
  43. })
  44. }