up_info_test.go 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. package service
  2. import (
  3. "context"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. )
  7. func Test_QueryFromUpInfo(t *testing.T) {
  8. var (
  9. accType = 3
  10. states = []int64{int64(1)}
  11. mid = int64(1011)
  12. category = 1
  13. signType = 1
  14. nickname = "hello"
  15. lower, upper = 0, 100
  16. from, limit = 0, 1000
  17. sort = "ctime"
  18. )
  19. Convey("admins", t, WithService(func(s *Service) {
  20. _, _, err := s.QueryFromUpInfo(context.Background(), 0, accType, states, mid, category, signType, nickname, lower, upper, from, limit, sort)
  21. So(err, ShouldBeNil)
  22. }))
  23. }
  24. func Test_Reject(t *testing.T) {
  25. var (
  26. mids = []int64{int64(1101)}
  27. reason = "reject"
  28. days = 1
  29. )
  30. Convey("admins", t, WithService(func(s *Service) {
  31. err := s.Reject(context.Background(), 0, mids, reason, days)
  32. So(err, ShouldBeNil)
  33. }))
  34. }
  35. func Test_Pass(t *testing.T) {
  36. var (
  37. mids = []int64{int64(1101)}
  38. )
  39. Convey("admins", t, WithService(func(s *Service) {
  40. err := s.Pass(context.Background(), mids, 0)
  41. So(err, ShouldBeNil)
  42. }))
  43. }
  44. func Test_Dismiss(t *testing.T) {
  45. var (
  46. operator = "user"
  47. mid = int64(1101)
  48. reason = "dismiss"
  49. )
  50. Convey("admins", t, WithService(func(s *Service) {
  51. err := s.Dismiss(context.Background(), operator, 0, 3, mid, reason)
  52. So(err, ShouldBeNil)
  53. }))
  54. }
  55. func Test_Forbid(t *testing.T) {
  56. var (
  57. operator = "user"
  58. mid = int64(1101)
  59. reason = "dismiss"
  60. days = 5
  61. )
  62. Convey("admins", t, WithService(func(s *Service) {
  63. err := s.Forbid(context.Background(), operator, 0, 3, mid, reason, days, 100)
  64. So(err, ShouldBeNil)
  65. }))
  66. }
  67. func Test_Recovery(t *testing.T) {
  68. var (
  69. mid = int64(1101)
  70. )
  71. Convey("admins", t, WithService(func(s *Service) {
  72. err := s.Recovery(context.Background(), mid)
  73. So(err, ShouldBeNil)
  74. }))
  75. }
  76. func Test_UpdateUpAccountState(t *testing.T) {
  77. var (
  78. mid = int64(1101)
  79. state = 3
  80. )
  81. Convey("admins", t, WithService(func(s *Service) {
  82. err := s.UpdateUpAccountState(context.Background(), "up_info_video", mid, state)
  83. So(err, ShouldBeNil)
  84. }))
  85. }
  86. func Test_DeleteUp(t *testing.T) {
  87. var (
  88. mid = int64(1101)
  89. )
  90. Convey("admins", t, WithService(func(s *Service) {
  91. err := s.DeleteUp(context.Background(), mid)
  92. So(err, ShouldBeNil)
  93. }))
  94. }
  95. func Test_Block(t *testing.T) {
  96. var (
  97. mid = int64(1101)
  98. )
  99. Convey("admins", t, WithService(func(s *Service) {
  100. err := s.Block(context.Background(), mid)
  101. So(err, ShouldBeNil)
  102. }))
  103. }
  104. func Test_QueryFromBlocked(t *testing.T) {
  105. var (
  106. mid = int64(1011)
  107. category = 1
  108. nickname = "hello"
  109. lower, upper = 0, 100
  110. from, limit = 0, 1000
  111. sort = "ctime"
  112. )
  113. Convey("admins", t, WithService(func(s *Service) {
  114. _, _, err := s.QueryFromBlocked(context.Background(), mid, category, nickname, lower, upper, from, limit, sort)
  115. So(err, ShouldBeNil)
  116. }))
  117. }
  118. func Test_DeleteFromBlocked(t *testing.T) {
  119. var (
  120. mid = int64(1101)
  121. )
  122. Convey("admins", t, WithService(func(s *Service) {
  123. err := s.DeleteFromBlocked(context.Background(), mid)
  124. So(err, ShouldBeNil)
  125. }))
  126. }
  127. func Test_DelUpAccount(t *testing.T) {
  128. var (
  129. mid = int64(1101)
  130. )
  131. Convey("admins", t, WithService(func(s *Service) {
  132. err := s.DelUpAccount(context.Background(), mid)
  133. So(err, ShouldBeNil)
  134. }))
  135. }
  136. func Test_CreditRecords(t *testing.T) {
  137. var (
  138. mid = int64(1101)
  139. )
  140. Convey("admins", t, WithService(func(s *Service) {
  141. _, err := s.CreditRecords(context.Background(), mid)
  142. So(err, ShouldBeNil)
  143. }))
  144. }
  145. func Test_RecoverCreditScore(t *testing.T) {
  146. var (
  147. id, mid int64 = 1, 1011
  148. )
  149. Convey("admins", t, WithService(func(s *Service) {
  150. err := s.RecoverCreditScore(context.Background(), 0, id, mid)
  151. So(err, ShouldBeNil)
  152. }))
  153. }
  154. func Test_ExportUps(t *testing.T) {
  155. var (
  156. accType = 3
  157. states = []int64{int64(1)}
  158. mid = int64(1011)
  159. category = 1
  160. signType = 1
  161. nickname = "hello"
  162. lower, upper = 0, 100
  163. from, limit = 0, 1000
  164. sort = "ctime"
  165. )
  166. Convey("admins", t, WithService(func(s *Service) {
  167. _, err := s.ExportUps(context.Background(), 0, accType, states, mid, category, signType, nickname, lower, upper, from, limit, sort)
  168. So(err, ShouldBeNil)
  169. }))
  170. }