official_test.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. "go-common/app/admin/main/member/model"
  7. xtime "go-common/library/time"
  8. "github.com/smartystreets/goconvey/convey"
  9. )
  10. func TestOfficials(t *testing.T) {
  11. convey.Convey("Officials", t, func() {
  12. o, total, err := s.Officials(context.Background(), &model.ArgOfficial{
  13. Mid: 123,
  14. Role: []int64{1},
  15. ETime: xtime.Time(time.Now().Unix()),
  16. Pn: 1,
  17. Ps: 20,
  18. })
  19. convey.So(err, convey.ShouldBeNil)
  20. convey.So(o, convey.ShouldNotBeNil)
  21. convey.So(total, convey.ShouldBeGreaterThan, 0)
  22. })
  23. }
  24. func TestOfficialDoc(t *testing.T) {
  25. convey.Convey("OfficialDoc", t, func() {
  26. o, logs, block, spy, realname, mids, err := s.OfficialDoc(context.Background(), 123)
  27. convey.So(err, convey.ShouldBeNil)
  28. convey.So(o, convey.ShouldNotBeNil)
  29. convey.So(logs, convey.ShouldNotBeNil)
  30. convey.So(block, convey.ShouldNotBeNil)
  31. convey.So(spy, convey.ShouldNotBeNil)
  32. convey.So(realname, convey.ShouldNotBeNil)
  33. convey.So(mids, convey.ShouldNotBeNil)
  34. })
  35. }
  36. func TestOfficialDocs(t *testing.T) {
  37. convey.Convey("OfficialDocs", t, func() {
  38. o, total, err := s.OfficialDocs(context.Background(), &model.ArgOfficialDoc{
  39. Mid: 123,
  40. Role: []int64{1},
  41. State: []int64{1},
  42. ETime: xtime.Time(time.Now().Unix()),
  43. Pn: 1,
  44. Ps: 20,
  45. })
  46. convey.So(err, convey.ShouldBeNil)
  47. convey.So(o, convey.ShouldNotBeNil)
  48. convey.So(total, convey.ShouldBeGreaterThan, 0)
  49. })
  50. }
  51. func TestOfficialDocAudit(t *testing.T) {
  52. convey.Convey("OfficialDocAudit", t, func() {
  53. err := s.OfficialDocAudit(context.Background(), &model.ArgOfficialAudit{
  54. Mid: 123,
  55. State: 1,
  56. UID: 111,
  57. Uname: "guan",
  58. Reason: "xxx",
  59. })
  60. convey.So(err, convey.ShouldBeNil)
  61. })
  62. }
  63. func TestOfficialDocEdit(t *testing.T) {
  64. convey.Convey("OfficialDocEdit", t, func() {
  65. err := s.OfficialDocEdit(context.Background(), &model.ArgOfficialEdit{
  66. Mid: 123,
  67. Name: "guan",
  68. Role: 1,
  69. Title: "title",
  70. Desc: "desc",
  71. UID: 111,
  72. Uname: "guan",
  73. })
  74. convey.So(err, convey.ShouldBeNil)
  75. })
  76. }