extra_test.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. package dao
  2. import (
  3. "context"
  4. "net/url"
  5. "testing"
  6. "go-common/app/admin/main/workflow/model"
  7. "go-common/app/admin/main/workflow/model/param"
  8. "go-common/library/ecode"
  9. "github.com/smartystreets/goconvey/convey"
  10. )
  11. func TestDaoBatchUperSpecial(t *testing.T) {
  12. convey.Convey("BatchUperSpecial", t, func(ctx convey.C) {
  13. var (
  14. c = context.Background()
  15. mids = []int64{27515256}
  16. )
  17. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  18. UperTagMap, err := d.BatchUperSpecial(c, mids)
  19. ctx.Convey("Then err should be nil.UperTagMap should not be nil.", func(ctx convey.C) {
  20. ctx.So(err, convey.ShouldBeNil)
  21. ctx.So(UperTagMap, convey.ShouldNotBeNil)
  22. })
  23. })
  24. })
  25. }
  26. func TestDaoArchiveRPC(t *testing.T) {
  27. convey.Convey("ArchiveRPC", t, func(ctx convey.C) {
  28. var (
  29. c = context.Background()
  30. oids = []int64{1}
  31. )
  32. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  33. archives, err := d.ArchiveRPC(c, oids)
  34. ctx.Convey("Then err should be nil.archives should not be nil.", func(ctx convey.C) {
  35. ctx.So(err, convey.ShouldBeNil)
  36. ctx.So(archives, convey.ShouldNotBeNil)
  37. })
  38. })
  39. })
  40. }
  41. func TestDaoTagList(t *testing.T) {
  42. convey.Convey("TagList", t, func(ctx convey.C) {
  43. var (
  44. c = context.Background()
  45. )
  46. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  47. tags, err := d.TagList(c)
  48. ctx.Convey("Then err should be nil.tags should not be nil.", func(ctx convey.C) {
  49. ctx.So(err, convey.ShouldBeNil)
  50. ctx.So(tags, convey.ShouldNotBeNil)
  51. })
  52. })
  53. })
  54. }
  55. func TestDaoCommonExtraInfo(t *testing.T) {
  56. convey.Convey("CommonExtraInfo", t, func(ctx convey.C) {
  57. var (
  58. c = context.Background()
  59. bid = int8(13)
  60. uri = "http://uat-manager.bilibili.co/x/admin/reply/internal/reply"
  61. ids = []int64{1}
  62. oids = []int64{1}
  63. eids = []int64{1}
  64. )
  65. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  66. data, err := d.CommonExtraInfo(c, bid, uri, ids, oids, eids)
  67. ctx.Convey("Then err should be nil.data should not be nil.", func(ctx convey.C) {
  68. ctx.So(err, convey.ShouldBeNil)
  69. ctx.So(data, convey.ShouldNotBeNil)
  70. })
  71. })
  72. })
  73. }
  74. func TestDaoAccountInfoRPC(t *testing.T) {
  75. convey.Convey("AccountInfoRPC", t, func(ctx convey.C) {
  76. var (
  77. c = context.Background()
  78. mids = []int64{1}
  79. )
  80. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  81. authors := d.AccountInfoRPC(c, mids)
  82. ctx.Convey("Then authors should not be nil.", func(ctx convey.C) {
  83. ctx.So(authors, convey.ShouldNotBeNil)
  84. })
  85. })
  86. })
  87. }
  88. func TestDaoAddMoral(t *testing.T) {
  89. convey.Convey("AddMoral", t, func(ctx convey.C) {
  90. var (
  91. c = context.Background()
  92. mids = []int64{1}
  93. gssp = &param.GroupStateSetParam{}
  94. )
  95. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  96. err := d.AddMoral(c, mids, gssp)
  97. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  98. ctx.So(err.Error(), convey.ShouldNotBeNil)
  99. })
  100. })
  101. })
  102. }
  103. func TestDaoAddBlock(t *testing.T) {
  104. convey.Convey("AddBlock", t, func(ctx convey.C) {
  105. var (
  106. c = context.Background()
  107. mids = []int64{1}
  108. gssp = &param.GroupStateSetParam{}
  109. )
  110. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  111. err := d.AddBlock(c, mids, gssp)
  112. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  113. ctx.So(err, convey.ShouldBeNil)
  114. })
  115. })
  116. })
  117. }
  118. func TestDaoAddCreditBlockInfo(t *testing.T) {
  119. convey.Convey("AddCreditBlockInfo", t, func(ctx convey.C) {
  120. var (
  121. c = context.Background()
  122. bus map[int64]*model.Business
  123. gssp = &param.GroupStateSetParam{}
  124. )
  125. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  126. err := d.AddCreditBlockInfo(c, bus, gssp)
  127. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  128. ctx.So(err, convey.ShouldBeNil)
  129. })
  130. })
  131. })
  132. }
  133. func TestDaoAddCreditCase(t *testing.T) {
  134. convey.Convey("AddCreditCase", t, func(ctx convey.C) {
  135. var (
  136. c = context.Background()
  137. uv url.Values
  138. )
  139. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  140. err := d.AddCreditCase(c, uv)
  141. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  142. ctx.So(err, convey.ShouldEqual, ecode.Int(56504))
  143. })
  144. })
  145. })
  146. }
  147. func TestDaoBlockNum(t *testing.T) {
  148. convey.Convey("BlockNum", t, func(ctx convey.C) {
  149. var (
  150. c = context.Background()
  151. mid = int64(1)
  152. )
  153. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  154. sum, err := d.BlockNum(c, mid)
  155. ctx.Convey("Then err should be nil.sum should not be nil.", func(ctx convey.C) {
  156. ctx.So(err, convey.ShouldBeNil)
  157. ctx.So(sum, convey.ShouldNotBeNil)
  158. })
  159. })
  160. })
  161. }
  162. func TestDaoBlockInfo(t *testing.T) {
  163. convey.Convey("BlockInfo", t, func(ctx convey.C) {
  164. var (
  165. c = context.Background()
  166. mid = int64(1)
  167. )
  168. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  169. resp, err := d.BlockInfo(c, mid)
  170. ctx.Convey("Then err should be nil.resp should not be nil.", func(ctx convey.C) {
  171. ctx.So(err, convey.ShouldBeNil)
  172. ctx.So(resp, convey.ShouldNotBeNil)
  173. })
  174. })
  175. })
  176. }