medal_test.go 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. package service
  2. import (
  3. "context"
  4. "fmt"
  5. "go-common/app/admin/main/usersuit/model"
  6. "testing"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestService_Medal(t *testing.T) {
  10. Convey("return sth", t, func() {
  11. res, err := s.Medal(context.Background())
  12. for k, re := range res {
  13. fmt.Printf("%d %+v \n", k, re)
  14. }
  15. So(err, ShouldBeNil)
  16. So(res, ShouldNotBeNil)
  17. })
  18. }
  19. func TestService_MedalView(t *testing.T) {
  20. Convey("return sth", t, func() {
  21. res, err := s.MedalView(context.Background(), 3)
  22. fmt.Printf("%+v \n", res)
  23. So(err, ShouldBeNil)
  24. So(res, ShouldNotBeNil)
  25. })
  26. }
  27. func TestService_AddMedal(t *testing.T) {
  28. Convey("return sth", t, func() {
  29. np := &model.Medal{
  30. Name: "出道偶像",
  31. Description: "播放五十万,准备发新单",
  32. Condition: "所有自制视频总播放数>=50万",
  33. GID: 4,
  34. Level: int8(2),
  35. Sort: 2,
  36. LevelRank: "50万",
  37. IsOnline: 1,
  38. Image: "/bfs/face/3f2d64f048b39fb6c26f3db39df47e6080ec0f9c.png",
  39. ImageSmall: "/bfs/face/90c35d41d8a19b19474d6bac672394c17b444ce8.png",
  40. }
  41. err := s.AddMedal(context.Background(), np)
  42. fmt.Printf("%+v \n", err)
  43. So(err, ShouldBeNil)
  44. })
  45. }
  46. func TestService_UpMedal(t *testing.T) {
  47. Convey("return sth", t, func() {
  48. np := &model.Medal{
  49. Name: "出道偶像111",
  50. Description: "播放五十万,准备发新单",
  51. Condition: "所有自制视频总播放数>=50万",
  52. GID: 4,
  53. Level: int8(2),
  54. Sort: 2,
  55. LevelRank: "50万",
  56. IsOnline: 1,
  57. Image: "/bfs/face/3f2d64f048b39fb6c26f3db39df47e6080ec0f9c.png",
  58. ImageSmall: "/bfs/face/90c35d41d8a19b19474d6bac672394c17b444ce8.png",
  59. }
  60. err := s.UpMedal(context.Background(), 1, np)
  61. fmt.Printf("%+v \n", err)
  62. So(err, ShouldBeNil)
  63. })
  64. }
  65. func TestService_MedalGroup(t *testing.T) {
  66. Convey("return someting", t, func() {
  67. res, err := s.MedalGroup(context.Background())
  68. for k, re := range res {
  69. fmt.Printf("%d %+v \n", k, re)
  70. }
  71. So(err, ShouldBeNil)
  72. So(res, ShouldNotBeNil)
  73. })
  74. }
  75. func TestService_MedalGroupInfo(t *testing.T) {
  76. Convey("return someting", t, func() {
  77. res, err := s.MedalGroupInfo(context.Background())
  78. for k, re := range res {
  79. fmt.Printf("%d %+v \n", k, re)
  80. }
  81. So(err, ShouldBeNil)
  82. So(res, ShouldNotBeNil)
  83. })
  84. }
  85. func TestService_MedalGroupParent(t *testing.T) {
  86. Convey("return someting", t, func() {
  87. res, err := s.MedalGroupParent(context.Background())
  88. for k, re := range res {
  89. fmt.Printf("%d %+v \n", k, re)
  90. }
  91. So(err, ShouldBeNil)
  92. So(res, ShouldNotBeNil)
  93. })
  94. }
  95. func TestService_MedalGroupByID(t *testing.T) {
  96. Convey("return someting", t, func() {
  97. re, err := s.MedalGroupByGid(context.Background(), 2)
  98. So(err, ShouldBeNil)
  99. So(re, ShouldNotBeNil)
  100. fmt.Printf("%+v \n", re)
  101. })
  102. }
  103. func TestService_MedalGroupAdd(t *testing.T) {
  104. Convey("return someting", t, func() {
  105. pg := &model.MedalGroup{
  106. Name: "test",
  107. PID: 1,
  108. Rank: int8(1),
  109. IsOnline: int8(1),
  110. }
  111. err := s.MedalGroupAdd(context.Background(), pg)
  112. So(err, ShouldBeNil)
  113. fmt.Printf("%+v \n", err)
  114. })
  115. }
  116. func TestService_MedalGroupUp(t *testing.T) {
  117. Convey("return someting", t, func() {
  118. pg := &model.MedalGroup{
  119. Name: "test222",
  120. PID: 2,
  121. Rank: 2,
  122. IsOnline: 0,
  123. }
  124. err := s.MedalGroupUp(context.Background(), 37, pg)
  125. So(err, ShouldBeNil)
  126. fmt.Printf("%+v \n", err)
  127. })
  128. }
  129. func TestService_MedalOwner(t *testing.T) {
  130. Convey("return someting", t, func() {
  131. res, err := s.MedalOwner(context.Background(), 111)
  132. for k, re := range res {
  133. fmt.Printf("%d %+v \n", k, re)
  134. }
  135. fmt.Printf("err:%+v \n", err)
  136. So(err, ShouldBeNil)
  137. So(res, ShouldNotBeNil)
  138. })
  139. }
  140. func TestService_MedalOwnerAdd(t *testing.T) {
  141. Convey("return someting", t, func() {
  142. err := s.MedalOwnerAdd(context.Background(), 41, 1, "", "", 1)
  143. fmt.Printf("%+v \n", err)
  144. So(err, ShouldBeNil)
  145. })
  146. }
  147. func TestService_MedalAddList(t *testing.T) {
  148. Convey("return someting", t, func() {
  149. res, err := s.MedalOwnerAddList(context.Background(), 1)
  150. for k, re := range res {
  151. fmt.Printf("%d %+v \n", k, re)
  152. }
  153. So(err, ShouldBeNil)
  154. So(res, ShouldNotBeNil)
  155. })
  156. }
  157. func TestService_MedalOwnerUpActivated(t *testing.T) {
  158. Convey("return someting", t, func() {
  159. err := s.MedalOwnerUpActivated(context.Background(), 1, 1)
  160. fmt.Printf("%+v \n", err)
  161. So(err, ShouldBeNil)
  162. })
  163. }
  164. func TestService_MedalOwnerDel(t *testing.T) {
  165. Convey("return someting", t, func() {
  166. err := s.MedalOwnerDel(context.Background(), 1, 5, 0, "", "")
  167. fmt.Printf("%+v \n", err)
  168. So(err, ShouldBeNil)
  169. })
  170. }