admin_test.go 771 B

123456789101112131415161718192021222324252627282930313233343536
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/admin/main/reply/model"
  5. "testing"
  6. "time"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestAdminLog(t *testing.T) {
  10. var (
  11. ok bool
  12. oid = int64(1)
  13. rpID = int64(1)
  14. adminID = int64(1)
  15. typ = int32(4)
  16. now = time.Now()
  17. c = context.Background()
  18. )
  19. Convey("action set", t, WithService(func(s *Service) {
  20. err := s.addAdminLog(c, oid, rpID, adminID, typ, model.AdminIsNew, model.AdminIsReport, model.AdminOperDelete, "test", "remark", now)
  21. So(err, ShouldBeNil)
  22. list, err := s.LogsByRpID(c, rpID)
  23. So(err, ShouldBeNil)
  24. So(len(list), ShouldNotEqual, 0)
  25. for _, log := range list {
  26. if log.ReplyID == rpID {
  27. ok = true
  28. }
  29. }
  30. So(ok, ShouldEqual, true)
  31. }))
  32. }