result_test.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package search
  2. import (
  3. "context"
  4. searchMdl "go-common/app/interface/main/tv/model/search"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestSearchSearchAll(t *testing.T) {
  9. var (
  10. ctx = context.Background()
  11. req = &searchMdl.ReqSearch{
  12. SearchType: "all_tv",
  13. Keyword: "番剧",
  14. Page: 1,
  15. MobiAPP: "android_tv_yst",
  16. Platform: "android",
  17. Build: "1011",
  18. }
  19. )
  20. convey.Convey("SearchAll", t, func(cx convey.C) {
  21. result, common, err := d.SearchAll(ctx, req)
  22. cx.Convey("Then err should be nil.result,all should not be nil.", func(ctx convey.C) {
  23. ctx.So(err, convey.ShouldBeNil)
  24. ctx.So(common, convey.ShouldNotBeNil)
  25. ctx.So(result, convey.ShouldNotBeNil)
  26. })
  27. })
  28. }
  29. func TestSearchSearchUgc(t *testing.T) {
  30. var (
  31. ctx = context.Background()
  32. req = &searchMdl.ReqSearch{
  33. SearchType: "tv_ugc",
  34. Category: 160,
  35. Keyword: "测试",
  36. Page: 1,
  37. MobiAPP: "android_tv_yst",
  38. Platform: "android",
  39. Build: "1011",
  40. }
  41. )
  42. convey.Convey("SearchUgc", t, func(cx convey.C) {
  43. result, common, err := d.SearchUgc(ctx, req)
  44. cx.Convey("Then err should be nil.result,ugc should not be nil.", func(ctx convey.C) {
  45. ctx.So(err, convey.ShouldBeNil)
  46. ctx.So(common, convey.ShouldNotBeNil)
  47. ctx.So(result, convey.ShouldNotBeNil)
  48. })
  49. })
  50. }
  51. func TestSearchSearchPgc(t *testing.T) {
  52. var (
  53. ctx = context.Background()
  54. req = &searchMdl.ReqSearch{
  55. SearchType: "tv_pgc",
  56. Keyword: "番剧",
  57. Page: 1,
  58. MobiAPP: "android_tv_yst",
  59. Platform: "android",
  60. Build: "1011",
  61. }
  62. )
  63. convey.Convey("SearchPgc", t, func(cx convey.C) {
  64. result, common, err := d.SearchPgc(ctx, req)
  65. cx.Convey("Then err should be nil.result,pgc should not be nil.", func(ctx convey.C) {
  66. ctx.So(err, convey.ShouldBeNil)
  67. ctx.So(common, convey.ShouldNotBeNil)
  68. ctx.So(result, convey.ShouldNotBeNil)
  69. })
  70. })
  71. }
  72. func TestSearchcommonParam(t *testing.T) {
  73. var (
  74. req = &searchMdl.ReqSearch{}
  75. )
  76. convey.Convey("commonParam", t, func(cx convey.C) {
  77. params := commonParam(req)
  78. cx.Convey("Then params should not be nil.", func(ctx convey.C) {
  79. ctx.So(params, convey.ShouldNotBeNil)
  80. })
  81. })
  82. }