realname_test.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/job/main/member/model"
  5. "net/url"
  6. "testing"
  7. "time"
  8. "github.com/smartystreets/goconvey/convey"
  9. )
  10. func TestDaoUpdateRealnameFromMSG(t *testing.T) {
  11. convey.Convey("UpdateRealnameFromMSG", t, func(convCtx convey.C) {
  12. var (
  13. c = context.Background()
  14. ms = &model.RealnameApplyMessage{}
  15. )
  16. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  17. err := d.UpdateRealnameFromMSG(c, ms)
  18. convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
  19. convCtx.So(err, convey.ShouldBeNil)
  20. })
  21. })
  22. })
  23. }
  24. func TestDaoRealnameInfo(t *testing.T) {
  25. convey.Convey("RealnameInfo", t, func(convCtx convey.C) {
  26. var (
  27. c = context.Background()
  28. mid = int64(0)
  29. )
  30. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  31. info, err := d.RealnameInfo(c, mid)
  32. convCtx.Convey("Then err should be nil.info should not be nil.", func(convCtx convey.C) {
  33. convCtx.So(err, convey.ShouldBeNil)
  34. convCtx.So(info, convey.ShouldNotBeNil)
  35. })
  36. })
  37. })
  38. }
  39. func TestDaoUpsertRealnameInfo(t *testing.T) {
  40. convey.Convey("UpsertRealnameInfo", t, func(convCtx convey.C) {
  41. var (
  42. c = context.Background()
  43. ms = &model.RealnameInfo{}
  44. )
  45. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  46. err := d.UpsertRealnameInfo(c, ms)
  47. convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
  48. convCtx.So(err, convey.ShouldBeNil)
  49. })
  50. })
  51. })
  52. }
  53. func TestDaoUpsertRealnameApplyImg(t *testing.T) {
  54. convey.Convey("UpsertRealnameApplyImg", t, func(convCtx convey.C) {
  55. var (
  56. c = context.Background()
  57. ms = &model.RealnameApplyImgMessage{}
  58. )
  59. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  60. err := d.UpsertRealnameApplyImg(c, ms)
  61. convCtx.Convey("Then err should be nil.", func(convCtx convey.C) {
  62. convCtx.So(err, convey.ShouldBeNil)
  63. })
  64. })
  65. })
  66. }
  67. func TestDaoRealnameAlipayApplyList(t *testing.T) {
  68. convey.Convey("RealnameAlipayApplyList", t, func(convCtx convey.C) {
  69. var (
  70. c = context.Background()
  71. startID = int64(0)
  72. status model.RealnameApplyStatus
  73. fromTime = time.Now().AddDate(-1, 0, 0)
  74. toTime = time.Now()
  75. limit = int(10)
  76. )
  77. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  78. status = 2
  79. maxID, list, err := d.RealnameAlipayApplyList(c, startID, status, fromTime, toTime, limit)
  80. convCtx.Convey("Then err should be nil.maxID,list should not be nil.", func(convCtx convey.C) {
  81. convCtx.So(err, convey.ShouldBeNil)
  82. convCtx.So(list, convey.ShouldNotBeNil)
  83. convCtx.So(maxID, convey.ShouldNotBeNil)
  84. })
  85. })
  86. })
  87. }
  88. func TestDaoAlipayQuery(t *testing.T) {
  89. convey.Convey("AlipayQuery", t, func(convCtx convey.C) {
  90. var (
  91. c = context.Background()
  92. param url.Values
  93. )
  94. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  95. pass, _, err := d.AlipayQuery(c, param)
  96. convCtx.Convey("Then err should be nil.pass,reason should not be nil.", func(convCtx convey.C) {
  97. convCtx.So(err, convey.ShouldNotBeNil)
  98. //convCtx.So(reason, convey.ShouldBeNil)
  99. convCtx.So(pass, convey.ShouldNotBeNil)
  100. })
  101. })
  102. })
  103. }