masterpiece_test.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaomasterpieceHit(t *testing.T) {
  8. convey.Convey("masterpieceHit", t, func(ctx convey.C) {
  9. var (
  10. mid = int64(2222)
  11. )
  12. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  13. p1 := masterpieceHit(mid)
  14. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  15. ctx.So(p1, convey.ShouldNotBeNil)
  16. })
  17. })
  18. })
  19. }
  20. func TestDaomasterpieceKey(t *testing.T) {
  21. convey.Convey("masterpieceKey", t, func(ctx convey.C) {
  22. var (
  23. mid = int64(2222)
  24. )
  25. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  26. p1 := masterpieceKey(mid)
  27. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  28. ctx.So(p1, convey.ShouldNotBeNil)
  29. })
  30. })
  31. })
  32. }
  33. func TestDaoRawMasterpiece(t *testing.T) {
  34. convey.Convey("RawMasterpiece", t, func(ctx convey.C) {
  35. var (
  36. c = context.Background()
  37. mid = int64(2222)
  38. )
  39. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  40. res, err := d.RawMasterpiece(c, mid)
  41. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  42. ctx.So(err, convey.ShouldBeNil)
  43. ctx.So(res, convey.ShouldNotBeNil)
  44. })
  45. })
  46. })
  47. }
  48. func TestDaoAddMasterpiece(t *testing.T) {
  49. convey.Convey("AddMasterpiece", t, func(ctx convey.C) {
  50. var (
  51. c = context.Background()
  52. mid = int64(2222)
  53. aid = int64(2222)
  54. reason = ""
  55. )
  56. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  57. err := d.AddMasterpiece(c, mid, aid, reason)
  58. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  59. ctx.So(err, convey.ShouldBeNil)
  60. })
  61. })
  62. })
  63. }
  64. func TestDaoEditMasterpiece(t *testing.T) {
  65. convey.Convey("EditMasterpiece", t, func(ctx convey.C) {
  66. var (
  67. c = context.Background()
  68. mid = int64(2222)
  69. aid = int64(2222)
  70. preAid = int64(3333)
  71. reason = ""
  72. )
  73. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  74. err := d.EditMasterpiece(c, mid, aid, preAid, reason)
  75. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  76. ctx.So(err, convey.ShouldBeNil)
  77. })
  78. })
  79. })
  80. }
  81. func TestDaoDelMasterpiece(t *testing.T) {
  82. convey.Convey("DelMasterpiece", t, func(ctx convey.C) {
  83. var (
  84. c = context.Background()
  85. mid = int64(2222)
  86. aid = int64(2222)
  87. )
  88. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  89. err := d.DelMasterpiece(c, mid, aid)
  90. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  91. ctx.So(err, convey.ShouldBeNil)
  92. })
  93. })
  94. })
  95. }