-
Notifications
You must be signed in to change notification settings - Fork 675
/
Copy pathapi_op_DownloadObject_integ_test.go
52 lines (48 loc) · 1.36 KB
/
api_op_DownloadObject_integ_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//go:build integration
// +build integration
package transfermanager
import (
"bytes"
"github.com/aws/aws-sdk-go-v2/feature/s3/transfermanager/types"
"strings"
"testing"
)
func TestInteg_DownloadObject(t *testing.T) {
cases := map[string]getObjectTestData{
"part get seekable body": {Body: strings.NewReader("hello world"), ExpectBody: []byte("hello world")},
"part get empty string body": {Body: strings.NewReader(""), ExpectBody: []byte("")},
"part get multipart body": {Body: bytes.NewReader(largeObjectBuf), ExpectBody: largeObjectBuf},
"range get seekable body": {
Body: strings.NewReader("hello world"),
ExpectBody: []byte("hello world"),
OptFns: []func(*Options){
func(opt *Options) {
opt.GetObjectType = types.GetObjectRanges
},
},
},
"range get empty string body": {
Body: strings.NewReader(""),
ExpectError: "InvalidRange",
OptFns: []func(*Options){
func(opt *Options) {
opt.GetObjectType = types.GetObjectRanges
},
},
},
"range get multipart body": {
Body: bytes.NewReader(largeObjectBuf),
ExpectBody: largeObjectBuf,
OptFns: []func(*Options){
func(opt *Options) {
opt.GetObjectType = types.GetObjectRanges
},
},
},
}
for name, c := range cases {
t.Run(name, func(t *testing.T) {
testDownloadObject(t, setupMetadata.Buckets.Source.Name, c)
})
}
}