upload_test.go 705 B

123456789101112131415161718192021222324252627282930
  1. package service
  2. import (
  3. "context"
  4. "go-common/app/admin/main/up/conf"
  5. "testing"
  6. "time"
  7. "github.com/smartystreets/goconvey/convey"
  8. )
  9. func TestServiceUpload(t *testing.T) {
  10. convey.Convey("Upload", t, func(ctx convey.C) {
  11. var (
  12. c = context.Background()
  13. fileName = ""
  14. fileType = ""
  15. no = time.Now()
  16. body = []byte("")
  17. bfs = &conf.Bfs{}
  18. )
  19. ctx.Convey("When everything goes positive", func(ctx convey.C) {
  20. location, err := s.Upload(c, fileName, fileType, no, body, bfs)
  21. ctx.Convey("Then err should be nil.location should not be nil.", func(ctx convey.C) {
  22. ctx.So(err, convey.ShouldBeNil)
  23. ctx.So(location, convey.ShouldNotBeNil)
  24. })
  25. })
  26. })
  27. }