task_test.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. package service
  2. import (
  3. "context"
  4. "github.com/smartystreets/goconvey/convey"
  5. "testing"
  6. )
  7. func TestServiceAddTask(t *testing.T) {
  8. convey.Convey("AddTask", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. mid = int64(0)
  12. username = ""
  13. adminID = int64(0)
  14. logDate = int64(0)
  15. contactEmail = ""
  16. platform = int(0)
  17. sourceType = int(0)
  18. )
  19. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  20. s.AddTask(c, mid, username, adminID, logDate, contactEmail, platform, sourceType)
  21. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  22. })
  23. })
  24. })
  25. }
  26. func TestServiceDeleteTask(t *testing.T) {
  27. convey.Convey("DeleteTask", t, func(ctx convey.C) {
  28. var (
  29. c = context.Background()
  30. taskID = int64(0)
  31. username = ""
  32. adminID = int64(0)
  33. )
  34. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  35. s.DeleteTask(c, taskID, username, adminID)
  36. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  37. })
  38. })
  39. })
  40. }
  41. func TestServiceQueryTask(t *testing.T) {
  42. convey.Convey("QueryTask", t, func(ctx convey.C) {
  43. var (
  44. c = context.Background()
  45. mid = int64(0)
  46. logDateStart = int64(0)
  47. logDateEnd = int64(0)
  48. sourceType = int(0)
  49. platform = int(0)
  50. state = int(0)
  51. sortBy = ""
  52. pageNo = int(0)
  53. pageSize = int(0)
  54. )
  55. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  56. s.QueryTask(c, mid, logDateStart, logDateEnd, sourceType, platform, state, sortBy, pageNo, pageSize)
  57. ctx.Convey("Then err should be nil.tasks,count should not be nil.", func(ctx convey.C) {
  58. })
  59. })
  60. })
  61. }
  62. func TestServicebuildSortStmt(t *testing.T) {
  63. convey.Convey("buildSortStmt", t, func(ctx convey.C) {
  64. var (
  65. sortBy = ""
  66. )
  67. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  68. sort := buildSortStmt(sortBy)
  69. ctx.Convey("Then sort should not be nil.", func(ctx convey.C) {
  70. ctx.Convey(sort, convey.ShouldNotBeNil)
  71. })
  72. })
  73. })
  74. }
  75. func TestServiceUpdateTask(t *testing.T) {
  76. convey.Convey("UpdateTask", t, func(ctx convey.C) {
  77. var (
  78. c = context.Background()
  79. username = ""
  80. adminID = int64(0)
  81. taskID = int64(0)
  82. mid = int64(0)
  83. logDate = int64(0)
  84. contactEmail = ""
  85. sourceType = int(0)
  86. platform = int(0)
  87. )
  88. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  89. s.UpdateTask(c, username, adminID, taskID, mid, logDate, contactEmail, sourceType, platform)
  90. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  91. })
  92. })
  93. })
  94. }