report_test.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/interface/main/dm/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. var (
  9. c = context.TODO()
  10. cid = int64(10106598)
  11. dmid = int64(719918177)
  12. uid = int64(1234567)
  13. reason = int8(1)
  14. content = "aaaaaa"
  15. )
  16. func TestAddReport(t *testing.T) {
  17. Convey("test add report", t, func() {
  18. id, err := svr.AddReport(c, cid, dmid, uid, reason, content)
  19. So(err, ShouldBeNil)
  20. So(id, ShouldBeGreaterThan, 0)
  21. })
  22. }
  23. func TestReportList(t *testing.T) {
  24. var (
  25. mid, aid, page, size int64 = 27515615, 0, 1, 100
  26. upOp int8
  27. state = []int64{0, 2}
  28. )
  29. Convey("test report list", t, func() {
  30. list, err := svr.ReportList(c, mid, aid, page, size, upOp, state)
  31. So(err, ShouldBeNil)
  32. So(list, ShouldNotBeNil)
  33. })
  34. }
  35. func TestReportArchives(t *testing.T) {
  36. var (
  37. mid, pn, ps int64 = 27515256, 1, 20
  38. upOp int8
  39. states = []int8{0, 2}
  40. )
  41. Convey("test report archive list", t, func() {
  42. res, err := svr.ReportArchives(c, mid, upOp, states, pn, ps)
  43. So(err, ShouldBeNil)
  44. if res != nil {
  45. for _, v := range res.Result {
  46. t.Logf("%+v", v)
  47. }
  48. }
  49. })
  50. }
  51. func TestEditReport(t *testing.T) {
  52. var (
  53. cid int64 = 10114205
  54. dmid int64 = 719218893
  55. mid int64 = 27515615
  56. upOp = int8(model.StateDelete)
  57. )
  58. Convey("test edit report", t, func() {
  59. _, err := svr.EditReport(c, 1, cid, mid, dmid, upOp)
  60. So(err, ShouldBeNil)
  61. })
  62. }