search_web_card_test.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 TestShowSearchWebCardAdd(t *testing.T) {
  8. convey.Convey("SearchWebCardAdd", t, func(ctx convey.C) {
  9. var (
  10. param = &show.SearchWebCardAP{
  11. Type: 1,
  12. Title: "搜索卡片",
  13. Desc: "卡片描述",
  14. Cover: "//bfs:",
  15. ReType: 1,
  16. ReValue: "http://",
  17. Corner: "角标",
  18. Person: "person",
  19. }
  20. )
  21. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  22. err := d.SearchWebCardAdd(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 TestShowSearchWebCardUpdate(t *testing.T) {
  30. convey.Convey("SearchWebCardUpdate", t, func(ctx convey.C) {
  31. var (
  32. param = &show.SearchWebCardUP{
  33. ID: 1,
  34. Type: 1,
  35. Title: "AA搜索卡片",
  36. Desc: "AA卡片描述",
  37. Cover: "//bfs:",
  38. ReType: 1,
  39. ReValue: "http://",
  40. Corner: "角标",
  41. }
  42. )
  43. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  44. err := d.SearchWebCardUpdate(param)
  45. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  46. ctx.So(err, convey.ShouldBeNil)
  47. })
  48. })
  49. })
  50. }
  51. func TestShowSearchWebCardDelete(t *testing.T) {
  52. convey.Convey("SearchWebCardDelete", t, func(ctx convey.C) {
  53. var (
  54. id = int64(1)
  55. )
  56. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  57. err := d.SearchWebCardDelete(id)
  58. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  59. ctx.So(err, convey.ShouldBeNil)
  60. })
  61. })
  62. })
  63. }
  64. func TestShowSWBFindByID(t *testing.T) {
  65. convey.Convey("SWBFindByID", t, func(ctx convey.C) {
  66. var (
  67. id = int64(1)
  68. )
  69. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  70. _, err := d.SWBFindByID(id)
  71. ctx.Convey("Then err should be nil.topic should not be nil.", func(ctx convey.C) {
  72. ctx.So(err, convey.ShouldBeNil)
  73. })
  74. })
  75. })
  76. }