|
|
@ -29,6 +29,7 @@ func TestListObjectsV2Resources(t *testing.T) { |
|
|
|
fetchOwner bool |
|
|
|
fetchOwner bool |
|
|
|
maxKeys int |
|
|
|
maxKeys int |
|
|
|
encodingType string |
|
|
|
encodingType string |
|
|
|
|
|
|
|
errCode APIErrorCode |
|
|
|
}{ |
|
|
|
}{ |
|
|
|
{ |
|
|
|
{ |
|
|
|
values: url.Values{ |
|
|
|
values: url.Values{ |
|
|
@ -47,6 +48,7 @@ func TestListObjectsV2Resources(t *testing.T) { |
|
|
|
fetchOwner: true, |
|
|
|
fetchOwner: true, |
|
|
|
maxKeys: 100, |
|
|
|
maxKeys: 100, |
|
|
|
encodingType: "gzip", |
|
|
|
encodingType: "gzip", |
|
|
|
|
|
|
|
errCode: ErrNone, |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
values: url.Values{ |
|
|
|
values: url.Values{ |
|
|
@ -64,11 +66,34 @@ func TestListObjectsV2Resources(t *testing.T) { |
|
|
|
fetchOwner: true, |
|
|
|
fetchOwner: true, |
|
|
|
maxKeys: 1000, |
|
|
|
maxKeys: 1000, |
|
|
|
encodingType: "gzip", |
|
|
|
encodingType: "gzip", |
|
|
|
|
|
|
|
errCode: ErrNone, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
values: url.Values{ |
|
|
|
|
|
|
|
"prefix": []string{"photos/"}, |
|
|
|
|
|
|
|
"continuation-token": []string{""}, |
|
|
|
|
|
|
|
"start-after": []string{"start-after"}, |
|
|
|
|
|
|
|
"delimiter": []string{"/"}, |
|
|
|
|
|
|
|
"fetch-owner": []string{"true"}, |
|
|
|
|
|
|
|
"encoding-type": []string{"gzip"}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
prefix: "", |
|
|
|
|
|
|
|
token: "", |
|
|
|
|
|
|
|
startAfter: "", |
|
|
|
|
|
|
|
delimiter: "", |
|
|
|
|
|
|
|
fetchOwner: false, |
|
|
|
|
|
|
|
maxKeys: 0, |
|
|
|
|
|
|
|
encodingType: "", |
|
|
|
|
|
|
|
errCode: ErrIncorrectContinuationToken, |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for i, testCase := range testCases { |
|
|
|
for i, testCase := range testCases { |
|
|
|
prefix, token, startAfter, delimiter, fetchOwner, maxKeys, encodingType := getListObjectsV2Args(testCase.values) |
|
|
|
prefix, token, startAfter, delimiter, fetchOwner, maxKeys, encodingType, errCode := getListObjectsV2Args(testCase.values) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if errCode != testCase.errCode { |
|
|
|
|
|
|
|
t.Errorf("Test %d: Expected error code:%d, got %d", i+1, testCase.errCode, errCode) |
|
|
|
|
|
|
|
} |
|
|
|
if prefix != testCase.prefix { |
|
|
|
if prefix != testCase.prefix { |
|
|
|
t.Errorf("Test %d: Expected %s, got %s", i+1, testCase.prefix, prefix) |
|
|
|
t.Errorf("Test %d: Expected %s, got %s", i+1, testCase.prefix, prefix) |
|
|
|
} |
|
|
|
} |
|
|
|