card_set_stars_test.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package show
  2. import (
  3. "go-common/app/admin/main/feed/model/show"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestShowPopularStarsAdd(t *testing.T) {
  8. convey.Convey("PopularStarsAdd", t, func(ctx convey.C) {
  9. var (
  10. param = &show.PopularStarsAP{
  11. Type: "up_rcmd_new",
  12. Value: "31",
  13. Title: "title",
  14. LongTitle: "longtitle",
  15. Content: "[{\"id\":10099666,\"title\":\"uat-case-新转码系统1515660475\"},{\"id\":10099667,\"title\":\"测试-test22-秒开-1515660506\"}]",
  16. }
  17. )
  18. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  19. err := d.PopularStarsAdd(param)
  20. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  21. ctx.So(err, convey.ShouldBeNil)
  22. })
  23. })
  24. })
  25. }
  26. func TestShowPopularStarsUpdate(t *testing.T) {
  27. convey.Convey("PopularStarsUpdate", t, func(ctx convey.C) {
  28. var (
  29. param = &show.PopularStarsUP{
  30. ID: 16,
  31. Type: "up_rcmd_new",
  32. Value: "32",
  33. Title: "title",
  34. LongTitle: "longtitle",
  35. Content: "[{\"id\":10099666,\"title\":\"uat-case-新转码系统1515660475\"},{\"id\":10099667,\"title\":\"测试-test22-秒开-1515660506\"}]",
  36. }
  37. )
  38. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  39. err := d.PopularStarsUpdate(param)
  40. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  41. ctx.So(err, convey.ShouldBeNil)
  42. })
  43. })
  44. })
  45. }
  46. func TestShowPopularStarsDelete(t *testing.T) {
  47. convey.Convey("PopularStarsDelete", t, func(ctx convey.C) {
  48. var (
  49. id = int64(11)
  50. )
  51. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  52. err := d.PopularStarsDelete(id, "up_rcmd_new")
  53. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  54. ctx.So(err, convey.ShouldBeNil)
  55. })
  56. })
  57. })
  58. }