watermark_test.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package watermark
  2. import (
  3. "context"
  4. "go-common/app/interface/main/creative/model/watermark"
  5. "testing"
  6. "github.com/smartystreets/goconvey/convey"
  7. )
  8. func TestWatermarkAddWaterMark(t *testing.T) {
  9. var (
  10. c = context.TODO()
  11. w = &watermark.Watermark{}
  12. )
  13. convey.Convey("AddWaterMark", t, func(ctx convey.C) {
  14. id, err := d.AddWaterMark(c, w)
  15. ctx.Convey("Then err should be nil.id should not be nil.", func(ctx convey.C) {
  16. ctx.So(err, convey.ShouldBeNil)
  17. ctx.So(id, convey.ShouldNotBeNil)
  18. })
  19. })
  20. }
  21. func TestWatermarkUpWaterMark(t *testing.T) {
  22. var (
  23. c = context.TODO()
  24. w = &watermark.Watermark{}
  25. )
  26. convey.Convey("UpWaterMark", t, func(ctx convey.C) {
  27. rows, err := d.UpWaterMark(c, w)
  28. ctx.Convey("Then err should be nil.rows should not be nil.", func(ctx convey.C) {
  29. ctx.So(err, convey.ShouldBeNil)
  30. ctx.So(rows, convey.ShouldNotBeNil)
  31. })
  32. })
  33. }
  34. func TestWatermarkWaterMark(t *testing.T) {
  35. var (
  36. c = context.TODO()
  37. mid = int64(0)
  38. )
  39. convey.Convey("WaterMark", t, func(ctx convey.C) {
  40. w, err := d.WaterMark(c, mid)
  41. ctx.Convey("Then err should be nil.w should not be nil.", func(ctx convey.C) {
  42. ctx.So(err, convey.ShouldBeNil)
  43. ctx.So(w, convey.ShouldNotBeNil)
  44. })
  45. })
  46. }