porder_test.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package archive
  2. import (
  3. "context"
  4. "testing"
  5. "time"
  6. . "github.com/smartystreets/goconvey/convey"
  7. "go-common/app/service/main/videoup/model/archive"
  8. )
  9. func TestDao_TxUpPorder(t *testing.T) {
  10. var (
  11. c = context.Background()
  12. tx, _ = d.BeginTran(c)
  13. ap = &archive.ArcParam{
  14. Porder: &archive.Porder{},
  15. }
  16. )
  17. Convey("TxUpPorder", t, func(ctx C) {
  18. _, err := d.TxUpPorder(tx, 23333, ap)
  19. if err != nil {
  20. tx.Rollback()
  21. } else {
  22. tx.Commit()
  23. }
  24. So(err, ShouldBeNil)
  25. })
  26. }
  27. func TestArchivePorder(t *testing.T) {
  28. var (
  29. c = context.Background()
  30. aid = int64(23333)
  31. )
  32. Convey("Porder", t, func(ctx C) {
  33. _, err := d.Porder(c, aid)
  34. ctx.Convey("Then err should be nil.p should not be nil.", func(ctx C) {
  35. ctx.So(err, ShouldBeNil)
  36. })
  37. })
  38. }
  39. func TestArchivePorderCfgList(t *testing.T) {
  40. var (
  41. c = context.Background()
  42. )
  43. Convey("PorderCfgList", t, func(ctx C) {
  44. _, err := d.PorderCfgList(c)
  45. ctx.Convey("Then err should be nil.pcfgs should not be nil.", func(ctx C) {
  46. ctx.So(err, ShouldBeNil)
  47. })
  48. })
  49. }
  50. func TestArchivePorderArcList(t *testing.T) {
  51. var (
  52. c = context.Background()
  53. begin = time.Now()
  54. end = time.Now()
  55. )
  56. Convey("PorderArcList", t, func(ctx C) {
  57. _, err := d.PorderArcList(c, begin, end)
  58. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx C) {
  59. ctx.So(err, ShouldBeNil)
  60. })
  61. })
  62. }