log_test.go 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/search/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func Test_LogAudit(t *testing.T) {
  9. var (
  10. err error
  11. c = context.Background()
  12. p = &model.LogParams{
  13. Bsp: &model.BasicSearchParams{
  14. AppID: "log_audit",
  15. },
  16. }
  17. params map[string][]string
  18. )
  19. Convey("LogAudit", t, WithService(func(s *Service) {
  20. business, ok := svr.Check("log_audit", 0)
  21. if !ok {
  22. return
  23. }
  24. _, err = s.LogAudit(c, params, p, business)
  25. So(err, ShouldBeNil)
  26. }))
  27. }
  28. //func Test_LogAuditGroupBy(t *testing.T) {
  29. // var (
  30. // err error
  31. // c = context.Background()
  32. // p = &model.LogParams{
  33. // Bsp: &model.BasicSearchParams{
  34. // AppID: "log_audit_group",
  35. // },
  36. // }
  37. // params map[string][]string
  38. // )
  39. // params = map[string][]string{
  40. // "group": {"oid"},
  41. // }
  42. // Convey("LogAuditGroupBy", t, WithService(func(s *Service) {
  43. // indexMapping, indexFmt, ok := svr.Check("log_audit", p.Business)
  44. // if !ok {
  45. // return
  46. // }
  47. // _, err = s.LogAuditGroupBy(c, params, p, indexMapping, indexFmt)
  48. // Printf("---------%v", err)
  49. // So(err, ShouldBeNil)
  50. // }))
  51. //}
  52. func Test_LogUserAction(t *testing.T) {
  53. var (
  54. err error
  55. c = context.Background()
  56. p = &model.LogParams{
  57. Bsp: &model.BasicSearchParams{
  58. AppID: "log_user_action",
  59. },
  60. }
  61. params map[string][]string
  62. )
  63. Convey("LogUserAction", t, WithService(func(s *Service) {
  64. business, ok := svr.Check("log_user_action", 0)
  65. if !ok {
  66. return
  67. }
  68. _, err = s.LogUserAction(c, params, p, business)
  69. So(err, ShouldBeNil)
  70. }))
  71. }