task_status_test.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoTaskStatus(t *testing.T) {
  8. convey.Convey("TaskStatus", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. date = "2018-12-01"
  12. typ = int(1)
  13. )
  14. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  15. status, err := d.TaskStatus(c, date, typ)
  16. ctx.Convey("Then err should be nil.status should not be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldBeNil)
  18. ctx.So(status, convey.ShouldNotBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestDaoUpdateTaskStatus(t *testing.T) {
  24. convey.Convey("UpdateTaskStatus", t, func(ctx convey.C) {
  25. var (
  26. c = context.Background()
  27. date = "2018-12-01"
  28. typ = int(1)
  29. status = int(2)
  30. )
  31. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  32. rows, err := d.UpdateTaskStatus(c, date, typ, status)
  33. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  34. ctx.So(err, convey.ShouldBeNil)
  35. ctx.So(rows, convey.ShouldNotBeNil)
  36. })
  37. })
  38. })
  39. }
  40. func TestDaoInsertTaskStatus(t *testing.T) {
  41. convey.Convey("InsertTaskStatus", t, func(ctx convey.C) {
  42. var (
  43. c = context.Background()
  44. typ = int(1)
  45. status = int(2)
  46. date = "2018-12-01"
  47. message = "ok"
  48. )
  49. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  50. rows, err := d.InsertTaskStatus(c, typ, status, date, message)
  51. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  52. ctx.So(err, convey.ShouldBeNil)
  53. ctx.So(rows, convey.ShouldNotBeNil)
  54. })
  55. })
  56. })
  57. }