delay_test.go 1008 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. package archive
  2. import (
  3. "context"
  4. "testing"
  5. . "github.com/smartystreets/goconvey/convey"
  6. "go-common/library/time"
  7. )
  8. func TestDao_TxUpDelay(t *testing.T) {
  9. var (
  10. c = context.Background()
  11. tx, _ = d.BeginTran(c)
  12. dt time.Time
  13. )
  14. Convey("TxUpArchiveState", t, func(ctx C) {
  15. _, err := d.TxUpDelay(tx, 123, 23333, 0, 0, dt)
  16. if err != nil {
  17. tx.Rollback()
  18. } else {
  19. tx.Commit()
  20. }
  21. So(err, ShouldBeNil)
  22. })
  23. }
  24. func TestDao_TxDelDelay(t *testing.T) {
  25. var (
  26. c = context.Background()
  27. tx, _ = d.BeginTran(c)
  28. )
  29. Convey("TxDelDelay", t, func(ctx C) {
  30. _, err := d.TxDelDelay(tx, 123, 0)
  31. if err != nil {
  32. tx.Rollback()
  33. } else {
  34. tx.Commit()
  35. }
  36. So(err, ShouldBeNil)
  37. })
  38. }
  39. func TestArchiveDelay(t *testing.T) {
  40. var (
  41. c = context.Background()
  42. aid = int64(23333)
  43. tp = int8(0)
  44. )
  45. Convey("Delay", t, func(ctx C) {
  46. _, err := d.Delay(c, aid, tp)
  47. ctx.Convey("Then err should be nil.dl should not be nil.", func(ctx C) {
  48. ctx.So(err, ShouldBeNil)
  49. })
  50. })
  51. }