mysql_test.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. xtime "go-common/library/time"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoMaxOid(t *testing.T) {
  9. var (
  10. c = context.Background()
  11. )
  12. convey.Convey("MaxOid", t, func(ctx convey.C) {
  13. oid, err := d.MaxOid(c)
  14. ctx.Convey("Then err should be nil.oid should not be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. ctx.So(oid, convey.ShouldNotBeNil)
  17. })
  18. })
  19. }
  20. func TestDaoArchiveMetas(t *testing.T) {
  21. var (
  22. c = context.Background()
  23. id = int64(1)
  24. limit = int(1)
  25. )
  26. convey.Convey("ArchiveMetas", t, func(ctx convey.C) {
  27. p1, err := d.ArchiveMetas(c, id, limit)
  28. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  29. ctx.So(err, convey.ShouldBeNil)
  30. ctx.So(p1, convey.ShouldNotBeNil)
  31. })
  32. })
  33. }
  34. func TestDaoArchiveMetasIncrs(t *testing.T) {
  35. var (
  36. c = context.Background()
  37. id = int64(1)
  38. begin xtime.Time
  39. end xtime.Time
  40. limit = int(1)
  41. )
  42. convey.Convey("ArchiveMetasIncrs", t, func(ctx convey.C) {
  43. p1, err := d.ArchiveMetasIncrs(c, id, begin, end, limit)
  44. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  45. ctx.So(err, convey.ShouldBeNil)
  46. ctx.So(p1, convey.ShouldNotBeNil)
  47. })
  48. })
  49. }
  50. func TestDaoArchiveTypes(t *testing.T) {
  51. var (
  52. c = context.Background()
  53. ids = []int64{1}
  54. )
  55. convey.Convey("ArchiveTypes", t, func(ctx convey.C) {
  56. p1, err := d.ArchiveTypes(c, ids)
  57. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  58. ctx.So(err, convey.ShouldBeNil)
  59. ctx.So(p1, convey.ShouldNotBeNil)
  60. })
  61. })
  62. }
  63. func TestDaoArchiveStats(t *testing.T) {
  64. var (
  65. c = context.Background()
  66. aids = []int64{1}
  67. )
  68. convey.Convey("ArchiveStats", t, func(ctx convey.C) {
  69. p1, err := d.ArchiveStats(c, aids)
  70. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  71. ctx.So(err, convey.ShouldBeNil)
  72. ctx.So(p1, convey.ShouldNotBeNil)
  73. })
  74. })
  75. }
  76. func TestDaoArchiveStatsIncrs(t *testing.T) {
  77. var (
  78. c = context.Background()
  79. tbl = int(1)
  80. id = int64(1)
  81. begin xtime.Time
  82. end xtime.Time
  83. limit = int(1)
  84. )
  85. convey.Convey("ArchiveStatsIncrs", t, func(ctx convey.C) {
  86. p1, err := d.ArchiveStatsIncrs(c, tbl, id, begin, end, limit)
  87. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  88. ctx.So(err, convey.ShouldBeNil)
  89. ctx.So(p1, convey.ShouldNotBeNil)
  90. })
  91. })
  92. }
  93. func TestDaoArchiveTVs(t *testing.T) {
  94. var (
  95. c = context.Background()
  96. aids = []int64{1}
  97. )
  98. convey.Convey("ArchiveTVs", t, func(ctx convey.C) {
  99. p1, err := d.ArchiveTVs(c, aids)
  100. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  101. ctx.So(err, convey.ShouldBeNil)
  102. ctx.So(p1, convey.ShouldNotBeNil)
  103. })
  104. })
  105. }
  106. func TestDaoArchiveTVsIncrs(t *testing.T) {
  107. var (
  108. c = context.Background()
  109. id = int64(1)
  110. begin xtime.Time
  111. end xtime.Time
  112. limit = int(1)
  113. )
  114. convey.Convey("ArchiveTVsIncrs", t, func(ctx convey.C) {
  115. p1, err := d.ArchiveTVsIncrs(c, id, begin, end, limit)
  116. ctx.Convey("Then err should be nil.p1 should not be nil.", func(ctx convey.C) {
  117. ctx.So(err, convey.ShouldBeNil)
  118. ctx.So(p1, convey.ShouldNotBeNil)
  119. })
  120. })
  121. }