article_test.go 582 B

123456789101112131415161718192021222324252627
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/interface/main/space/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestService_Article(t *testing.T) {
  9. Convey("article list test", t, WithService(func(s *Service) {
  10. mid := int64(442549)
  11. pn := 1
  12. ps := 10
  13. sort := model.ArticleSortType["publish_time"]
  14. res, err := s.Article(context.Background(), mid, pn, ps, sort)
  15. So(err, ShouldBeNil)
  16. if res != nil && len(res.Articles) > 0 {
  17. Print(len(res.Articles), res.Count)
  18. for _, v := range res.Articles {
  19. Printf("%+v", v)
  20. }
  21. }
  22. }))
  23. }