search_test.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/interface/main/dm/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestRptSearchIndex(t *testing.T) {
  9. Convey("", t, func() {
  10. s := testDao.rptSearchIndex()
  11. So(s, ShouldNotBeEmpty)
  12. t.Log(s)
  13. })
  14. }
  15. func TestSearchReport(t *testing.T) {
  16. var (
  17. c = context.TODO()
  18. // mid, aid, pn, ps int64 = 432230, 9548327, 1, 20 //pre
  19. mid, aid, pn, ps int64 = 27515615, 10100087, 1, 20
  20. upOp int8 = 2
  21. states = []int64{0, 2}
  22. )
  23. Convey("", t, func() {
  24. res, err := testDao.SearchReport(c, mid, aid, pn, ps, upOp, states)
  25. So(err, ShouldBeNil)
  26. So(res, ShouldNotBeEmpty)
  27. t.Logf("%+v", res.Page)
  28. for _, v := range res.Result {
  29. t.Logf("%+v", v)
  30. }
  31. })
  32. }
  33. func TestSearchReportAid(t *testing.T) {
  34. var (
  35. c = context.TODO()
  36. mid, pn, ps int64 = 27515256, 1, 20
  37. upOp int8
  38. state = []int8{0, 2}
  39. )
  40. Convey("", t, func() {
  41. aids, err := testDao.SearchReportAid(c, mid, upOp, state, pn, ps)
  42. So(err, ShouldBeNil)
  43. t.Logf("%+v", aids)
  44. })
  45. }
  46. func TestUptSearchReport(t *testing.T) {
  47. var (
  48. c = context.TODO()
  49. upt = &model.UptSearchReport{
  50. DMid: 1958334770970627,
  51. Upop: 0,
  52. Ctime: "2018-07-06 09:20:57",
  53. Mtime: "2018-07-27 19:20:50",
  54. }
  55. )
  56. Convey("", t, func() {
  57. err := testDao.UpdateSearchReport(c, []*model.UptSearchReport{upt})
  58. So(err, ShouldBeNil)
  59. })
  60. }