dao_test.go 560 B

123456789101112131415161718192021222324252627282930313233343536
  1. package article
  2. import (
  3. "context"
  4. "flag"
  5. "path/filepath"
  6. "testing"
  7. "go-common/app/interface/main/app-interface/conf"
  8. . "github.com/smartystreets/goconvey/convey"
  9. )
  10. var (
  11. d *Dao
  12. )
  13. func init() {
  14. dir, _ := filepath.Abs("../../cmd/app-interface-test.toml")
  15. flag.Set("conf", dir)
  16. conf.Init()
  17. d = New(conf.Conf)
  18. }
  19. func TestUpArticles(t *testing.T) {
  20. Convey("TestUpArticles", t, func() {
  21. d.UpArticles(context.TODO(), 1, 1, 1)
  22. })
  23. }
  24. func TestNew(t *testing.T) {
  25. Convey("new", t, func() {
  26. d := New(&conf.Config{})
  27. So(d, ShouldNotBeNil)
  28. })
  29. }