review_test.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. xtime "go-common/library/time"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestDao_MvArchivedFaceToPri(t *testing.T) {
  10. Convey("MvArchivedFaceToPri", t, func() {
  11. err := d.MvArchivedFaceToPriv(context.Background(), "/bfs/face/7e68723b9d3664ac3773c1f3c26d5e2bfabc0f23.jpg", "/bfs/face/7e68723b9d3664ac3773c1f3c26d5e2bfabc0f21.jpg", "sys", "")
  12. So(err, ShouldBeNil)
  13. })
  14. }
  15. func TestDao_IncrFaceReject(t *testing.T) {
  16. Convey("IncrFaceReject", t, func() {
  17. err := d.IncrFaceReject(context.Background(), 2)
  18. So(err, ShouldBeNil)
  19. })
  20. }
  21. func TestDao_IncrViolationCount(t *testing.T) {
  22. Convey("IncrViolationCount", t, func() {
  23. err := d.IncrViolationCount(context.Background(), 2)
  24. So(err, ShouldBeNil)
  25. })
  26. }
  27. func TestDao_FaceAutoPass(t *testing.T) {
  28. Convey("FaceAutoPass", t, func() {
  29. t := xtime.Time(time.Now().Unix())
  30. err := d.FaceAutoPass(context.Background(), []int64{1}, t)
  31. So(err, ShouldBeNil)
  32. })
  33. }
  34. func TestDao_prepareReviewRange(t *testing.T) {
  35. Convey("prepareReviewRange", t, func() {
  36. stime := time.Date(0, 0, 0, 0, 0, 0, 0, time.Local).Unix()
  37. etime := time.Now().Unix()
  38. s, e, err := d.prepareReviewRange(context.Background(), xtime.Time(stime), xtime.Time(etime))
  39. So(err, ShouldBeNil)
  40. So(s, ShouldNotBeEmpty)
  41. So(e, ShouldNotBeEmpty)
  42. })
  43. }
  44. func TestDao_UpdateRemark(t *testing.T) {
  45. Convey("UpdateRemark", t, func() {
  46. err := d.UpdateRemark(context.Background(), 1, "12334")
  47. So(err, ShouldBeNil)
  48. })
  49. }
  50. func TestDao_QueuingFaceReviewsByTime(t *testing.T) {
  51. Convey("QueuingFaceReviewsByTime", t, func() {
  52. stime := time.Date(2018, 10, 1, 0, 0, 0, 0, time.Local).Unix()
  53. etime := time.Date(2018, 11, 1, 0, 0, 0, 0, time.Local).Unix()
  54. rws, err := d.QueuingFaceReviewsByTime(context.Background(), xtime.Time(stime), xtime.Time(etime))
  55. So(err, ShouldBeNil)
  56. // FIXME : UAT上全时间段查询不到该类数据
  57. So(rws, ShouldBeEmpty)
  58. })
  59. }
  60. func TestDao_ReviewByIDs(t *testing.T) {
  61. Convey("ReviewByIDs", t, func() {
  62. rws, err := d.ReviewByIDs(context.Background(), []int64{1, 2}, []int8{})
  63. So(err, ShouldBeNil)
  64. So(rws, ShouldNotBeEmpty)
  65. })
  66. }
  67. func TestDao_Reviews(t *testing.T) {
  68. Convey("Reviews", t, func() {
  69. rws, total, err := d.Reviews(context.Background(), 2231365, []int8{1}, []int8{0, 1, 2}, true, true, "", 1530542443, 1540910443, 1, 10)
  70. So(err, ShouldBeNil)
  71. So(total, ShouldNotBeNil)
  72. So(rws, ShouldNotBeNil)
  73. })
  74. }
  75. func TestDao_ReviewAudit(t *testing.T) {
  76. Convey("ReviewAudit", t, func() {
  77. err := d.ReviewAudit(context.Background(), []int64{2231365, 2231365}, 0, "test", "test")
  78. So(err, ShouldBeNil)
  79. })
  80. }
  81. func TestDao_Review(t *testing.T) {
  82. Convey("Review", t, func() {
  83. userPropertyReview, err := d.Review(context.Background(), 1)
  84. So(err, ShouldBeNil)
  85. So(userPropertyReview, ShouldNotBeNil)
  86. })
  87. }
  88. func TestDao_UpdateReviewFace(t *testing.T) {
  89. Convey("UpdateReviewFace", t, func() {
  90. err := d.UpdateReviewFace(context.Background(), 2231365, "face test")
  91. So(err, ShouldBeNil)
  92. })
  93. }
  94. func TestDao_AuditQueuingFace(t *testing.T) {
  95. Convey("Review", t, func() {
  96. err := d.AuditQueuingFace(context.Background(), 2231365, "face test", 0)
  97. So(err, ShouldBeNil)
  98. })
  99. }