sign_up_test.go 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. package upcrmservice
  2. import (
  3. "context"
  4. "testing"
  5. "go-common/app/admin/main/up/model/signmodel"
  6. "github.com/jinzhu/gorm"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestUpcrmserviceSignUpAuditLogs(t *testing.T) {
  10. convey.Convey("SignUpAuditLogs", t, func(ctx convey.C) {
  11. var (
  12. c = context.Background()
  13. arg = &signmodel.SignOpSearchArg{}
  14. )
  15. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  16. res, err := s.SignUpAuditLogs(c, arg)
  17. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  18. ctx.So(err, convey.ShouldBeNil)
  19. ctx.So(res, convey.ShouldNotBeNil)
  20. })
  21. })
  22. })
  23. }
  24. func TestUpcrmserviceSignAdd(t *testing.T) {
  25. convey.Convey("SignAdd", t, func(ctx convey.C) {
  26. var (
  27. context = context.Background()
  28. arg = &signmodel.SignUpArg{}
  29. )
  30. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  31. result, err := s.SignAdd(context, arg)
  32. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  33. ctx.So(err, convey.ShouldBeNil)
  34. ctx.So(result, convey.ShouldNotBeNil)
  35. })
  36. })
  37. })
  38. }
  39. func TestUpcrmserviceSignUpdate(t *testing.T) {
  40. convey.Convey("SignUpdate", t, func(ctx convey.C) {
  41. var (
  42. context = context.Background()
  43. arg = &signmodel.SignUpArg{}
  44. )
  45. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  46. result, err := s.SignUpdate(context, arg)
  47. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  48. ctx.So(err, convey.ShouldBeNil)
  49. ctx.So(result, convey.ShouldNotBeNil)
  50. })
  51. })
  52. })
  53. }
  54. func TestUpcrmserviceViolationAdd(t *testing.T) {
  55. convey.Convey("ViolationAdd", t, func(ctx convey.C) {
  56. var (
  57. context = context.Background()
  58. arg = &signmodel.ViolationArg{}
  59. )
  60. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  61. result, err := s.ViolationAdd(context, arg)
  62. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  63. ctx.So(err, convey.ShouldBeNil)
  64. ctx.So(result, convey.ShouldNotBeNil)
  65. })
  66. })
  67. })
  68. }
  69. func TestUpcrmserviceViolationRetract(t *testing.T) {
  70. convey.Convey("ViolationRetract", t, func(ctx convey.C) {
  71. var (
  72. context = context.Background()
  73. arg = &signmodel.IDArg{}
  74. )
  75. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  76. result, err := s.ViolationRetract(context, arg)
  77. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  78. ctx.So(err, convey.ShouldBeNil)
  79. ctx.So(result, convey.ShouldNotBeNil)
  80. })
  81. })
  82. })
  83. }
  84. func TestUpcrmserviceViolationList(t *testing.T) {
  85. convey.Convey("ViolationList", t, func(ctx convey.C) {
  86. var (
  87. context = context.Background()
  88. arg = &signmodel.PageArg{}
  89. )
  90. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  91. result, err := s.ViolationList(context, arg)
  92. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  93. ctx.So(err, convey.ShouldBeNil)
  94. ctx.So(result, convey.ShouldNotBeNil)
  95. })
  96. })
  97. })
  98. }
  99. func TestUpcrmserviceAbsenceAdd(t *testing.T) {
  100. convey.Convey("AbsenceAdd", t, func(ctx convey.C) {
  101. var (
  102. context = context.Background()
  103. arg = &signmodel.AbsenceArg{}
  104. )
  105. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  106. result, err := s.AbsenceAdd(context, arg)
  107. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  108. ctx.So(err, convey.ShouldBeNil)
  109. ctx.So(result, convey.ShouldNotBeNil)
  110. })
  111. })
  112. })
  113. }
  114. func TestUpcrmservicegetOrCreateTaskHistory(t *testing.T) {
  115. convey.Convey("getOrCreateTaskHistory", t, func(ctx convey.C) {
  116. var (
  117. tx = &gorm.DB{}
  118. signID = int64(0)
  119. )
  120. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  121. res, err := s.getOrCreateTaskHistory(tx, signID)
  122. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  123. ctx.So(err, convey.ShouldBeNil)
  124. ctx.So(res, convey.ShouldNotBeNil)
  125. })
  126. })
  127. })
  128. }
  129. func TestUpcrmserviceAbsenceRetract(t *testing.T) {
  130. convey.Convey("AbsenceRetract", t, func(ctx convey.C) {
  131. var (
  132. context = context.Background()
  133. arg = &signmodel.IDArg{}
  134. )
  135. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  136. result, err := s.AbsenceRetract(context, arg)
  137. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  138. ctx.So(err, convey.ShouldBeNil)
  139. ctx.So(result, convey.ShouldNotBeNil)
  140. })
  141. })
  142. })
  143. }
  144. func TestUpcrmserviceAbsenceList(t *testing.T) {
  145. convey.Convey("AbsenceList", t, func(ctx convey.C) {
  146. var (
  147. context = context.Background()
  148. arg = &signmodel.PageArg{}
  149. )
  150. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  151. result, err := s.AbsenceList(context, arg)
  152. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  153. ctx.So(err, convey.ShouldBeNil)
  154. ctx.So(result, convey.ShouldNotBeNil)
  155. })
  156. })
  157. })
  158. }
  159. func TestUpcrmserviceViewCheck(t *testing.T) {
  160. convey.Convey("ViewCheck", t, func(ctx convey.C) {
  161. var (
  162. context = context.Background()
  163. arg = &signmodel.PowerCheckArg{}
  164. )
  165. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  166. res, err := s.ViewCheck(context, arg)
  167. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  168. ctx.So(err, convey.ShouldBeNil)
  169. ctx.So(res, convey.ShouldNotBeNil)
  170. })
  171. })
  172. })
  173. }
  174. func TestUpcrmserviceaddPayInfo(t *testing.T) {
  175. convey.Convey("addPayInfo", t, func(ctx convey.C) {
  176. var (
  177. tx = &gorm.DB{}
  178. arg = &signmodel.SignPayInfoArg{}
  179. )
  180. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  181. id, err := s.addPayInfo(tx, arg)
  182. ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  183. ctx.So(err, convey.ShouldBeNil)
  184. ctx.So(id, convey.ShouldNotBeNil)
  185. })
  186. })
  187. })
  188. }
  189. func TestUpcrmserviceaddTaskInfo(t *testing.T) {
  190. convey.Convey("addTaskInfo", t, func(ctx convey.C) {
  191. var (
  192. tx = &gorm.DB{}
  193. arg = &signmodel.SignTaskInfoArg{}
  194. )
  195. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  196. id, err := s.addTaskInfo(tx, arg)
  197. ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  198. ctx.So(err, convey.ShouldBeNil)
  199. ctx.So(id, convey.ShouldNotBeNil)
  200. })
  201. })
  202. })
  203. }
  204. func TestUpcrmserviceaddContractInfo(t *testing.T) {
  205. convey.Convey("addContractInfo", t, func(ctx convey.C) {
  206. var (
  207. tx = &gorm.DB{}
  208. arg = &signmodel.SignContractInfoArg{}
  209. )
  210. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  211. id, err := s.addContractInfo(tx, arg)
  212. ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  213. ctx.So(err, convey.ShouldBeNil)
  214. ctx.So(id, convey.ShouldNotBeNil)
  215. })
  216. })
  217. })
  218. }
  219. func TestUpcrmserviceSignQuery(t *testing.T) {
  220. convey.Convey("SignQuery", t, func(ctx convey.C) {
  221. var (
  222. c = context.Background()
  223. arg = &signmodel.SignQueryArg{}
  224. )
  225. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  226. res, err := s.SignQuery(c, arg)
  227. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  228. ctx.So(err, convey.ShouldBeNil)
  229. ctx.So(res, convey.ShouldNotBeNil)
  230. })
  231. })
  232. })
  233. }
  234. func TestUpcrmserviceSignQueryID(t *testing.T) {
  235. convey.Convey("SignQueryID", t, func(ctx convey.C) {
  236. var (
  237. c = context.Background()
  238. arg = &signmodel.SignIDArg{}
  239. )
  240. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  241. res, err := s.SignQueryID(c, arg)
  242. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  243. ctx.So(err, convey.ShouldBeNil)
  244. ctx.So(res, convey.ShouldNotBeNil)
  245. })
  246. })
  247. })
  248. }
  249. func TestUpcrmserviceSignPayComplete(t *testing.T) {
  250. convey.Convey("SignPayComplete", t, func(ctx convey.C) {
  251. var (
  252. con = context.Background()
  253. arg = &signmodel.SignPayCompleteArg{}
  254. )
  255. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  256. result, err := s.SignPayComplete(con, arg)
  257. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  258. ctx.So(err, convey.ShouldBeNil)
  259. ctx.So(result, convey.ShouldNotBeNil)
  260. })
  261. })
  262. })
  263. }
  264. func TestUpcrmserviceSignCheckExist(t *testing.T) {
  265. convey.Convey("SignCheckExist", t, func(ctx convey.C) {
  266. var (
  267. c = context.Background()
  268. arg = &signmodel.SignCheckExsitArg{}
  269. )
  270. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  271. result, err := s.SignCheckExist(c, arg)
  272. ctx.Convey("Then err should be nil.result should not be nil.", func(ctx convey.C) {
  273. ctx.So(err, convey.ShouldBeNil)
  274. ctx.So(result, convey.ShouldNotBeNil)
  275. })
  276. })
  277. })
  278. }