event_topic_test.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 TestShowEventTopicAdd(t *testing.T) {
  8. convey.Convey("EventTopicAdd", t, func(ctx convey.C) {
  9. var (
  10. param = &show.EventTopicAP{
  11. Title: "title",
  12. Desc: "desc",
  13. Cover: "cover",
  14. Retype: 1,
  15. Revalue: "revalue",
  16. Corner: "corner",
  17. Person: "person",
  18. }
  19. )
  20. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  21. err := d.EventTopicAdd(param)
  22. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  23. ctx.So(err, convey.ShouldBeNil)
  24. })
  25. })
  26. })
  27. }
  28. func TestShowEventTopicUpdate(t *testing.T) {
  29. convey.Convey("EventTopicUpdate", t, func(ctx convey.C) {
  30. var (
  31. param = &show.EventTopicUP{
  32. ID: 1,
  33. Title: "title111",
  34. Desc: "desc111",
  35. Cover: "cover111",
  36. Retype: 1,
  37. Revalue: "revalue111",
  38. Corner: "corner111",
  39. }
  40. )
  41. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  42. err := d.EventTopicUpdate(param)
  43. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  44. ctx.So(err, convey.ShouldBeNil)
  45. })
  46. })
  47. })
  48. }
  49. func TestShowEventTopicDelete(t *testing.T) {
  50. convey.Convey("EventTopicDelete", t, func(ctx convey.C) {
  51. var (
  52. id = int64(1)
  53. )
  54. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  55. err := d.EventTopicDelete(id)
  56. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  57. ctx.So(err, convey.ShouldBeNil)
  58. })
  59. })
  60. })
  61. }
  62. func TestShowETFindByID(t *testing.T) {
  63. convey.Convey("ETFindByID", t, func(ctx convey.C) {
  64. var (
  65. id = int64(2)
  66. )
  67. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  68. _, err := d.ETFindByID(id)
  69. ctx.Convey("Then err should be nil.topic should not be nil.", func(ctx convey.C) {
  70. ctx.So(err, convey.ShouldBeNil)
  71. })
  72. })
  73. })
  74. }