spy_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package service
  2. import (
  3. "context"
  4. "time"
  5. spym "go-common/app/service/main/spy/model"
  6. "testing"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. var (
  10. testSpyMid int64 = 111
  11. )
  12. // go test -test.v -test.run TestPutSpyScore
  13. func TestPutSpyScore(t *testing.T) {
  14. Convey("Test_PutSpyScore put no reason msg", t, WithService(func(s *Service) {
  15. So(s.PutSpyScore(context.TODO(), &spym.ScoreChange{
  16. Mid: testSpyMid,
  17. Score: 80,
  18. EventScore: 80,
  19. BaseScore: 80,
  20. TS: time.Now().Unix(),
  21. }), ShouldBeNil)
  22. }))
  23. Convey("Test_PutSpyScore put coin-service reason msg", t, WithService(func(s *Service) {
  24. So(s.PutSpyScore(context.TODO(), &spym.ScoreChange{
  25. Mid: testSpyMid,
  26. Score: 70,
  27. EventScore: 80,
  28. BaseScore: 80,
  29. TS: time.Now().Unix(),
  30. Reason: "coin-service",
  31. RiskLevel: 3,
  32. }), ShouldBeNil)
  33. }))
  34. Convey("Test_PutSpyScore put coin-service high risk reason msg", t, WithService(func(s *Service) {
  35. So(s.PutSpyScore(context.TODO(), &spym.ScoreChange{
  36. Mid: testSpyMid,
  37. Score: 8,
  38. EventScore: 80,
  39. BaseScore: 80,
  40. TS: time.Now().Unix(),
  41. Reason: "coin-service",
  42. RiskLevel: 7,
  43. }), ShouldBeNil)
  44. }))
  45. }