mysql_report_test.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. package dao
  2. import (
  3. "context"
  4. "go-common/app/admin/main/dm/model"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoRptTable(t *testing.T) {
  9. convey.Convey("RptTable", t, func(ctx convey.C) {
  10. var (
  11. cid = int64(0)
  12. )
  13. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  14. p1 := RptTable(cid)
  15. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  16. ctx.So(p1, convey.ShouldNotBeNil)
  17. })
  18. })
  19. })
  20. }
  21. func TestDaoUserTable(t *testing.T) {
  22. convey.Convey("UserTable", t, func(ctx convey.C) {
  23. var (
  24. dmid = int64(0)
  25. )
  26. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  27. p1 := UserTable(dmid)
  28. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  29. ctx.So(p1, convey.ShouldNotBeNil)
  30. })
  31. })
  32. })
  33. }
  34. func TestDaoLogTable(t *testing.T) {
  35. convey.Convey("LogTable", t, func(ctx convey.C) {
  36. var (
  37. dmid = int64(0)
  38. )
  39. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  40. p1 := LogTable(dmid)
  41. ctx.Convey("Then p1 should not be nil.", func(ctx convey.C) {
  42. ctx.So(p1, convey.ShouldNotBeNil)
  43. })
  44. })
  45. })
  46. }
  47. func TestDaoChangeReportStat(t *testing.T) {
  48. convey.Convey("ChangeReportStat", t, func(ctx convey.C) {
  49. var (
  50. c = context.Background()
  51. cid = int64(0)
  52. dmids = []int64{}
  53. state = int8(0)
  54. )
  55. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  56. testDao.ChangeReportStat(c, cid, dmids, state)
  57. })
  58. })
  59. }
  60. func TestDaoIgnoreReport(t *testing.T) {
  61. convey.Convey("IgnoreReport", t, func(ctx convey.C) {
  62. var (
  63. c = context.Background()
  64. cid = int64(0)
  65. dmids = []int64{}
  66. state = int8(0)
  67. )
  68. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  69. testDao.IgnoreReport(c, cid, dmids, state)
  70. })
  71. })
  72. }
  73. func TestDaoReports(t *testing.T) {
  74. convey.Convey("Reports", t, func(ctx convey.C) {
  75. var (
  76. c = context.Background()
  77. cid = int64(0)
  78. dmids = []int64{}
  79. )
  80. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  81. testDao.Reports(c, cid, dmids)
  82. })
  83. })
  84. }
  85. func TestDaoReportUsers(t *testing.T) {
  86. convey.Convey("ReportUsers", t, func(ctx convey.C) {
  87. var (
  88. c = context.Background()
  89. tableID = int64(0)
  90. dmids = []int64{}
  91. state = int8(0)
  92. )
  93. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  94. testDao.ReportUsers(c, tableID, dmids, state)
  95. })
  96. })
  97. }
  98. func TestDaoUpReportUserState(t *testing.T) {
  99. convey.Convey("UpReportUserState", t, func(ctx convey.C) {
  100. var (
  101. c = context.Background()
  102. tableID = int64(0)
  103. dmids = []int64{}
  104. state = int8(0)
  105. )
  106. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  107. testDao.UpReportUserState(c, tableID, dmids, state)
  108. })
  109. })
  110. }
  111. func TestDaoAddReportLog(t *testing.T) {
  112. convey.Convey("AddReportLog", t, func(ctx convey.C) {
  113. var (
  114. c = context.Background()
  115. tableID = int64(0)
  116. lg = []*model.ReportLog{}
  117. )
  118. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  119. testDao.AddReportLog(c, tableID, lg)
  120. })
  121. })
  122. }
  123. func TestDaoReportLog(t *testing.T) {
  124. convey.Convey("ReportLog", t, func(ctx convey.C) {
  125. var (
  126. c = context.Background()
  127. dmid = int64(0)
  128. )
  129. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  130. res, err := testDao.ReportLog(c, dmid)
  131. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  132. ctx.So(err, convey.ShouldBeNil)
  133. ctx.So(res, convey.ShouldNotBeNil)
  134. })
  135. })
  136. })
  137. }