archive_test.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. package service
  2. import (
  3. "context"
  4. "encoding/json"
  5. "testing"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestService_View(t *testing.T) {
  9. Convey("test archive view", t, WithService(func(s *Service) {
  10. var (
  11. mid int64 = 27515256
  12. aid int64 = 10110688
  13. cid int64 = 1
  14. )
  15. res, err := s.View(context.Background(), aid, cid, mid, "", "")
  16. So(err, ShouldBeNil)
  17. So(res, ShouldNotBeNil)
  18. str, _ := json.Marshal(res)
  19. Printf("%s", str)
  20. }))
  21. }
  22. func TestService_ArchiveStat(t *testing.T) {
  23. Convey("test archive archiveStat", t, WithService(func(s *Service) {
  24. var aid int64 = 5464686
  25. res, err := s.ArchiveStat(context.Background(), aid)
  26. So(err, ShouldBeNil)
  27. So(res, ShouldNotBeNil)
  28. }))
  29. }
  30. func TestService_AddShare(t *testing.T) {
  31. Convey("test archive AddShare", t, WithService(func(s *Service) {
  32. var (
  33. mid int64 = 27515256
  34. aid int64 = 5464686
  35. )
  36. res, err := s.AddShare(context.Background(), aid, mid, "", "", "", "", "")
  37. So(err, ShouldBeNil)
  38. So(res, ShouldBeGreaterThan, 0)
  39. }))
  40. }
  41. func TestService_Description(t *testing.T) {
  42. Convey("test archive Description", t, WithService(func(s *Service) {
  43. var (
  44. aid int64 = 5464686
  45. page int64 = 1
  46. )
  47. res, err := s.Description(context.Background(), aid, page)
  48. So(err, ShouldBeNil)
  49. So(res, ShouldNotBeEmpty)
  50. }))
  51. }
  52. func TestService_ArcReport(t *testing.T) {
  53. Convey("test archive ArcReport", t, WithService(func(s *Service) {
  54. var (
  55. mid int64 = 27515256
  56. aid int64 = 5464686
  57. tp int64
  58. reason string
  59. pics string
  60. )
  61. err := s.ArcReport(context.Background(), mid, aid, tp, reason, pics)
  62. So(err, ShouldBeNil)
  63. }))
  64. }
  65. func TestService_AppealTags(t *testing.T) {
  66. Convey("test archive AppealTags", t, WithService(func(s *Service) {
  67. res, err := s.AppealTags(context.Background())
  68. So(err, ShouldBeNil)
  69. So(len(res), ShouldBeGreaterThan, 0)
  70. }))
  71. }
  72. func TestService_AuthorRecommend(t *testing.T) {
  73. Convey("test archive AuthorRecommend", t, WithService(func(s *Service) {
  74. var aid int64 = 5464686
  75. res, err := s.AuthorRecommend(context.Background(), aid)
  76. So(err, ShouldBeNil)
  77. So(len(res), ShouldBeGreaterThan, 0)
  78. }))
  79. }
  80. func TestService_RelatedArcs(t *testing.T) {
  81. Convey("test archive RelatedArcs", t, WithService(func(s *Service) {
  82. var aid int64 = 5464686
  83. res, err := s.RelatedArcs(context.Background(), aid)
  84. So(err, ShouldBeNil)
  85. So(len(res), ShouldBeGreaterThan, 0)
  86. }))
  87. }
  88. func TestService_Detail(t *testing.T) {
  89. Convey("test archive Detail", t, WithService(func(s *Service) {
  90. var aid int64 = 5464686
  91. res, err := s.Detail(context.Background(), aid, 0, "", "")
  92. So(err, ShouldBeNil)
  93. So(res, ShouldNotBeNil)
  94. }))
  95. }