search_test.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package search
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/interface/main/creative/model/search"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestSearchArchivesES(t *testing.T) {
  9. var (
  10. c = context.TODO()
  11. mid = int64(2089809)
  12. tid = int16(160)
  13. keyword = ""
  14. order = "click"
  15. class = ""
  16. ip = "127.0.0.1"
  17. pn = int(1)
  18. ps = int(10)
  19. )
  20. convey.Convey("ArchivesES", t, func(ctx convey.C) {
  21. sres, err := d.ArchivesES(c, mid, tid, keyword, order, class, ip, pn, ps, 1)
  22. ctx.Convey("Then err should be nil.sres should not be nil.", func(ctx convey.C) {
  23. ctx.So(err, convey.ShouldBeNil)
  24. ctx.So(sres, convey.ShouldNotBeNil)
  25. })
  26. })
  27. }
  28. func TestSearchReplyES(t *testing.T) {
  29. var (
  30. c = context.TODO()
  31. )
  32. p := &search.ReplyParam{
  33. Ak: "1",
  34. Ck: "1",
  35. OMID: 1,
  36. OID: 1,
  37. Pn: 1,
  38. Ps: 1,
  39. IP: "",
  40. IsReport: 1,
  41. Type: 1,
  42. FilterCtime: "",
  43. Kw: "",
  44. Order: "",
  45. }
  46. convey.Convey("ArchivesES", t, func(ctx convey.C) {
  47. _, err := d.ReplyES(c, p)
  48. ctx.Convey("Then err should be nil.sres should not be nil.", func(ctx convey.C) {
  49. ctx.So(err, convey.ShouldBeNil)
  50. })
  51. })
  52. }
  53. func TestSearchStaffES(t *testing.T) {
  54. var (
  55. c = context.TODO()
  56. mid = int64(2089809)
  57. tid = int16(160)
  58. keyword = ""
  59. pn = int(1)
  60. ps = int(10)
  61. )
  62. convey.Convey("ArchivesES", t, func(ctx convey.C) {
  63. _, err := d.ArchivesStaffES(c, mid, tid, keyword, "0", pn, ps)
  64. ctx.Convey("Then err should be nil.sres should not be nil.", func(ctx convey.C) {
  65. ctx.So(err, convey.ShouldBeNil)
  66. })
  67. })
  68. }