dao_test.go 549 B

12345678910111213141516171819202122232425262728293031323334
  1. package dao
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "go-common/app/job/openplatform/article/conf"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. func WithDao(f func(d *Dao)) func() {
  11. return func() {
  12. dir, _ := filepath.Abs("../cmd/goconvey.toml")
  13. flag.Set("conf", dir)
  14. flag.Parse()
  15. conf.Init()
  16. d := New(conf.Conf)
  17. f(d)
  18. }
  19. }
  20. func Test_Reply(t *testing.T) {
  21. Convey("open reply", t, WithDao(func(d *Dao) {
  22. var (
  23. err error
  24. c = context.TODO()
  25. )
  26. err = d.OpenReply(c, 88, 88)
  27. So(err, ShouldBeNil)
  28. }))
  29. }