task_qa_test.go 941 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestDaoInTaskQA(t *testing.T) {
  9. var (
  10. tx, _ = d.BeginTran(context.TODO())
  11. uid = int64(421)
  12. detailID = int64(1)
  13. taskType = int8(1)
  14. )
  15. convey.Convey("InTaskQA", t, func(ctx convey.C) {
  16. id, err := d.InTaskQA(tx, uid, detailID, taskType)
  17. if err == nil {
  18. tx.Commit()
  19. } else {
  20. tx.Rollback()
  21. }
  22. ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  23. ctx.So(err, convey.ShouldBeNil)
  24. ctx.So(id, convey.ShouldNotBeNil)
  25. })
  26. })
  27. }
  28. func TestDaoUpTask(t *testing.T) {
  29. var (
  30. c = context.TODO()
  31. id = int64(41)
  32. state = int16(2)
  33. ftime = time.Now()
  34. )
  35. convey.Convey("UpTask", t, func(ctx convey.C) {
  36. _, err := d.UpTask(c, id, state, ftime)
  37. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  38. ctx.So(err, convey.ShouldBeNil)
  39. })
  40. })
  41. }