business_test.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoinit(t *testing.T) {
  8. convey.Convey("init", t, func(ctx convey.C) {
  9. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  10. ctx.Convey("No return values", func(ctx convey.C) {
  11. })
  12. })
  13. })
  14. }
  15. func TestDaoBatchLastBusRecIDs(t *testing.T) {
  16. convey.Convey("BatchLastBusRecIDs", t, func(ctx convey.C) {
  17. var (
  18. c = context.Background()
  19. oids = []int64{1}
  20. business = int8(1)
  21. )
  22. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  23. bids, err := d.BatchLastBusRecIDs(c, oids, business)
  24. ctx.Convey("Then err should be nil.bids should not be nil.", func(ctx convey.C) {
  25. ctx.So(err, convey.ShouldBeNil)
  26. ctx.So(bids, convey.ShouldNotBeNil)
  27. })
  28. })
  29. })
  30. }
  31. func TestDaoBusinessRecs(t *testing.T) {
  32. convey.Convey("BusinessRecs", t, func(ctx convey.C) {
  33. var (
  34. c = context.Background()
  35. bids = []int64{1}
  36. )
  37. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  38. bs, err := d.BusinessRecs(c, bids)
  39. ctx.Convey("Then err should be nil.bs should not be nil.", func(ctx convey.C) {
  40. ctx.So(err, convey.ShouldBeNil)
  41. ctx.So(bs, convey.ShouldNotBeNil)
  42. })
  43. })
  44. })
  45. }
  46. func TestDaoLastBusRec(t *testing.T) {
  47. convey.Convey("LastBusRec", t, func(ctx convey.C) {
  48. var (
  49. c = context.Background()
  50. business = int8(1)
  51. oid = int64(1)
  52. )
  53. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  54. bs, err := d.LastBusRec(c, business, oid)
  55. ctx.Convey("Then err should be nil.bs should not be nil.", func(ctx convey.C) {
  56. ctx.So(err, convey.ShouldBeNil)
  57. ctx.So(bs, convey.ShouldNotBeNil)
  58. })
  59. })
  60. })
  61. }
  62. func TestDaoBatchBusRecByCids(t *testing.T) {
  63. convey.Convey("BatchBusRecByCids", t, func(ctx convey.C) {
  64. var (
  65. c = context.Background()
  66. cids = []int64{1}
  67. )
  68. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  69. cidToBus, err := d.BatchBusRecByCids(c, cids)
  70. ctx.Convey("Then err should be nil.cidToBus should not be nil.", func(ctx convey.C) {
  71. ctx.So(err, convey.ShouldBeNil)
  72. ctx.So(cidToBus, convey.ShouldNotBeNil)
  73. })
  74. })
  75. })
  76. }
  77. func TestDaoBusObjectByGids(t *testing.T) {
  78. convey.Convey("BusObjectByGids", t, func(ctx convey.C) {
  79. var (
  80. c = context.Background()
  81. gids = []int64{1}
  82. )
  83. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  84. gidToBus, err := d.BusObjectByGids(c, gids)
  85. ctx.Convey("Then err should be nil.gidToBus should not be nil.", func(ctx convey.C) {
  86. ctx.So(err, convey.ShouldBeNil)
  87. ctx.So(gidToBus, convey.ShouldNotBeNil)
  88. })
  89. })
  90. })
  91. }
  92. func TestDaoAllMetas(t *testing.T) {
  93. convey.Convey("AllMetas", t, func(ctx convey.C) {
  94. var (
  95. c = context.Background()
  96. )
  97. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  98. p1 := d.AllMetas(c)
  99. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  100. ctx.So(p1, convey.ShouldNotBeNil)
  101. })
  102. })
  103. })
  104. }
  105. func TestDaoLoadRole(t *testing.T) {
  106. convey.Convey("LoadRole", t, func(ctx convey.C) {
  107. var (
  108. c = context.Background()
  109. )
  110. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  111. role, err := d.LoadRole(c)
  112. ctx.Convey("Then err should be nil.role should not be nil.", func(ctx convey.C) {
  113. ctx.So(err, convey.ShouldBeNil)
  114. ctx.So(role, convey.ShouldNotBeNil)
  115. })
  116. })
  117. })
  118. }