audit_test.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. package audit
  2. import (
  3. "context"
  4. "go-common/app/interface/main/tv/model"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestAuditBeginTrans(t *testing.T) {
  9. var (
  10. c = context.Background()
  11. )
  12. convey.Convey("BeginTran", t, func(ctx convey.C) {
  13. tx, err := d.BeginTran(c)
  14. ctx.Convey("Then err should be nil.tx should not be nil.", func(ctx convey.C) {
  15. ctx.So(err, convey.ShouldBeNil)
  16. ctx.So(tx, convey.ShouldNotBeNil)
  17. })
  18. tx.Commit()
  19. })
  20. }
  21. func TestAuditUpdateVideo(t *testing.T) {
  22. var (
  23. c = context.Background()
  24. v = &model.AuditOp{}
  25. tx, _ = d.BeginTran(c)
  26. )
  27. convey.Convey("UpdateVideo", t, func(ctx convey.C) {
  28. err := d.UpdateVideo(c, v, tx)
  29. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  30. ctx.So(err, convey.ShouldBeNil)
  31. })
  32. tx.Commit()
  33. })
  34. }
  35. func TestAuditUpdateArc(t *testing.T) {
  36. var (
  37. c = context.Background()
  38. v = &model.AuditOp{}
  39. tx, _ = d.BeginTran(c)
  40. )
  41. convey.Convey("UpdateArc", t, func(ctx convey.C) {
  42. err := d.UpdateArc(c, v, tx)
  43. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  44. ctx.So(err, convey.ShouldBeNil)
  45. })
  46. tx.Commit()
  47. })
  48. }
  49. func TestAuditUpdateCont(t *testing.T) {
  50. var (
  51. c = context.Background()
  52. val = &model.AuditOp{}
  53. tx, _ = d.BeginTran(c)
  54. )
  55. convey.Convey("UpdateCont", t, func(ctx convey.C) {
  56. err := d.UpdateCont(c, val, tx)
  57. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  58. ctx.So(err, convey.ShouldBeNil)
  59. })
  60. tx.Commit()
  61. })
  62. }
  63. func TestAuditUpdateSea(t *testing.T) {
  64. var (
  65. c = context.Background()
  66. val = &model.AuditOp{}
  67. tx, _ = d.BeginTran(c)
  68. )
  69. convey.Convey("UpdateSea", t, func(ctx convey.C) {
  70. err := d.UpdateSea(c, val, tx)
  71. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  72. ctx.So(err, convey.ShouldBeNil)
  73. })
  74. tx.Commit()
  75. })
  76. }