watermark_test.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. package watermark
  2. import (
  3. "context"
  4. "testing"
  5. "github.com/davecgh/go-spew/spew"
  6. "go-common/app/interface/main/creative/model/watermark"
  7. . "github.com/smartystreets/goconvey/convey"
  8. )
  9. func Test_WaterMark(t *testing.T) {
  10. var (
  11. c = context.TODO()
  12. err error
  13. res *watermark.Watermark
  14. MID = int64(27515256)
  15. localHost = "127.0.0.1"
  16. )
  17. wp := &watermark.WatermarkParam{
  18. MID: MID,
  19. State: 0,
  20. Ty: 1,
  21. Pos: 1,
  22. IP: localHost,
  23. }
  24. Convey("WaterMark", t, WithService(func(s *Service) {
  25. res, err = s.WaterMark(c, MID)
  26. So(err, ShouldBeNil)
  27. So(res, ShouldNotBeNil)
  28. }))
  29. Convey("WaterMarkSet", t, WithService(func(s *Service) {
  30. res, err = s.WaterMarkSet(c, wp)
  31. So(err, ShouldBeNil)
  32. So(res, ShouldNotBeNil)
  33. }))
  34. }
  35. func Test_WaterMarkSet(t *testing.T) {
  36. var (
  37. c = context.TODO()
  38. err error
  39. res *watermark.Watermark
  40. MID = int64(27515256)
  41. localHost = "127.0.0.1"
  42. )
  43. wp := &watermark.WatermarkParam{
  44. MID: MID,
  45. State: 0,
  46. Ty: 1,
  47. Pos: 1,
  48. IP: localHost,
  49. }
  50. Convey("WaterMarkSet", t, WithService(func(s *Service) {
  51. res, err = s.WaterMarkSet(c, wp)
  52. spew.Dump(res, err)
  53. So(err, ShouldBeNil)
  54. So(res, ShouldNotBeNil)
  55. }))
  56. }