jury_test.go 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. credit "go-common/app/interface/main/credit/model"
  6. . "github.com/smartystreets/goconvey/convey"
  7. )
  8. // TestSpJuryCase .
  9. func TestSpJuryCase(t *testing.T) {
  10. Convey("TestSpJuryCase", t, func() {
  11. mid := int64(27515259)
  12. cid := int64(797)
  13. bc, err := s.SpJuryCase(context.TODO(), mid, cid)
  14. So(err, ShouldBeNil)
  15. So(bc, ShouldNotBeNil)
  16. })
  17. }
  18. // TestVoteInfoMID .
  19. func TestVoteInfoMID(t *testing.T) {
  20. Convey("TestVoteInfoMID", t, func() {
  21. mid := int64(27515259)
  22. cid := int64(797)
  23. bc, err := s.VoteInfoCache(context.TODO(), mid, cid)
  24. So(err, ShouldBeNil)
  25. So(bc, ShouldNotBeNil)
  26. })
  27. }
  28. // TestObtainCase .
  29. func TestObtainCase(t *testing.T) {
  30. Convey("TestObtainCase", t, func() {
  31. mid := int64(88889018)
  32. cid, err := s.caseVoteID(context.TODO(), mid, 0)
  33. So(err, ShouldBeNil)
  34. So(cid, ShouldNotBeNil)
  35. })
  36. }
  37. // TestServiceApply
  38. func TestServiceApply(t *testing.T) {
  39. Convey("TestServiceApply", t, func() {
  40. var (
  41. mid int64 = 2089809
  42. c = context.TODO()
  43. )
  44. err := s.Apply(c, mid)
  45. So(err, ShouldBeNil)
  46. })
  47. }
  48. // TestServiceRequirement
  49. func TestServiceRequirement(t *testing.T) {
  50. Convey("TestServiceApply", t, func() {
  51. var (
  52. mid int64 = 88889019
  53. c = context.TODO()
  54. )
  55. jr, err := s.Requirement(c, mid)
  56. So(err, ShouldBeNil)
  57. So(jr, ShouldNotBeNil)
  58. })
  59. }
  60. // TestServiceJury
  61. func TestServiceJury(t *testing.T) {
  62. Convey("TestServiceJury", t, func() {
  63. var (
  64. mid int64 = 27515274
  65. c = context.TODO()
  66. )
  67. res, err := s.Jury(c, mid)
  68. So(err, ShouldBeNil)
  69. So(res, ShouldNotBeNil)
  70. })
  71. }
  72. // TestServiceCaseObtain
  73. func TestServiceCaseObtain(t *testing.T) {
  74. Convey("TestServiceJury", t, func() {
  75. var (
  76. mid int64 = 21432418
  77. c = context.TODO()
  78. )
  79. cid, err := s.CaseObtain(c, mid, 308)
  80. So(err, ShouldBeNil)
  81. So(cid, ShouldNotBeNil)
  82. })
  83. }
  84. // TestServiceVote .
  85. func TestServiceVote(t *testing.T) {
  86. Convey("TestServiceVote", t, func() {
  87. var (
  88. mid int64 = 9
  89. cid int64 = 1
  90. v int8 = 2
  91. c = context.TODO()
  92. )
  93. err := s.Vote(c, mid, cid, v, 1, 1, 1, "", []int64{1, 2, 3}, []int64{4, 5, 6})
  94. So(err, ShouldBeNil)
  95. })
  96. }
  97. func TestServiceVoteInfo(t *testing.T) {
  98. Convey("TestServiceVoteInfo", t, func() {
  99. var (
  100. mid int64 = 9
  101. cid int64 = 1
  102. c = context.TODO()
  103. )
  104. res, err := s.VoteInfo(c, mid, cid)
  105. So(err, ShouldBeNil)
  106. So(res, ShouldNotBeNil)
  107. })
  108. }
  109. func TestServiceCaseInfo(t *testing.T) {
  110. Convey("TestServiceCaseInfo", t, func() {
  111. var (
  112. c = context.TODO()
  113. cid int64 = 304
  114. )
  115. res, err := s.CaseInfo(c, cid)
  116. So(err, ShouldBeNil)
  117. So(res, ShouldNotBeNil)
  118. })
  119. }
  120. func TestServiceJuryCase(t *testing.T) {
  121. Convey("TestServiceJuryCase", t, func() {
  122. var (
  123. mid int64 = 27515274
  124. cid int64 = 708
  125. c = context.TODO()
  126. )
  127. res, err := s.JuryCase(c, mid, cid)
  128. So(err, ShouldBeNil)
  129. So(res, ShouldNotBeNil)
  130. })
  131. }
  132. func TestServiceCaseList(t *testing.T) {
  133. Convey("TestServiceCaseList", t, func() {
  134. var (
  135. mid int64 = 21432418
  136. pn int64 = 1
  137. ps int64 = 10
  138. c = context.TODO()
  139. )
  140. res, err := s.CaseList(c, mid, ps, pn)
  141. So(err, ShouldBeNil)
  142. So(res, ShouldNotBeNil)
  143. })
  144. }
  145. func TestService_KPIList(t *testing.T) {
  146. Convey("TestService_KPIList", t, func() {
  147. var (
  148. err error
  149. c = context.TODO()
  150. res []*credit.KPI
  151. )
  152. res, err = s.KPIList(c, 88889017)
  153. So(err, ShouldBeNil)
  154. So(res, ShouldNotBeNil)
  155. })
  156. }
  157. func TestCaseOpinion(t *testing.T) {
  158. Convey("TestCaseOpinion", t, func() {
  159. res, _, err := s.CaseOpinion(context.TODO(), 679, 1, 3)
  160. So(err, ShouldBeNil)
  161. So(res, ShouldNotBeNil)
  162. })
  163. }
  164. func TestVoteOpinion(t *testing.T) {
  165. Convey("TestVoteOpinion", t, func() {
  166. res, _, err := s.VoteOpinion(context.TODO(), 679, 1, 3, 1)
  167. So(err, ShouldBeNil)
  168. So(res, ShouldNotBeNil)
  169. })
  170. }
  171. func TestAddBlockedCases(t *testing.T) {
  172. Convey("TestVoteOpinion", t, func() {
  173. var (
  174. bc []*credit.ArgJudgeCase
  175. b = &credit.ArgJudgeCase{}
  176. b1 = &credit.ArgJudgeCase{}
  177. )
  178. b.MID = 1
  179. b.Operator = "a"
  180. b.OContent = "'aaaaa,"
  181. b.PunishResult = 1
  182. b.OTitle = "ot"
  183. b.OType = 1
  184. b.OURL = "ou"
  185. b.BlockedDays = 1
  186. b.ReasonType = 1
  187. b.RelationID = "1-1"
  188. b.RPID = 11
  189. b.Type = 1
  190. b.OID = 1111
  191. b.MID = 1
  192. b1.Operator = "b"
  193. b1.OContent = ",'bbbbb'''"
  194. b1.PunishResult = 2
  195. b1.OTitle = "ot"
  196. b1.OType = 1
  197. b1.OURL = "ou"
  198. b1.BlockedDays = 2
  199. b1.ReasonType = 2
  200. b1.RelationID = "1-1"
  201. b1.RPID = 22
  202. b1.Type = 2
  203. b1.OID = 22222
  204. bc = append(bc, b)
  205. bc = append(bc, b1)
  206. err := s.AddBlockedCases(context.TODO(), bc)
  207. So(err, ShouldBeNil)
  208. })
  209. }
  210. func TestCaseObtainByID(t *testing.T) {
  211. Convey("TestVoteOpinion", t, func() {
  212. var (
  213. c = context.TODO()
  214. )
  215. err := s.CaseObtainByID(c, 88889018, 309)
  216. So(err, ShouldBeNil)
  217. })
  218. }