jury_test.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. "go-common/app/job/main/credit/model"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func Test_AddBlockInfo(t *testing.T) {
  10. var (
  11. r = model.BlockedInfo{}
  12. )
  13. r.OriginTitle = "go"
  14. r.OriginURL = "http:go"
  15. r.OriginType = 1
  16. r.OriginContent = "goc"
  17. r.OriginContentModify = "gocm"
  18. r.BlockedDays = 1
  19. r.BlockedForever = 1
  20. r.BlockedType = 1
  21. r.UID = 888890
  22. r.OperatorName = "lgs"
  23. r.PunishType = 3
  24. r.ReasonType = 3
  25. r.CaseID = 10
  26. Convey("should return err be nil", t, func() {
  27. _, err := d.AddBlockInfo(context.TODO(), &r, time.Now())
  28. So(err, ShouldBeNil)
  29. })
  30. }
  31. func Test_UpdateKPIPendentStatus(t *testing.T) {
  32. Convey("should return err be nil", t, func() {
  33. err := d.UpdateKPIPendentStatus(context.TODO(), 1)
  34. So(err, ShouldBeNil)
  35. })
  36. }
  37. func Test_UpdateKPIHandlerStatus(t *testing.T) {
  38. Convey("should return err be nil", t, func() {
  39. err := d.UpdateKPIHandlerStatus(context.TODO(), 1)
  40. So(err, ShouldBeNil)
  41. })
  42. }
  43. func Test_UpdateCase(t *testing.T) {
  44. Convey("should return err be nil", t, func() {
  45. err := d.UpdateCase(context.TODO(), model.CaseStatusDealed, model.JudgeTypeUndeal, 304)
  46. So(err, ShouldBeNil)
  47. })
  48. }
  49. func Test_InvalidJury(t *testing.T) {
  50. Convey("should return err be nil", t, func() {
  51. err := d.InvalidJury(context.TODO(), 1, 88889021)
  52. So(err, ShouldBeNil)
  53. })
  54. }
  55. func Test_UpdateVoteRight(t *testing.T) {
  56. Convey("should return err be nil", t, func() {
  57. err := d.UpdateVoteRight(context.TODO(), 88889021)
  58. So(err, ShouldBeNil)
  59. })
  60. }
  61. func Test_UpdateVoteTotal(t *testing.T) {
  62. Convey("should return err be nil", t, func() {
  63. err := d.UpdateVoteTotal(context.TODO(), 88889021)
  64. So(err, ShouldBeNil)
  65. })
  66. }
  67. func Test_UpdatePunishResult(t *testing.T) {
  68. Convey("should return err be nil", t, func() {
  69. err := d.UpdatePunishResult(context.TODO(), 1, 6)
  70. So(err, ShouldBeNil)
  71. })
  72. }
  73. func Test_BlockCount(t *testing.T) {
  74. Convey("should return err be nil and count>=0", t, func() {
  75. count, err := d.CountBlocked(context.TODO(), 88889021, time.Now())
  76. So(err, ShouldBeNil)
  77. So(count, ShouldBeGreaterThanOrEqualTo, 0)
  78. })
  79. }
  80. func TestDao_CaseByID(t *testing.T) {
  81. Convey("should return err be nil & res not be nil", t, func() {
  82. res, err := d.CaseByID(context.TODO(), 348)
  83. So(err, ShouldBeNil)
  84. So(res, ShouldNotBeNil)
  85. })
  86. }