|
|
@@ -16,7 +16,7 @@ func Test_Presigned(t *testing.T) { |
|
|
|
|
|
|
|
|
Convey("下载文件", t, func() { |
|
|
Convey("下载文件", t, func() { |
|
|
pre := cli.Presigned() |
|
|
pre := cli.Presigned() |
|
|
url, err := pre.ObjectDownload(PresignedObjectDownloadByPath{ |
|
|
|
|
|
|
|
|
url, err := pre.ObjectDownloadByPath(PresignedObjectDownloadByPath{ |
|
|
UserID: 1, |
|
|
UserID: 1, |
|
|
PackageID: 3, |
|
|
PackageID: 3, |
|
|
Path: "example.java", |
|
|
Path: "example.java", |
|
|
@@ -39,14 +39,16 @@ func Test_Presigned(t *testing.T) { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func Test_PresignedObjectDownload(t *testing.T) { |
|
|
|
|
|
|
|
|
func Test_PresignedObjectDownloadByPath(t *testing.T) { |
|
|
cli := NewClient(&Config{ |
|
|
cli := NewClient(&Config{ |
|
|
URL: "http://localhost:7890", |
|
|
|
|
|
|
|
|
URL: "http://localhost:7890", |
|
|
|
|
|
AccessKey: "123456", |
|
|
|
|
|
SecretKey: "123456", |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
Convey("下载文件", t, func() { |
|
|
Convey("下载文件", t, func() { |
|
|
pre := cli.Presigned() |
|
|
pre := cli.Presigned() |
|
|
url, err := pre.ObjectDownload(PresignedObjectDownloadByPath{ |
|
|
|
|
|
|
|
|
url, err := pre.ObjectDownloadByPath(PresignedObjectDownloadByPath{ |
|
|
UserID: 1, |
|
|
UserID: 1, |
|
|
PackageID: 3, |
|
|
PackageID: 3, |
|
|
Path: "example.java", |
|
|
Path: "example.java", |
|
|
@@ -58,6 +60,26 @@ func Test_PresignedObjectDownload(t *testing.T) { |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Test_PresignedObjectDownload(t *testing.T) { |
|
|
|
|
|
cli := NewClient(&Config{ |
|
|
|
|
|
URL: "http://localhost:7890", |
|
|
|
|
|
AccessKey: "123456", |
|
|
|
|
|
SecretKey: "123456", |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
Convey("下载文件", t, func() { |
|
|
|
|
|
pre := cli.Presigned() |
|
|
|
|
|
url, err := pre.ObjectDownload(PresignedObjectDownload{ |
|
|
|
|
|
UserID: 1, |
|
|
|
|
|
ObjectID: 1039, |
|
|
|
|
|
// Offset: 1, |
|
|
|
|
|
// Length: types.Ref(int64(100)), |
|
|
|
|
|
}, 100) |
|
|
|
|
|
So(err, ShouldEqual, nil) |
|
|
|
|
|
t.Logf("url: %s", url) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
func Test_PresignedObjectUpload(t *testing.T) { |
|
|
func Test_PresignedObjectUpload(t *testing.T) { |
|
|
cli := NewClient(&Config{ |
|
|
cli := NewClient(&Config{ |
|
|
URL: "http://localhost:7890", |
|
|
URL: "http://localhost:7890", |
|
|
@@ -94,7 +116,9 @@ func Test_PresignedNewMultipartUpload(t *testing.T) { |
|
|
|
|
|
|
|
|
func Test_PresignedObjectUploadPart(t *testing.T) { |
|
|
func Test_PresignedObjectUploadPart(t *testing.T) { |
|
|
cli := NewClient(&Config{ |
|
|
cli := NewClient(&Config{ |
|
|
URL: "http://localhost:7890", |
|
|
|
|
|
|
|
|
URL: "http://localhost:7890", |
|
|
|
|
|
AccessKey: "123456", |
|
|
|
|
|
SecretKey: "123456", |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
Convey("上传分片", t, func() { |
|
|
Convey("上传分片", t, func() { |
|
|
@@ -111,7 +135,9 @@ func Test_PresignedObjectUploadPart(t *testing.T) { |
|
|
|
|
|
|
|
|
func Test_PresignedCompleteMultipartUpload(t *testing.T) { |
|
|
func Test_PresignedCompleteMultipartUpload(t *testing.T) { |
|
|
cli := NewClient(&Config{ |
|
|
cli := NewClient(&Config{ |
|
|
URL: "http://localhost:7890", |
|
|
|
|
|
|
|
|
URL: "http://localhost:7890", |
|
|
|
|
|
AccessKey: "123456", |
|
|
|
|
|
SecretKey: "123456", |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
Convey("合并分片", t, func() { |
|
|
Convey("合并分片", t, func() { |
|
|
|