mcn_account_test.go 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. package up
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/mcn/model"
  6. xtime "go-common/library/time"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestUpTxAddMcnSignEntry(t *testing.T) {
  10. convey.Convey("TxAddMcnSignEntry", t, func(ctx convey.C) {
  11. var (
  12. tx, _ = d.BeginTran(context.Background())
  13. mcnMid = int64(0)
  14. beginDate = ""
  15. endDate = ""
  16. permission = uint32(0)
  17. )
  18. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  19. lastID, err := d.TxAddMcnSignEntry(tx, mcnMid, beginDate, endDate, permission)
  20. t.Logf("last id=%d", lastID)
  21. defer tx.Rollback()
  22. ctx.Convey("Then err should be nil.lastID should not be nil.", func(ctx convey.C) {
  23. ctx.So(err, convey.ShouldBeNil)
  24. ctx.So(lastID, convey.ShouldNotBeNil)
  25. })
  26. })
  27. })
  28. }
  29. func TestUpTxAddMcnSignPay(t *testing.T) {
  30. convey.Convey("TxAddMcnSignPay", t, func(ctx convey.C) {
  31. var (
  32. tx, _ = d.BeginTran(context.Background())
  33. mcnMid = int64(0)
  34. signID = int64(0)
  35. payValue = int64(0)
  36. dueDate = ""
  37. note = ""
  38. )
  39. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  40. rows, err := d.TxAddMcnSignPay(tx, mcnMid, signID, payValue, dueDate, note)
  41. defer tx.Rollback()
  42. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  43. ctx.So(err, convey.ShouldBeNil)
  44. ctx.So(rows, convey.ShouldNotBeNil)
  45. })
  46. })
  47. })
  48. }
  49. func TestUpUpMcnSignOP(t *testing.T) {
  50. convey.Convey("UpMcnSignOP", t, func(ctx convey.C) {
  51. var (
  52. c = context.Background()
  53. signID = int64(0)
  54. state = int8(0)
  55. rejectTime xtime.Time
  56. rejectReason = ""
  57. )
  58. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  59. rows, err := d.UpMcnSignOP(c, signID, state, rejectTime, rejectReason)
  60. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  61. ctx.So(err, convey.ShouldBeNil)
  62. ctx.So(rows, convey.ShouldNotBeNil)
  63. })
  64. })
  65. })
  66. }
  67. func TestUpUpMcnUpOP(t *testing.T) {
  68. convey.Convey("UpMcnUpOP", t, func(ctx convey.C) {
  69. var (
  70. c = context.Background()
  71. signUpID = int64(0)
  72. state = int8(0)
  73. rejectTime xtime.Time
  74. rejectReason = ""
  75. )
  76. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  77. rows, err := d.UpMcnUpOP(c, signUpID, state, rejectTime, rejectReason)
  78. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  79. ctx.So(err, convey.ShouldBeNil)
  80. ctx.So(rows, convey.ShouldNotBeNil)
  81. })
  82. })
  83. })
  84. }
  85. func TestUpTxMcnUpPermitOP(t *testing.T) {
  86. convey.Convey("TxMcnUpPermitOP", t, func(ctx convey.C) {
  87. var (
  88. tx, _ = d.BeginTran(context.Background())
  89. signID = int64(0)
  90. mcnMid = int64(0)
  91. upMid = int64(0)
  92. permission = uint32(0)
  93. upAuthLink = ""
  94. )
  95. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  96. rows, err := d.TxMcnUpPermitOP(tx, signID, mcnMid, upMid, permission, upAuthLink)
  97. defer tx.Rollback()
  98. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  99. ctx.So(err, convey.ShouldBeNil)
  100. ctx.So(rows, convey.ShouldNotBeNil)
  101. })
  102. })
  103. })
  104. }
  105. func TestUpTxUpPermitApplyOP(t *testing.T) {
  106. convey.Convey("TxUpPermitApplyOP", t, func(ctx convey.C) {
  107. var (
  108. tx, _ = d.BeginTran(context.Background())
  109. arg = &model.McnUpPermissionApply{}
  110. )
  111. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  112. rows, err := d.TxUpPermitApplyOP(tx, arg)
  113. defer tx.Rollback()
  114. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  115. ctx.So(err, convey.ShouldBeNil)
  116. ctx.So(rows, convey.ShouldNotBeNil)
  117. })
  118. })
  119. })
  120. }
  121. func TestUpMcnSigns(t *testing.T) {
  122. convey.Convey("McnSigns", t, func(ctx convey.C) {
  123. var (
  124. c = context.Background()
  125. arg = &model.MCNSignStateReq{}
  126. )
  127. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  128. ms, err := d.McnSigns(c, arg)
  129. ctx.Convey("Then err should be nil.ms should not be nil.", func(ctx convey.C) {
  130. ctx.So(err, convey.ShouldBeNil)
  131. ctx.So(ms, convey.ShouldNotBeNil)
  132. })
  133. })
  134. })
  135. }
  136. func TestUpMcnSignTotal(t *testing.T) {
  137. convey.Convey("McnSignTotal", t, func(ctx convey.C) {
  138. var (
  139. c = context.Background()
  140. arg = &model.MCNSignStateReq{}
  141. )
  142. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  143. count, err := d.McnSignTotal(c, arg)
  144. ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
  145. ctx.So(err, convey.ShouldBeNil)
  146. ctx.So(count, convey.ShouldNotBeNil)
  147. })
  148. })
  149. })
  150. }
  151. func TestUpMcnUpTotal(t *testing.T) {
  152. convey.Convey("McnUpTotal", t, func(ctx convey.C) {
  153. var (
  154. c = context.Background()
  155. arg = &model.MCNUPStateReq{}
  156. )
  157. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  158. count, err := d.McnUpTotal(c, arg)
  159. ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
  160. ctx.So(err, convey.ShouldBeNil)
  161. ctx.So(count, convey.ShouldNotBeNil)
  162. })
  163. })
  164. })
  165. }
  166. func TestUpMcnUpPermits(t *testing.T) {
  167. convey.Convey("McnUpPermits", t, func(ctx convey.C) {
  168. var (
  169. c = context.Background()
  170. arg = &model.MCNUPPermitStateReq{}
  171. )
  172. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  173. ms, err := d.McnUpPermits(c, arg)
  174. ctx.Convey("Then err should be nil.ms should not be nil.", func(ctx convey.C) {
  175. ctx.So(err, convey.ShouldBeNil)
  176. ctx.So(ms, convey.ShouldNotBeNil)
  177. })
  178. })
  179. })
  180. }
  181. func TestUpMcnUpPermit(t *testing.T) {
  182. convey.Convey("McnUpPermit", t, func(ctx convey.C) {
  183. var (
  184. c = context.Background()
  185. id = int64(0)
  186. )
  187. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  188. m, err := d.McnUpPermit(c, id)
  189. ctx.Convey("Then err should be nil.m should not be nil.", func(ctx convey.C) {
  190. ctx.So(err, convey.ShouldBeNil)
  191. ctx.So(m, convey.ShouldNotBeNil)
  192. })
  193. })
  194. })
  195. }
  196. func TestUpMcnUpPermitTotal(t *testing.T) {
  197. convey.Convey("McnUpPermitTotal", t, func(ctx convey.C) {
  198. var (
  199. c = context.Background()
  200. arg = &model.MCNUPPermitStateReq{}
  201. )
  202. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  203. count, err := d.McnUpPermitTotal(c, arg)
  204. ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
  205. ctx.So(err, convey.ShouldBeNil)
  206. ctx.So(count, convey.ShouldNotBeNil)
  207. })
  208. })
  209. })
  210. }