search_web_test.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. package show
  2. import (
  3. "testing"
  4. "go-common/app/admin/main/feed/model/show"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestShowSearchWebAdd(t *testing.T) {
  8. convey.Convey("SearchWebAdd", t, func(ctx convey.C) {
  9. var (
  10. param = &show.SearchWebAP{
  11. CardType: 1,
  12. CardValue: "10",
  13. Stime: 1545701985,
  14. Etime: 1545711985,
  15. Priority: 1,
  16. Person: "quguolin",
  17. ApplyReason: "test",
  18. Query: "[{\"id\":7,\"value\":\"test1\"},{\"id\":8,\"value\":\"test2\"}]",
  19. }
  20. )
  21. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  22. err := d.SearchWebAdd(param)
  23. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  24. ctx.So(err, convey.ShouldBeNil)
  25. })
  26. })
  27. })
  28. }
  29. func TestShowSearchWebUpdate(t *testing.T) {
  30. convey.Convey("SearchWebUpdate", t, func(ctx convey.C) {
  31. var (
  32. param = &show.SearchWebUP{
  33. ID: 2,
  34. CardType: 1,
  35. CardValue: "10",
  36. Stime: 1545701985,
  37. Etime: 1545711985,
  38. Check: 1,
  39. Status: 1,
  40. Priority: 1,
  41. Person: "quguolin",
  42. ApplyReason: "test",
  43. Query: "[{\"id\":7,\"value\":\"test1\"},{\"id\":8,\"value\":\"test2\"},{\"sid\":10099668,\"value\":\"aaa\"}]",
  44. }
  45. )
  46. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  47. err := d.SearchWebUpdate(param)
  48. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  49. ctx.So(err, convey.ShouldBeNil)
  50. })
  51. })
  52. })
  53. }
  54. func TestShowSearchWebDelete(t *testing.T) {
  55. convey.Convey("SearchWebDelete", t, func(ctx convey.C) {
  56. var (
  57. id = int64(4)
  58. )
  59. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  60. err := d.SearchWebDelete(id)
  61. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  62. ctx.So(err, convey.ShouldBeNil)
  63. })
  64. })
  65. })
  66. }
  67. func TestShowSearchWebOption(t *testing.T) {
  68. convey.Convey("SearchWebOption", t, func(ctx convey.C) {
  69. var (
  70. up = &show.SearchWebOption{
  71. ID: 1,
  72. Check: 4,
  73. Status: 1,
  74. }
  75. )
  76. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  77. err := d.SearchWebOption(up)
  78. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  79. ctx.So(err, convey.ShouldBeNil)
  80. })
  81. })
  82. })
  83. }
  84. func TestShowSWTimeValid(t *testing.T) {
  85. convey.Convey("SWTimeValid", t, func(ctx convey.C) {
  86. var (
  87. up = &show.SWTimeValid{
  88. Priority: 1,
  89. Query: "test1",
  90. STime: 1543190400,
  91. ETime: 1543449600,
  92. }
  93. )
  94. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  95. _, err := d.SWTimeValid(up)
  96. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  97. ctx.So(err, convey.ShouldBeNil)
  98. })
  99. })
  100. })
  101. }
  102. func TestShowSWFindByID(t *testing.T) {
  103. convey.Convey("SWFindByID", t, func(ctx convey.C) {
  104. var (
  105. id = int64(1)
  106. )
  107. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  108. d.SWFindByID(id)
  109. })
  110. })
  111. }