del_upper_test.go 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package ugc
  2. import (
  3. "context"
  4. "testing"
  5. "database/sql"
  6. "fmt"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestUgcDeletedUp(t *testing.T) {
  10. var c = context.Background()
  11. convey.Convey("DeletedUp", t, func(ctx convey.C) {
  12. mid, err := d.DeletedUp(c)
  13. if err == sql.ErrNoRows {
  14. fmt.Println("No to delete data")
  15. return
  16. }
  17. ctx.Convey("Then err should be nil.mid should not be nil.", func(ctx convey.C) {
  18. ctx.So(err, convey.ShouldBeNil)
  19. ctx.So(mid, convey.ShouldNotBeNil)
  20. })
  21. })
  22. }
  23. func TestUgcFinishDelUp(t *testing.T) {
  24. var (
  25. c = context.Background()
  26. mid = int64(0)
  27. )
  28. convey.Convey("FinishDelUp", t, func(ctx convey.C) {
  29. err := d.FinishDelUp(c, mid)
  30. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  31. ctx.So(err, convey.ShouldBeNil)
  32. })
  33. })
  34. }
  35. func TestUgcPpDelUp(t *testing.T) {
  36. var (
  37. c = context.Background()
  38. mid = int64(0)
  39. )
  40. convey.Convey("PpDelUp", t, func(ctx convey.C) {
  41. err := d.PpDelUp(c, mid)
  42. ctx.Convey("Then err should be nil.", func(ctx convey.C) {
  43. ctx.So(err, convey.ShouldBeNil)
  44. })
  45. })
  46. }
  47. func TestUgcCountUpArcs(t *testing.T) {
  48. var (
  49. c = context.Background()
  50. mid = int64(0)
  51. )
  52. convey.Convey("CountUpArcs", t, func(ctx convey.C) {
  53. count, err := d.CountUpArcs(c, mid)
  54. ctx.Convey("Then err should be nil.count should not be nil.", func(ctx convey.C) {
  55. ctx.So(err, convey.ShouldBeNil)
  56. ctx.So(count, convey.ShouldNotBeNil)
  57. })
  58. })
  59. }
  60. func TestUgcUpArcs(t *testing.T) {
  61. var (
  62. c = context.Background()
  63. mid = int64(0)
  64. )
  65. convey.Convey("UpArcs", t, func(ctx convey.C) {
  66. aids, err := d.UpArcs(c, mid)
  67. ctx.Convey("Then err should be nil.aids should not be nil.", func(ctx convey.C) {
  68. ctx.So(err, convey.ShouldBeNil)
  69. ctx.So(aids, convey.ShouldNotBeNil)
  70. })
  71. })
  72. }