mng_test.go 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/admin/main/search/model"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoBusinessList(t *testing.T) {
  9. convey.Convey("BusinessList", t, func(ctx convey.C) {
  10. var (
  11. c = context.Background()
  12. name = ""
  13. offset = int(0)
  14. limit = int(0)
  15. )
  16. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  17. _, err := d.BusinessList(c, name, offset, limit)
  18. ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
  19. ctx.So(err, convey.ShouldBeNil)
  20. //ctx.So(list, convey.ShouldNotBeNil)
  21. })
  22. })
  23. })
  24. }
  25. func TestDaoBusinessTotal(t *testing.T) {
  26. convey.Convey("BusinessTotal", t, func(ctx convey.C) {
  27. var (
  28. c = context.Background()
  29. name = ""
  30. )
  31. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  32. total, err := d.BusinessTotal(c, name)
  33. ctx.Convey("Then err should be nil.total should not be nil.", func(ctx convey.C) {
  34. ctx.So(err, convey.ShouldBeNil)
  35. ctx.So(total, convey.ShouldNotBeNil)
  36. })
  37. })
  38. })
  39. }
  40. func TestDaoBusinessAll(t *testing.T) {
  41. convey.Convey("BusinessAll", t, func(ctx convey.C) {
  42. var (
  43. c = context.Background()
  44. )
  45. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  46. list, err := d.BusinessAll(c)
  47. ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
  48. ctx.So(err, convey.ShouldBeNil)
  49. ctx.So(list, convey.ShouldNotBeNil)
  50. })
  51. })
  52. })
  53. }
  54. func TestDaoAddBusiness(t *testing.T) {
  55. convey.Convey("AddBusiness", t, func(ctx convey.C) {
  56. //var (
  57. // c = context.Background()
  58. // b = &model.MngBusiness{}
  59. //)
  60. //ctx.Convey("When everything goes positive", func(ctx convey.C) {
  61. // id, _ := d.AddBusiness(c, b)
  62. // ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  63. // //ctx.So(err, convey.ShouldBeNil)
  64. // ctx.So(id, convey.ShouldNotBeNil)
  65. // })
  66. //})
  67. })
  68. }
  69. func TestDaoUpdateBusiness(t *testing.T) {
  70. convey.Convey("UpdateBusiness", t, func(ctx convey.C) {
  71. //var (
  72. // c = context.Background()
  73. // b = &model.MngBusiness{}
  74. //)
  75. //ctx.Convey("When everything goes positive", func(ctx convey.C) {
  76. // err := d.UpdateBusiness(c, b)
  77. // ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  78. // ctx.So(err, convey.ShouldBeNil)
  79. // })
  80. //})
  81. })
  82. }
  83. func TestDaoBusinessInfo(t *testing.T) {
  84. convey.Convey("BusinessInfo", t, func(ctx convey.C) {
  85. var (
  86. c = context.Background()
  87. id = int64(0)
  88. )
  89. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  90. _, err := d.BusinessInfo(c, id)
  91. ctx.Convey("Then err should be nil.info should not be nil.", func(ctx convey.C) {
  92. ctx.So(err, convey.ShouldBeNil)
  93. //ctx.So(info, convey.ShouldNotBeNil)
  94. })
  95. })
  96. })
  97. }
  98. func TestDaoBusinessInfoByName(t *testing.T) {
  99. convey.Convey("BusinessInfoByName", t, func(ctx convey.C) {
  100. var (
  101. c = context.Background()
  102. name = "log"
  103. )
  104. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  105. info, err := d.BusinessInfoByName(c, name)
  106. ctx.Convey("Then err should be nil.info should not be nil.", func(ctx convey.C) {
  107. ctx.So(err, convey.ShouldBeNil)
  108. ctx.So(info, convey.ShouldNotBeNil)
  109. })
  110. })
  111. })
  112. }
  113. func TestDaoAssetList(t *testing.T) {
  114. convey.Convey("AssetList", t, func(ctx convey.C) {
  115. var (
  116. c = context.Background()
  117. typ = int(0)
  118. name = ""
  119. offset = int(0)
  120. limit = int(0)
  121. )
  122. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  123. _, err := d.AssetList(c, typ, name, offset, limit)
  124. ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
  125. ctx.So(err, convey.ShouldBeNil)
  126. //ctx.So(list, convey.ShouldNotBeNil)
  127. })
  128. })
  129. })
  130. }
  131. func TestDaoAssetTotal(t *testing.T) {
  132. convey.Convey("AssetTotal", t, func(ctx convey.C) {
  133. var (
  134. c = context.Background()
  135. typ = int(0)
  136. name = ""
  137. )
  138. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  139. total, err := d.AssetTotal(c, typ, name)
  140. ctx.Convey("Then err should be nil.total should not be nil.", func(ctx convey.C) {
  141. ctx.So(err, convey.ShouldBeNil)
  142. ctx.So(total, convey.ShouldNotBeNil)
  143. })
  144. })
  145. })
  146. }
  147. func TestDaoAssetAll(t *testing.T) {
  148. convey.Convey("AssetAll", t, func(ctx convey.C) {
  149. var (
  150. c = context.Background()
  151. )
  152. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  153. list, err := d.AssetAll(c)
  154. ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
  155. ctx.So(err, convey.ShouldBeNil)
  156. ctx.So(list, convey.ShouldNotBeNil)
  157. })
  158. })
  159. })
  160. }
  161. func TestDaoAssetInfo(t *testing.T) {
  162. convey.Convey("AssetInfo", t, func(ctx convey.C) {
  163. var (
  164. c = context.Background()
  165. id = int64(0)
  166. )
  167. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  168. _, err := d.AssetInfo(c, id)
  169. ctx.Convey("Then err should be nil.info should not be nil.", func(ctx convey.C) {
  170. ctx.So(err, convey.ShouldBeNil)
  171. //ctx.So(info, convey.ShouldNotBeNil)
  172. })
  173. })
  174. })
  175. }
  176. func TestDaoAssetInfoByName(t *testing.T) {
  177. convey.Convey("AssetInfoByName", t, func(ctx convey.C) {
  178. var (
  179. c = context.Background()
  180. name = ""
  181. )
  182. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  183. info, err := d.AssetInfoByName(c, name)
  184. ctx.Convey("Then err should be nil.info should not be nil.", func(ctx convey.C) {
  185. ctx.So(err, convey.ShouldBeNil)
  186. ctx.So(info, convey.ShouldNotBeNil)
  187. })
  188. })
  189. })
  190. }
  191. func TestDaoAddAsset(t *testing.T) {
  192. convey.Convey("AddAsset", t, func(ctx convey.C) {
  193. //var (
  194. // c = context.Background()
  195. // b = &model.MngAsset{}
  196. //)
  197. //ctx.Convey("When everything goes positive", func(ctx convey.C) {
  198. // //id, err :=
  199. // d.AddAsset(c, b)
  200. // ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  201. // //ctx.So(err, convey.ShouldBeNil)
  202. // //ctx.So(id, convey.ShouldNotBeNil)
  203. // })
  204. //})
  205. })
  206. }
  207. func TestDaoUpdateAsset(t *testing.T) {
  208. convey.Convey("UpdateAsset", t, func(ctx convey.C) {
  209. //var (
  210. // c = context.Background()
  211. // b = &model.MngAsset{}
  212. //)
  213. //ctx.Convey("When everything goes positive", func(ctx convey.C) {
  214. // err := d.UpdateAsset(c, b)
  215. // ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  216. // ctx.So(err, convey.ShouldBeNil)
  217. // })
  218. //})
  219. })
  220. }
  221. func TestDaoAppList(t *testing.T) {
  222. convey.Convey("AppList", t, func(ctx convey.C) {
  223. var (
  224. c = context.Background()
  225. business = ""
  226. )
  227. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  228. list, err := d.AppList(c, business)
  229. ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
  230. ctx.So(err, convey.ShouldBeNil)
  231. ctx.So(list, convey.ShouldNotBeNil)
  232. })
  233. })
  234. })
  235. }
  236. func TestDaoAppInfo(t *testing.T) {
  237. convey.Convey("AppInfo", t, func(ctx convey.C) {
  238. var (
  239. c = context.Background()
  240. id = int64(0)
  241. )
  242. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  243. //a, err :=
  244. d.AppInfo(c, id)
  245. ctx.Convey("Then err should be nil.a should not be nil.", func(ctx convey.C) {
  246. //ctx.So(err, convey.ShouldBeNil)
  247. //ctx.So(a, convey.ShouldNotBeNil)
  248. })
  249. })
  250. })
  251. }
  252. func TestDaoAppInfoByAppid(t *testing.T) {
  253. convey.Convey("AppInfoByAppid", t, func(ctx convey.C) {
  254. var (
  255. c = context.Background()
  256. appid = ""
  257. )
  258. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  259. _, err := d.AppInfoByAppid(c, appid)
  260. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  261. ctx.So(err, convey.ShouldBeNil)
  262. })
  263. })
  264. })
  265. }
  266. func TestDaoAddApp(t *testing.T) {
  267. convey.Convey("AddApp", t, func(ctx convey.C) {
  268. //var (
  269. // c = context.Background()
  270. // a = &model.MngApp{}
  271. //)
  272. //ctx.Convey("When everything goes positive", func(ctx convey.C) {
  273. // id, err :=
  274. // d.AddApp(c, a)
  275. // ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  276. // ctx.So(err, convey.ShouldBeNil)
  277. // ctx.So(id, convey.ShouldNotBeNil)
  278. // })
  279. //})
  280. })
  281. }
  282. func TestDaoUpdateApp(t *testing.T) {
  283. convey.Convey("UpdateApp", t, func(ctx convey.C) {
  284. //var (
  285. // c = context.Background()
  286. // a = &model.MngApp{}
  287. //)
  288. //ctx.Convey("When everything goes positive", func(ctx convey.C) {
  289. // err := d.UpdateApp(c, a)
  290. // ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  291. // ctx.So(err, convey.ShouldBeNil)
  292. // })
  293. //})
  294. })
  295. }
  296. func TestDaoUpdateAppAssetTable(t *testing.T) {
  297. convey.Convey("UpdateAppAssetTable", t, func(ctx convey.C) {
  298. //var (
  299. // c = context.Background()
  300. // name = ""
  301. // no = &model.MngAssetTable{}
  302. //)
  303. //ctx.Convey("When everything goes positive", func(ctx convey.C) {
  304. // err := d.UpdateAppAssetTable(c, name, no)
  305. // ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  306. // ctx.So(err, convey.ShouldBeNil)
  307. // })
  308. //})
  309. })
  310. }
  311. func TestDaoUpdateAppAssetDatabus(t *testing.T) {
  312. convey.Convey("UpdateAppAssetDatabus", t, func(ctx convey.C) {
  313. //var (
  314. // c = context.Background()
  315. // name = ""
  316. // v = &model.MngAssetDatabus{}
  317. //)
  318. //ctx.Convey("When everything goes positive", func(ctx convey.C) {
  319. // err := d.UpdateAppAssetDatabus(c, name, v)
  320. // ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  321. // ctx.So(err, convey.ShouldBeNil)
  322. // })
  323. //})
  324. })
  325. }
  326. func TestDaoMngCount(t *testing.T) {
  327. convey.Convey("MngCount", t, func(ctx convey.C) {
  328. var (
  329. c = context.Background()
  330. v = &model.MngCount{}
  331. )
  332. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  333. list, err := d.MngCount(c, v)
  334. ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
  335. ctx.So(err, convey.ShouldBeNil)
  336. ctx.So(list, convey.ShouldNotBeNil)
  337. })
  338. })
  339. })
  340. }
  341. func TestDaoMngPercent(t *testing.T) {
  342. convey.Convey("MngPercent", t, func(ctx convey.C) {
  343. var (
  344. c = context.Background()
  345. v = &model.MngCount{}
  346. )
  347. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  348. list, err := d.MngPercent(c, v)
  349. ctx.Convey("Then err should be nil.list should not be nil.", func(ctx convey.C) {
  350. ctx.So(err, convey.ShouldBeNil)
  351. ctx.So(list, convey.ShouldNotBeNil)
  352. })
  353. })
  354. })
  355. }
  356. func TestDaoUnames(t *testing.T) {
  357. convey.Convey("Unames", t, func(ctx convey.C) {
  358. var (
  359. c = context.Background()
  360. uids = []string{}
  361. )
  362. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  363. res, err := d.Unames(c, uids)
  364. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  365. ctx.So(err, convey.ShouldBeNil)
  366. ctx.So(res, convey.ShouldNotBeNil)
  367. })
  368. })
  369. })
  370. }