http_test.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package block
  2. import (
  3. "context"
  4. model "go-common/app/admin/main/member/model/block"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestBlockBlackhouseBlock(t *testing.T) {
  9. convey.Convey("BlackhouseBlock", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. p = &model.ParamBatchBlock{}
  13. )
  14. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  15. err := d.BlackhouseBlock(c, p)
  16. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldNotBeNil)
  18. })
  19. })
  20. })
  21. }
  22. func TestBlockparseReasonType(t *testing.T) {
  23. convey.Convey("parseReasonType", t, func(ctx convey.C) {
  24. var (
  25. msg = ""
  26. )
  27. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  28. no := parseReasonType(msg)
  29. ctx.Convey("Then no should not be nil.", func(ctx convey.C) {
  30. ctx.So(no, convey.ShouldNotBeNil)
  31. })
  32. })
  33. })
  34. }
  35. func TestBlockSendSysMsg(t *testing.T) {
  36. convey.Convey("SendSysMsg", t, func(ctx convey.C) {
  37. var (
  38. c = context.Background()
  39. code = ""
  40. mids = []int64{}
  41. title = ""
  42. content = ""
  43. remoteIP = ""
  44. )
  45. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  46. err := d.SendSysMsg(c, code, mids, title, content, remoteIP)
  47. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  48. ctx.So(err, convey.ShouldNotBeNil)
  49. })
  50. })
  51. })
  52. }
  53. func TestBlockmidsToParam(t *testing.T) {
  54. convey.Convey("midsToParam", t, func(ctx convey.C) {
  55. var (
  56. mids = []int64{}
  57. )
  58. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  59. str := midsToParam(mids)
  60. ctx.Convey("Then str should not be nil.", func(ctx convey.C) {
  61. ctx.So(str, convey.ShouldNotBeNil)
  62. })
  63. })
  64. })
  65. }
  66. func TestBlockTelInfo(t *testing.T) {
  67. convey.Convey("TelInfo", t, func(ctx convey.C) {
  68. var (
  69. c = context.Background()
  70. mid = int64(0)
  71. )
  72. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  73. tel, err := d.TelInfo(c, mid)
  74. ctx.Convey("Then err should be nil.tel should not be nil.", func(ctx convey.C) {
  75. ctx.So(err, convey.ShouldNotBeNil)
  76. ctx.So(tel, convey.ShouldEqual, "")
  77. })
  78. })
  79. })
  80. }
  81. func TestBlockMailInfo(t *testing.T) {
  82. convey.Convey("MailInfo", t, func(ctx convey.C) {
  83. var (
  84. c = context.Background()
  85. mid = int64(0)
  86. )
  87. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  88. mail, err := d.MailInfo(c, mid)
  89. ctx.Convey("Then err should be nil.mail should not be nil.", func(ctx convey.C) {
  90. ctx.So(err, convey.ShouldNotBeNil)
  91. ctx.So(mail, convey.ShouldEqual, "")
  92. })
  93. })
  94. })
  95. }