mng_v2_test.go 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoBusinessAllV2(t *testing.T) {
  8. convey.Convey("BusinessAllV2", t, func(convCtx convey.C) {
  9. var (
  10. c = context.Background()
  11. )
  12. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  13. list, err := d.BusinessAllV2(c)
  14. convCtx.Convey("Then err should be nil.list should not be nil.", func(convCtx convey.C) {
  15. convCtx.So(err, convey.ShouldBeNil)
  16. convCtx.So(list, convey.ShouldNotBeNil)
  17. })
  18. })
  19. })
  20. }
  21. func TestDaoBusinessInfoV2(t *testing.T) {
  22. convey.Convey("BusinessInfoV2", t, func(convCtx convey.C) {
  23. var (
  24. c = context.Background()
  25. name = "dm"
  26. )
  27. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  28. b, err := d.BusinessInfoV2(c, name)
  29. convCtx.Convey("Then err should be nil.b should not be nil.", func(convCtx convey.C) {
  30. convCtx.So(err, convey.ShouldBeNil)
  31. convCtx.So(b, convey.ShouldNotBeNil)
  32. })
  33. })
  34. })
  35. }
  36. //func TestDaoBusinessIns(t *testing.T) {
  37. // convey.Convey("BusinessIns", t, func(convCtx convey.C) {
  38. // var (
  39. // c = context.Background()
  40. // pid = int64(0)
  41. // name = ""
  42. // description = ""
  43. // )
  44. // convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  45. // rows, err := d.BusinessIns(c, pid, name, description)
  46. // convCtx.Convey("Then err should be nil.rows should not be nil.", func(convCtx convey.C) {
  47. // convCtx.So(err, convey.ShouldBeNil)
  48. // convCtx.So(rows, convey.ShouldNotBeNil)
  49. // })
  50. // })
  51. // })
  52. //}
  53. //func TestDaoBusinessUpdate(t *testing.T) {
  54. // convey.Convey("BusinessUpdate", t, func(convCtx convey.C) {
  55. // var (
  56. // c = context.Background()
  57. // name = ""
  58. // field = ""
  59. // value = ""
  60. // )
  61. // convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  62. // rows, err := d.BusinessUpdate(c, name, field, value)
  63. // convCtx.Convey("Then err should be nil.rows should not be nil.", func(convCtx convey.C) {
  64. // convCtx.So(err, convey.ShouldBeNil)
  65. // convCtx.So(rows, convey.ShouldNotBeNil)
  66. // })
  67. // })
  68. // })
  69. //}
  70. func TestDaoAssetDBTables(t *testing.T) {
  71. convey.Convey("AssetDBTables", t, func(convCtx convey.C) {
  72. var (
  73. c = context.Background()
  74. )
  75. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  76. list, err := d.AssetDBTables(c)
  77. convCtx.Convey("Then err should be nil.list should not be nil.", func(convCtx convey.C) {
  78. convCtx.So(err, convey.ShouldBeNil)
  79. convCtx.So(list, convey.ShouldNotBeNil)
  80. })
  81. })
  82. })
  83. }
  84. //
  85. //func TestDaoAssetDBIns(t *testing.T) {
  86. // convey.Convey("AssetDBIns", t, func(convCtx convey.C) {
  87. // var (
  88. // c = context.Background()
  89. // name = ""
  90. // description = ""
  91. // dsn = ""
  92. // )
  93. // convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  94. // rows, err := d.AssetDBIns(c, name, description, dsn)
  95. // convCtx.Convey("Then err should be nil.rows should not be nil.", func(convCtx convey.C) {
  96. // convCtx.So(err, convey.ShouldBeNil)
  97. // convCtx.So(rows, convey.ShouldNotBeNil)
  98. // })
  99. // })
  100. // })
  101. //}
  102. //func TestDaoAssetTableIns(t *testing.T) {
  103. // convey.Convey("AssetTableIns", t, func(convCtx convey.C) {
  104. // var (
  105. // c = context.Background()
  106. // name = ""
  107. // db = ""
  108. // regex = ""
  109. // fields = ""
  110. // description = ""
  111. // )
  112. // convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  113. // rows, err := d.AssetTableIns(c, name, db, regex, fields, description)
  114. // convCtx.Convey("Then err should be nil.rows should not be nil.", func(convCtx convey.C) {
  115. // convCtx.So(err, convey.ShouldBeNil)
  116. // convCtx.So(rows, convey.ShouldNotBeNil)
  117. // })
  118. // })
  119. // })
  120. //}
  121. func TestDaoAsset(t *testing.T) {
  122. convey.Convey("Asset", t, func(convCtx convey.C) {
  123. var (
  124. c = context.Background()
  125. name = "bilibili_article"
  126. )
  127. convCtx.Convey("When everything goes positive", func(convCtx convey.C) {
  128. r, err := d.Asset(c, name)
  129. convCtx.Convey("Then err should be nil.r should not be nil.", func(convCtx convey.C) {
  130. convCtx.So(err, convey.ShouldBeNil)
  131. convCtx.So(r, convey.ShouldNotBeNil)
  132. })
  133. })
  134. })
  135. }