season_sync_test.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package app
  2. import (
  3. "context"
  4. "fmt"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestAppSnEmpty(t *testing.T) {
  9. var (
  10. c = context.Background()
  11. sid = int64(12373)
  12. )
  13. convey.Convey("SnEmpty", t, func(ctx convey.C) {
  14. res, err := d.SnEmpty(c, sid)
  15. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. ctx.So(res, convey.ShouldNotBeNil)
  18. })
  19. })
  20. }
  21. func TestAppModSeason(t *testing.T) {
  22. var c = context.Background()
  23. convey.Convey("ModSeason", t, func(ctx convey.C) {
  24. res, err := d.ModSeason(c)
  25. if len(res) == 0 && err == nil {
  26. sid, errPick := pickEpSid()
  27. if errPick != nil {
  28. return
  29. }
  30. fmt.Println(sid)
  31. d.DB.Exec(c, "update tv_ep_season set `check` = 2,audit_time=0 where id = ?", sid)
  32. res, err = d.ModSeason(c)
  33. }
  34. ctx.Convey("Then err should be nil.res should not be nil.", func(ctx convey.C) {
  35. ctx.So(err, convey.ShouldBeNil)
  36. ctx.So(res, convey.ShouldNotBeNil)
  37. })
  38. })
  39. }
  40. func TestAppAuditSeason(t *testing.T) {
  41. var (
  42. c = context.Background()
  43. sid = int(12373)
  44. )
  45. convey.Convey("AuditSeason", t, func(ctx convey.C) {
  46. nbRows, err := d.AuditSeason(c, sid)
  47. ctx.Convey("Then err should be nil.nbRows should not be nil.", func(ctx convey.C) {
  48. ctx.So(err, convey.ShouldBeNil)
  49. ctx.So(nbRows, convey.ShouldNotBeNil)
  50. })
  51. })
  52. }
  53. func TestAppDelaySeason(t *testing.T) {
  54. var (
  55. c = context.Background()
  56. sid = int64(12373)
  57. )
  58. convey.Convey("DelaySeason", t, func(ctx convey.C) {
  59. nbRows, err := d.DelaySeason(c, sid)
  60. ctx.Convey("Then err should be nil.nbRows should not be nil.", func(ctx convey.C) {
  61. ctx.So(err, convey.ShouldBeNil)
  62. ctx.So(nbRows, convey.ShouldNotBeNil)
  63. })
  64. })
  65. }