report_test.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/dm/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestChangeReportStat(t *testing.T) {
  9. var (
  10. c = context.TODO()
  11. cidDmids = map[int64][]int64{
  12. 9968618: {
  13. 719923090, 719923092,
  14. },
  15. }
  16. state = model.StatSecondDelete
  17. reason int8 = 2
  18. notice int8 = 3
  19. adminID int64 = 222
  20. remark = "二审删除"
  21. block int64 = 3
  22. blockReason int64
  23. moral int64 = 10
  24. uname = "zzz delete"
  25. )
  26. Convey("test change report stat", t, func() {
  27. affect, err := svr.ChangeReportStat(c, cidDmids, state, reason, notice, adminID, block, blockReason, moral, remark, uname)
  28. So(err, ShouldNotBeNil)
  29. So(affect, ShouldBeGreaterThan, 0)
  30. })
  31. }
  32. func TestReportLog(t *testing.T) {
  33. var (
  34. c = context.TODO()
  35. dmid int64 = 2
  36. )
  37. Convey("test report log", t, func() {
  38. lg, err := svr.ReportLog(c, dmid)
  39. So(err, ShouldBeNil)
  40. So(lg, ShouldNotBeEmpty)
  41. })
  42. }
  43. func TestReportList(t *testing.T) {
  44. var (
  45. c = context.TODO()
  46. page int64 = 1
  47. size int64 = 100
  48. start = "2017-05-10 00:00:00"
  49. end = "2017-12-13 00:00:00"
  50. order = "rp_time"
  51. sort = "asc"
  52. keyword = ""
  53. tid = []int64{}
  54. rpID = []int64{}
  55. state = []int64{0, 1, 2, 3, 4, 5, 6, 7}
  56. upOp = []int64{0, 1, 2}
  57. rt = &model.Report{}
  58. )
  59. Convey("test report list", t, func() {
  60. list, err := svr.ReportList(c, page, size, start, end, order, sort, keyword, tid, rpID, state, upOp, rt)
  61. So(err, ShouldBeNil)
  62. So(list, ShouldNotBeNil)
  63. })
  64. }
  65. func TestDMReportJudge(t *testing.T) {
  66. var (
  67. err error
  68. c = context.TODO()
  69. cidDmids = map[int64][]int64{
  70. 9968618: {719923090}}
  71. )
  72. Convey("test report judge", t, func() {
  73. err = svr.DMReportJudge(c, cidDmids, 122, "zhang1111")
  74. So(err, ShouldBeNil)
  75. })
  76. }
  77. func TestJudgeResult(t *testing.T) {
  78. var (
  79. c = context.TODO()
  80. cid, dmid int64 = 10109084, 719213118
  81. )
  82. Convey("test judge result", t, func() {
  83. err := svr.JudgeResult(c, cid, dmid, 1)
  84. So(err, ShouldBeNil)
  85. })
  86. }