task_info_test.go 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package upcrm
  2. import (
  3. "testing"
  4. "time"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestUpcrmStartTask(t *testing.T) {
  8. convey.Convey("StartTask", t, func(ctx convey.C) {
  9. var (
  10. taskType = int(0)
  11. now = time.Now()
  12. )
  13. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  14. affectedRow, err := d.StartTask(taskType, now)
  15. err = nil
  16. ctx.Convey("Then err should be nil.affectedRow should not be nil.", func(ctx convey.C) {
  17. ctx.So(err, convey.ShouldBeNil)
  18. ctx.So(affectedRow, convey.ShouldNotBeNil)
  19. })
  20. })
  21. })
  22. }
  23. func TestUpcrmFinishTask(t *testing.T) {
  24. convey.Convey("FinishTask", t, func(ctx convey.C) {
  25. var (
  26. taskType = int(0)
  27. now = time.Now()
  28. state = int(0)
  29. )
  30. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  31. affectedRow, err := d.FinishTask(taskType, now, state)
  32. ctx.Convey("Then err should be nil.affectedRow should not be nil.", func(ctx convey.C) {
  33. ctx.So(err, convey.ShouldBeNil)
  34. ctx.So(affectedRow, convey.ShouldNotBeNil)
  35. })
  36. })
  37. })
  38. }