jury_test.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package service
  2. import (
  3. "context"
  4. "encoding/json"
  5. "testing"
  6. "go-common/app/job/main/credit/model"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func Test_BlockUser(t *testing.T) {
  10. var (
  11. c = context.TODO()
  12. mr = &model.Case{}
  13. )
  14. mr.ID = 304
  15. mr.JudgeType = model.JudgeTypeViolate
  16. mr.OriginTitle = "304"
  17. mr.Mid = 1
  18. mr.OriginURL = "http:304"
  19. mr.OriginContent = "304cont"
  20. mr.OriginType = 4
  21. mr.Operator = "lgs"
  22. mr.Status = 4
  23. mr.ReasonType = 3
  24. mr.RelationID = "10741-4052410"
  25. mr.PunishResult = 2
  26. Convey("should return err be nil", t, func() {
  27. err := s.BlockUser(c, mr)
  28. So(err, ShouldBeNil)
  29. })
  30. }
  31. func Test_Judge(t *testing.T) {
  32. var (
  33. c = context.TODO()
  34. mr = &model.Case{}
  35. )
  36. mr.ID = 304
  37. mr.Status = model.CaseStatusDealing
  38. mr.JudgeType = model.JudgeTypeViolate
  39. mr.OriginTitle = "304"
  40. mr.Mid = 1
  41. mr.OriginURL = "http:304"
  42. mr.OriginContent = "304cont"
  43. mr.OriginType = 4
  44. mr.Operator = "lgs"
  45. mr.Status = 4
  46. mr.ReasonType = 3
  47. mr.RelationID = "10741-4052410"
  48. mr.PunishResult = 2
  49. Convey("should return err be nil", t, func() {
  50. b, _ := json.Marshal(&mr)
  51. err := s.Judge(c, b, b)
  52. So(err, ShouldBeNil)
  53. })
  54. }
  55. func Test_dealMoralCase(t *testing.T) {
  56. var (
  57. c = context.TODO()
  58. mr = &model.Case{}
  59. )
  60. mr.ID = 304
  61. mr.Status = model.CaseStatusDealing
  62. mr.JudgeType = model.JudgeTypeViolate
  63. mr.OriginTitle = "304"
  64. mr.Mid = 1
  65. mr.OriginURL = "http:304"
  66. mr.OriginContent = "304cont"
  67. mr.OriginType = 4
  68. mr.Operator = "lgs"
  69. mr.Status = 4
  70. mr.ReasonType = 3
  71. mr.RelationID = "10741-4052410"
  72. mr.PunishResult = 2
  73. Convey("dealMoralCase", t, func() {
  74. err := s.dealMoralCase(c, mr)
  75. So(err, ShouldBeNil)
  76. })
  77. }