forked from TrueCloudLab/frostfs-s3-gw
[#476] Fix parts info for GetObjectAttributes
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
9b1ccd39be
commit
c8e8ba9f6a
6 changed files with 217 additions and 101 deletions
|
@ -144,10 +144,18 @@ func prepareTestRequest(t *testing.T, bktName, objName string, body interface{})
|
|||
return w, r
|
||||
}
|
||||
|
||||
func assertStatus(t *testing.T, w *httptest.ResponseRecorder, status int) {
|
||||
if w.Code != status {
|
||||
resp, err := io.ReadAll(w.Result().Body)
|
||||
require.NoError(t, err)
|
||||
require.Failf(t, string(resp), "assert status fail, expected: %d, actual: %d", status, w.Code)
|
||||
}
|
||||
func prepareTestPayloadRequest(bktName, objName string, payload io.Reader) (*httptest.ResponseRecorder, *http.Request) {
|
||||
w := httptest.NewRecorder()
|
||||
r := httptest.NewRequest(http.MethodPut, defaultURL, payload)
|
||||
|
||||
reqInfo := api.NewReqInfo(w, r, api.ObjectRequest{Bucket: bktName, Object: objName})
|
||||
r = r.WithContext(api.SetReqInfo(r.Context(), reqInfo))
|
||||
|
||||
return w, r
|
||||
}
|
||||
|
||||
func parseTestResponse(t *testing.T, response *httptest.ResponseRecorder, body interface{}) {
|
||||
assertStatus(t, response, http.StatusOK)
|
||||
err := xml.NewDecoder(response.Result().Body).Decode(body)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue