appeal_test.go 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package dao
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/smartystreets/goconvey/convey"
  6. )
  7. func TestDaoAppeals(t *testing.T) {
  8. convey.Convey("Appeals", t, func(ctx convey.C) {
  9. var (
  10. c = context.Background()
  11. ids = []int64{}
  12. )
  13. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  14. appeals, err := d.Appeals(c, ids)
  15. ctx.Convey("Then err should be nil.appeals should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. ctx.So(appeals, convey.ShouldNotBeNil)
  18. })
  19. })
  20. })
  21. }
  22. func TestDaoTxSetWeight(t *testing.T) {
  23. convey.Convey("SetWeight", t, func(ctx convey.C) {
  24. var (
  25. newWeight map[int64]int64
  26. tx = d.WriteORM.Begin()
  27. )
  28. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  29. err := d.TxSetWeight(tx, newWeight)
  30. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. })
  33. tx.Rollback()
  34. })
  35. })
  36. }
  37. func TestDaoSetAppealAssignState(t *testing.T) {
  38. convey.Convey("SetAppealAssignState", t, func(ctx convey.C) {
  39. var (
  40. c = context.Background()
  41. ids = []int64{1}
  42. assignState = int8(0)
  43. )
  44. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  45. err := d.SetAppealAssignState(c, ids, assignState)
  46. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  47. ctx.So(err, convey.ShouldBeNil)
  48. })
  49. })
  50. })
  51. }
  52. func TestDaoLastEvent(t *testing.T) {
  53. convey.Convey("LastEvent", t, func(ctx convey.C) {
  54. var apID = int64(1)
  55. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  56. e, err := d.LastEvent(apID)
  57. ctx.Convey("Then err should be nil.e should not be nil.", func(ctx convey.C) {
  58. ctx.So(err, convey.ShouldBeNil)
  59. ctx.So(e, convey.ShouldNotBeNil)
  60. })
  61. })
  62. })
  63. }
  64. func TestDaoSetAppealTransferState(t *testing.T) {
  65. convey.Convey("SetAppealTransferState", t, func(ctx convey.C) {
  66. var (
  67. c = context.Background()
  68. ids = []int64{}
  69. transferState = int8(0)
  70. )
  71. ctx.Convey("When everything gose positive", func(ctx convey.C) {
  72. err := d.SetAppealTransferState(c, ids, transferState)
  73. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  74. ctx.So(err, convey.ShouldBeNil)
  75. })
  76. })
  77. })
  78. }