OpenAPI: document that also folder-quota-update supports partial updates
This commit is contained in:
parent
00f97aabb4
commit
a383957cfa
2 changed files with 36 additions and 2 deletions
httpd
|
@ -4017,7 +4017,6 @@ func TestUpdateFolderQuotaUsageMock(t *testing.T) {
|
|||
setBearerForReq(req, token)
|
||||
rr = executeRequest(req)
|
||||
checkResponseCode(t, http.StatusOK, rr)
|
||||
|
||||
var folderGet vfs.BaseVirtualFolder
|
||||
req, _ = http.NewRequest(http.MethodGet, path.Join(folderPath, folderName), nil)
|
||||
setBearerForReq(req, token)
|
||||
|
@ -4027,6 +4026,41 @@ func TestUpdateFolderQuotaUsageMock(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
assert.Equal(t, usedQuotaFiles, folderGet.UsedQuotaFiles)
|
||||
assert.Equal(t, usedQuotaSize, folderGet.UsedQuotaSize)
|
||||
// now update only quota size
|
||||
f.UsedQuotaFiles = 0
|
||||
folderAsJSON, err = json.Marshal(f)
|
||||
assert.NoError(t, err)
|
||||
req, _ = http.NewRequest(http.MethodPut, updateFolderUsedQuotaPath+"?mode=add", bytes.NewBuffer(folderAsJSON))
|
||||
setBearerForReq(req, token)
|
||||
rr = executeRequest(req)
|
||||
checkResponseCode(t, http.StatusOK, rr)
|
||||
folderGet = vfs.BaseVirtualFolder{}
|
||||
req, _ = http.NewRequest(http.MethodGet, path.Join(folderPath, folderName), nil)
|
||||
setBearerForReq(req, token)
|
||||
rr = executeRequest(req)
|
||||
checkResponseCode(t, http.StatusOK, rr)
|
||||
err = render.DecodeJSON(rr.Body, &folderGet)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, usedQuotaFiles, folderGet.UsedQuotaFiles)
|
||||
assert.Equal(t, usedQuotaSize*2, folderGet.UsedQuotaSize)
|
||||
// now update only quota files
|
||||
f.UsedQuotaSize = 0
|
||||
f.UsedQuotaFiles = 1
|
||||
folderAsJSON, err = json.Marshal(f)
|
||||
assert.NoError(t, err)
|
||||
req, _ = http.NewRequest(http.MethodPut, updateFolderUsedQuotaPath+"?mode=add", bytes.NewBuffer(folderAsJSON))
|
||||
setBearerForReq(req, token)
|
||||
rr = executeRequest(req)
|
||||
checkResponseCode(t, http.StatusOK, rr)
|
||||
folderGet = vfs.BaseVirtualFolder{}
|
||||
req, _ = http.NewRequest(http.MethodGet, path.Join(folderPath, folderName), nil)
|
||||
setBearerForReq(req, token)
|
||||
rr = executeRequest(req)
|
||||
checkResponseCode(t, http.StatusOK, rr)
|
||||
err = render.DecodeJSON(rr.Body, &folderGet)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, usedQuotaFiles*2, folderGet.UsedQuotaFiles)
|
||||
assert.Equal(t, usedQuotaSize*2, folderGet.UsedQuotaSize)
|
||||
req, _ = http.NewRequest(http.MethodPut, updateFolderUsedQuotaPath, bytes.NewBuffer([]byte("string")))
|
||||
setBearerForReq(req, token)
|
||||
rr = executeRequest(req)
|
||||
|
|
|
@ -428,7 +428,7 @@ paths:
|
|||
example: reset
|
||||
requestBody:
|
||||
required: true
|
||||
description: 'The only folder mandatory fields are mapped_path,used_quota_size and used_quota_files. Please note that if the used quota fields are missing they will default to 0'
|
||||
description: 'The only folder mandatory fields are mapped_path,used_quota_size and used_quota_files. Please note that if the used quota fields are missing they will default to 0, this means that if mode is "add" the current value will remain unchanged, if mode is "reset" the missing field is set to 0'
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
|
|
Loading…
Add table
Reference in a new issue