case_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_DelCaseInfoCache(t *testing.T) {
  10. var (
  11. c = context.TODO()
  12. mr = &model.Case{}
  13. )
  14. mr.ID = 304
  15. mr.Status = model.CaseStatusDealing
  16. mr.JudgeType = model.JudgeTypeViolate
  17. mr.OriginTitle = "304"
  18. mr.Mid = 1
  19. mr.OriginURL = "http:304"
  20. mr.OriginContent = "304cont"
  21. mr.OriginType = 4
  22. mr.Operator = "lgs"
  23. mr.Status = 4
  24. mr.ReasonType = 3
  25. mr.RelationID = "10741-4052410"
  26. mr.PunishResult = 2
  27. bb, _ := json.Marshal(mr)
  28. Convey("should return err be nil", t, func() {
  29. err := s.DelCaseInfoCache(c, bb)
  30. So(err, ShouldBeNil)
  31. })
  32. }
  33. func Test_UpdateVoteCount(t *testing.T) {
  34. var (
  35. c = context.TODO()
  36. mr = &model.Case{}
  37. )
  38. mr.ID = 304
  39. mr.Status = model.CaseStatusDealing
  40. mr.JudgeType = model.JudgeTypeViolate
  41. mr.OriginTitle = "304"
  42. mr.Mid = 1
  43. mr.OriginURL = "http:304"
  44. mr.OriginContent = "304cont"
  45. mr.OriginType = 4
  46. mr.Operator = "lgs"
  47. mr.Status = 4
  48. mr.ReasonType = 3
  49. mr.RelationID = "10741-4052410"
  50. mr.PunishResult = 2
  51. Convey("should return err be nil", t, func() {
  52. s.UpdateVoteCount(c, mr)
  53. })
  54. }