realname_test.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. "go-common/app/admin/main/member/model"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestRealnameList(t *testing.T) {
  10. Convey("Realname list", t, func() {
  11. var (
  12. mids = []int64{46333}
  13. cardType = 0
  14. country = 0
  15. opName = ""
  16. tsFrom = int64(1528023084)
  17. tsTo = time.Now().Unix()
  18. state = 2
  19. pn, ps = 1, 20
  20. )
  21. list, total, err := d.RealnameMainList(context.Background(), mids, cardType, country, opName, tsFrom, tsTo, state, pn, ps, false)
  22. So(err, ShouldBeNil)
  23. So(list, ShouldNotBeNil)
  24. So(total, ShouldNotBeNil)
  25. })
  26. }
  27. func TestRealnameReason(t *testing.T) {
  28. Convey("Realname reason", t, func() {
  29. var (
  30. list = []string{
  31. "+1s",
  32. "蛤",
  33. "苟利国家",
  34. "19260817",
  35. }
  36. )
  37. err := d.UpdateRealnameReason(context.Background(), list)
  38. So(err, ShouldBeNil)
  39. list2, total, err := d.RealnameReasonList(context.Background())
  40. So(err, ShouldBeNil)
  41. So(total, ShouldEqual, len(list))
  42. So(list2, ShouldResemble, list)
  43. })
  44. }
  45. func TestRealnameApplyCount(t *testing.T) {
  46. Convey("Realname apply count", t, func() {
  47. var (
  48. mid = int64(1)
  49. )
  50. count, err := d.RealnameApplyCount(context.Background(), mid)
  51. So(err, ShouldBeNil)
  52. So(count, ShouldNotBeNil)
  53. })
  54. }
  55. func TestRealnameApply(t *testing.T) {
  56. Convey("Realname apply", t, func() {
  57. var (
  58. id = int64(1)
  59. )
  60. apply, err := d.RealnameMainApply(context.Background(), id)
  61. So(err, ShouldBeNil)
  62. So(apply, ShouldNotBeNil)
  63. })
  64. }
  65. func TestRealnameApplyUpdate(t *testing.T) {
  66. Convey("Realname apply update", t, func() {
  67. var (
  68. id = 1
  69. state = 2
  70. opname = "ut"
  71. opid = int64(233)
  72. optime = time.Now()
  73. remark = "ut_reason"
  74. )
  75. err := d.UpdateRealnameMainApply(context.Background(), id, state, opname, opid, optime, remark)
  76. So(err, ShouldBeNil)
  77. })
  78. }
  79. func TestRealnameAlipayApply(t *testing.T) {
  80. Convey("Realname alipay apply", t, func() {
  81. var (
  82. id = int64(1)
  83. )
  84. apply, err := d.RealnameAlipayApply(context.Background(), id)
  85. So(err, ShouldBeNil)
  86. t.Log(apply)
  87. })
  88. }
  89. func TestRealnameUpdateAlipayApply(t *testing.T) {
  90. Convey("Realname update alipay apply", t, func() {
  91. var (
  92. id = int64(1)
  93. )
  94. err := d.UpdateRealnameAlipayApply(context.Background(), id, 1, "someone", 2, "ut")
  95. So(err, ShouldBeNil)
  96. })
  97. }
  98. func TestUpdateRealnameInfo(t *testing.T) {
  99. Convey("Realname update realname info", t, func() {
  100. var (
  101. id = int64(1)
  102. )
  103. err := d.UpdateRealnameInfo(context.Background(), id, 2, "ut")
  104. So(err, ShouldBeNil)
  105. })
  106. }
  107. func TestAddRealnameIMG(t *testing.T) {
  108. Convey("AddRealnameIMG", t, func() {
  109. err := d.AddRealnameIMG(context.Background(), &model.DBRealnameApplyIMG{IMGData: "testing"})
  110. So(err, ShouldBeNil)
  111. })
  112. }
  113. func TestAddRealnameApply(t *testing.T) {
  114. Convey("AddRealnameApply", t, func() {
  115. err := d.AddRealnameApply(context.Background(), &model.DBRealnameApply{MID: 1})
  116. So(err, ShouldBeNil)
  117. })
  118. }
  119. func TestBatchRealnameInfo(t *testing.T) {
  120. Convey("BatchRealnameInfo", t, func() {
  121. res, err := d.BatchRealnameInfo(context.Background(), []int64{1, 2, 3})
  122. So(res, ShouldNotBeNil)
  123. So(err, ShouldBeNil)
  124. })
  125. }
  126. func TestRejectRealnameMainApply(t *testing.T) {
  127. Convey("RejectRealnameMainApply", t, func() {
  128. err := d.RejectRealnameMainApply(context.Background(), 1, "admin", 1, "test")
  129. So(err, ShouldBeNil)
  130. })
  131. }
  132. func TestRejectRealnameAlipayApply(t *testing.T) {
  133. Convey("RejectRealnameAlipayApply", t, func() {
  134. err := d.RejectRealnameAlipayApply(context.Background(), 1, "admin", 1, "test")
  135. So(err, ShouldBeNil)
  136. })
  137. }
  138. func TestAddOldRealnameIMG(t *testing.T) {
  139. Convey("AddOldRealnameIMG", t, func() {
  140. err := d.AddOldRealnameIMG(context.Background(), &model.DeDeIdentificationCardApplyImg{IMGData: "/test"})
  141. So(err, ShouldBeNil)
  142. })
  143. }
  144. func TestAddOldRealnameApply(t *testing.T) {
  145. Convey("AddOldRealnameApply", t, func() {
  146. err := d.AddOldRealnameApply(context.Background(), &model.DeDeIdentificationCardApply{MID: 1})
  147. So(err, ShouldBeNil)
  148. })
  149. }