mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-25 09:00:27 +00:00
don't track quota for private virtual folders
they are included within the user quota. This is a backward incompatible change. Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
92849ca473
commit
fef388d8cb
6 changed files with 142 additions and 119 deletions
|
@ -1457,15 +1457,15 @@ func TestTruncateQuotaLimits(t *testing.T) {
|
||||||
expectedQuotaSize := int64(3)
|
expectedQuotaSize := int64(3)
|
||||||
fold, _, err := httpdtest.GetFolderByName(folder2.Name, http.StatusOK)
|
fold, _, err := httpdtest.GetFolderByName(folder2.Name, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, expectedQuotaSize, fold.UsedQuotaSize)
|
assert.Equal(t, int64(0), fold.UsedQuotaSize)
|
||||||
assert.Equal(t, expectedQuotaFiles, fold.UsedQuotaFiles)
|
assert.Equal(t, 0, fold.UsedQuotaFiles)
|
||||||
err = f.Close()
|
err = f.Close()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
expectedQuotaFiles = 1
|
expectedQuotaFiles = 1
|
||||||
fold, _, err = httpdtest.GetFolderByName(folder2.Name, http.StatusOK)
|
fold, _, err = httpdtest.GetFolderByName(folder2.Name, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, expectedQuotaSize, fold.UsedQuotaSize)
|
assert.Equal(t, int64(0), fold.UsedQuotaSize)
|
||||||
assert.Equal(t, expectedQuotaFiles, fold.UsedQuotaFiles)
|
assert.Equal(t, 0, fold.UsedQuotaFiles)
|
||||||
user, _, err = httpdtest.GetUserByUsername(user.Username, http.StatusOK)
|
user, _, err = httpdtest.GetUserByUsername(user.Username, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, expectedQuotaFiles, user.UsedQuotaFiles)
|
assert.Equal(t, expectedQuotaFiles, user.UsedQuotaFiles)
|
||||||
|
@ -1777,8 +1777,8 @@ func TestVirtualFoldersQuotaValues(t *testing.T) {
|
||||||
assert.Equal(t, expectedQuotaSize, user.UsedQuotaSize)
|
assert.Equal(t, expectedQuotaSize, user.UsedQuotaSize)
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -1885,8 +1885,8 @@ func TestQuotaRenameInsideSameVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -1910,8 +1910,8 @@ func TestQuotaRenameInsideSameVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
// rename a file inside vdir2, it isn't included inside user quota, so we have:
|
// rename a file inside vdir2, it isn't included inside user quota, so we have:
|
||||||
// - vdir1/dir1/testFileName.rename
|
// - vdir1/dir1/testFileName.rename
|
||||||
// - vdir1/dir2/testFileName1
|
// - vdir1/dir2/testFileName1
|
||||||
|
@ -1929,8 +1929,8 @@ func TestQuotaRenameInsideSameVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 2, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
// rename a file inside vdir2 overwriting an existing, we now have:
|
// rename a file inside vdir2 overwriting an existing, we now have:
|
||||||
// - vdir1/dir1/testFileName.rename
|
// - vdir1/dir1/testFileName.rename
|
||||||
// - vdir1/dir2/testFileName1
|
// - vdir1/dir2/testFileName1
|
||||||
|
@ -1947,8 +1947,8 @@ func TestQuotaRenameInsideSameVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 1, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
// rename a file inside vdir1 overwriting an existing, we now have:
|
// rename a file inside vdir1 overwriting an existing, we now have:
|
||||||
// - vdir1/dir1/testFileName.rename (initial testFileName1)
|
// - vdir1/dir1/testFileName.rename (initial testFileName1)
|
||||||
// - vdir2/dir1/testFileName.rename (initial testFileName1)
|
// - vdir2/dir1/testFileName.rename (initial testFileName1)
|
||||||
|
@ -1960,8 +1960,8 @@ func TestQuotaRenameInsideSameVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -1981,8 +1981,8 @@ func TestQuotaRenameInsideSameVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -2087,8 +2087,8 @@ func TestQuotaRenameBetweenVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1+testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -2106,8 +2106,8 @@ func TestQuotaRenameBetweenVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize*2, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize*2, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize*2, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1*2, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1*2, f.UsedQuotaSize)
|
||||||
|
@ -2124,8 +2124,8 @@ func TestQuotaRenameBetweenVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1+testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1+testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -2141,8 +2141,8 @@ func TestQuotaRenameBetweenVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -2172,8 +2172,8 @@ func TestQuotaRenameBetweenVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize1*3+testFileSize*2, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize1*3+testFileSize*2, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1*3+testFileSize*2, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 5, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
|
@ -2187,8 +2187,8 @@ func TestQuotaRenameBetweenVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize1*2+testFileSize, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize1*2+testFileSize, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1*2+testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 3, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -2293,8 +2293,8 @@ func TestQuotaRenameFromVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -2312,8 +2312,8 @@ func TestQuotaRenameFromVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize+testFileSize1+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -2376,8 +2376,8 @@ func TestQuotaRenameFromVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize*3+testFileSize1*3, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize*3+testFileSize1*3, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
|
@ -2497,8 +2497,8 @@ func TestQuotaRenameToVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
// rename a file from user home dir to vdir2, vdir2 is not included in user quota so we have:
|
// rename a file from user home dir to vdir2, vdir2 is not included in user quota so we have:
|
||||||
// - /vdir2/dir1/testFileName
|
// - /vdir2/dir1/testFileName
|
||||||
// - /vdir1/dir1/testFileName1
|
// - /vdir1/dir1/testFileName1
|
||||||
|
@ -2537,8 +2537,8 @@ func TestQuotaRenameToVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -2554,8 +2554,8 @@ func TestQuotaRenameToVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -2577,8 +2577,8 @@ func TestQuotaRenameToVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize*2+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize*2+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -2595,8 +2595,8 @@ func TestQuotaRenameToVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize*2+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize*2+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize*2+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 3, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -2621,8 +2621,8 @@ func TestQuotaRenameToVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize*2+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize*2+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize*2+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 3, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1*2+testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1*2+testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -5834,8 +5834,8 @@ func TestEventActionCompressQuotaFolder(t *testing.T) {
|
||||||
assert.Equal(t, expectedQuotaSize, user.UsedQuotaSize)
|
assert.Equal(t, expectedQuotaSize, user.UsedQuotaSize)
|
||||||
vfolder, _, err := httpdtest.GetFolderByName(folderName, http.StatusOK)
|
vfolder, _, err := httpdtest.GetFolderByName(folderName, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, 2, vfolder.UsedQuotaFiles)
|
assert.Equal(t, 0, vfolder.UsedQuotaFiles)
|
||||||
assert.Equal(t, info.Size()+int64(len(testFileContent)), vfolder.UsedQuotaSize)
|
assert.Equal(t, int64(0), vfolder.UsedQuotaSize)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1517,10 +1517,11 @@ func UpdateUserQuota(user *User, filesAdd int, sizeAdd int64, reset bool) error
|
||||||
|
|
||||||
// UpdateUserFolderQuota updates the quota for the given user and virtual folder.
|
// UpdateUserFolderQuota updates the quota for the given user and virtual folder.
|
||||||
func UpdateUserFolderQuota(folder *vfs.VirtualFolder, user *User, filesAdd int, sizeAdd int64, reset bool) {
|
func UpdateUserFolderQuota(folder *vfs.VirtualFolder, user *User, filesAdd int, sizeAdd int64, reset bool) {
|
||||||
UpdateVirtualFolderQuota(&folder.BaseVirtualFolder, filesAdd, sizeAdd, reset) //nolint:errcheck
|
|
||||||
if folder.IsIncludedInUserQuota() {
|
if folder.IsIncludedInUserQuota() {
|
||||||
UpdateUserQuota(user, filesAdd, sizeAdd, reset) //nolint:errcheck
|
UpdateUserQuota(user, filesAdd, sizeAdd, reset) //nolint:errcheck
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
UpdateVirtualFolderQuota(&folder.BaseVirtualFolder, filesAdd, sizeAdd, reset) //nolint:errcheck
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateVirtualFolderQuota updates the quota for the given virtual folder adding filesAdd and sizeAdd.
|
// UpdateVirtualFolderQuota updates the quota for the given virtual folder adding filesAdd and sizeAdd.
|
||||||
|
|
|
@ -2718,6 +2718,7 @@ func TestStat(t *testing.T) {
|
||||||
|
|
||||||
func TestUploadOverwriteVfolder(t *testing.T) {
|
func TestUploadOverwriteVfolder(t *testing.T) {
|
||||||
u := getTestUser()
|
u := getTestUser()
|
||||||
|
u.QuotaFiles = 1000
|
||||||
vdir := "/vdir"
|
vdir := "/vdir"
|
||||||
mappedPath := filepath.Join(os.TempDir(), "vdir")
|
mappedPath := filepath.Join(os.TempDir(), "vdir")
|
||||||
folderName := filepath.Base(mappedPath)
|
folderName := filepath.Base(mappedPath)
|
||||||
|
@ -2749,14 +2750,24 @@ func TestUploadOverwriteVfolder(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
folder, _, err := httpdtest.GetFolderByName(folderName, http.StatusOK)
|
folder, _, err := httpdtest.GetFolderByName(folderName, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, folder.UsedQuotaSize)
|
assert.Equal(t, int64(0), folder.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, folder.UsedQuotaFiles)
|
assert.Equal(t, 0, folder.UsedQuotaFiles)
|
||||||
|
user, _, err = httpdtest.GetUserByUsername(user.Username, http.StatusOK)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
||||||
|
assert.Equal(t, 1, user.UsedQuotaFiles)
|
||||||
|
|
||||||
err = ftpUploadFile(testFilePath, path.Join(vdir, testFileName), testFileSize, client, 0)
|
err = ftpUploadFile(testFilePath, path.Join(vdir, testFileName), testFileSize, client, 0)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
folder, _, err = httpdtest.GetFolderByName(folderName, http.StatusOK)
|
folder, _, err = httpdtest.GetFolderByName(folderName, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, folder.UsedQuotaSize)
|
assert.Equal(t, int64(0), folder.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, folder.UsedQuotaFiles)
|
assert.Equal(t, 0, folder.UsedQuotaFiles)
|
||||||
|
user, _, err = httpdtest.GetUserByUsername(user.Username, http.StatusOK)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
||||||
|
assert.Equal(t, 1, user.UsedQuotaFiles)
|
||||||
|
|
||||||
err = client.Quit()
|
err = client.Quit()
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
err = os.Remove(testFilePath)
|
err = os.Remove(testFilePath)
|
||||||
|
|
|
@ -18245,7 +18245,7 @@ func TestWebAPIVFolder(t *testing.T) {
|
||||||
|
|
||||||
folder, _, err := httpdtest.GetFolderByName(folderName, http.StatusOK)
|
folder, _, err := httpdtest.GetFolderByName(folderName, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, int64(len(fileContents)), folder.UsedQuotaSize)
|
assert.Equal(t, int64(0), folder.UsedQuotaSize)
|
||||||
|
|
||||||
_, err = reader.Seek(0, io.SeekStart)
|
_, err = reader.Seek(0, io.SeekStart)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
@ -18262,7 +18262,7 @@ func TestWebAPIVFolder(t *testing.T) {
|
||||||
|
|
||||||
folder, _, err = httpdtest.GetFolderByName(folderName, http.StatusOK)
|
folder, _, err = httpdtest.GetFolderByName(folderName, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, int64(len(fileContents)), folder.UsedQuotaSize)
|
assert.Equal(t, int64(0), folder.UsedQuotaSize)
|
||||||
|
|
||||||
_, err = httpdtest.RemoveUser(user, http.StatusOK)
|
_, err = httpdtest.RemoveUser(user, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
|
|
@ -5525,13 +5525,13 @@ func TestNestedVirtualFolders(t *testing.T) {
|
||||||
|
|
||||||
folderGet, _, err = httpdtest.GetFolderByName(folderName, http.StatusOK)
|
folderGet, _, err = httpdtest.GetFolderByName(folderName, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, int64(18769), folderGet.UsedQuotaSize)
|
assert.Equal(t, int64(0), folderGet.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, folderGet.UsedQuotaFiles)
|
assert.Equal(t, 0, folderGet.UsedQuotaFiles)
|
||||||
|
|
||||||
folderGet, _, err = httpdtest.GetFolderByName(folderNameNested, http.StatusOK)
|
folderGet, _, err = httpdtest.GetFolderByName(folderNameNested, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, int64(27658), folderGet.UsedQuotaSize)
|
assert.Equal(t, int64(0), folderGet.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, folderGet.UsedQuotaFiles)
|
assert.Equal(t, 0, folderGet.UsedQuotaFiles)
|
||||||
|
|
||||||
files, err := client.ReadDir("/")
|
files, err := client.ReadDir("/")
|
||||||
if assert.NoError(t, err) {
|
if assert.NoError(t, err) {
|
||||||
|
@ -6198,8 +6198,8 @@ func TestVirtualFoldersQuotaValues(t *testing.T) {
|
||||||
assert.Equal(t, expectedQuotaSize, user.UsedQuotaSize)
|
assert.Equal(t, expectedQuotaSize, user.UsedQuotaSize)
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -6318,8 +6318,8 @@ func TestQuotaRenameInsideSameVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -6343,8 +6343,8 @@ func TestQuotaRenameInsideSameVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
// rename a file inside vdir2, it isn't included inside user quota, so we have:
|
// rename a file inside vdir2, it isn't included inside user quota, so we have:
|
||||||
// - vdir1/dir1/testFileName.rename
|
// - vdir1/dir1/testFileName.rename
|
||||||
// - vdir1/dir2/testFileName1
|
// - vdir1/dir2/testFileName1
|
||||||
|
@ -6362,8 +6362,8 @@ func TestQuotaRenameInsideSameVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 2, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
// rename a file inside vdir2 overwriting an existing, we now have:
|
// rename a file inside vdir2 overwriting an existing, we now have:
|
||||||
// - vdir1/dir1/testFileName.rename
|
// - vdir1/dir1/testFileName.rename
|
||||||
// - vdir1/dir2/testFileName1
|
// - vdir1/dir2/testFileName1
|
||||||
|
@ -6380,8 +6380,8 @@ func TestQuotaRenameInsideSameVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 1, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
// rename a file inside vdir1 overwriting an existing, we now have:
|
// rename a file inside vdir1 overwriting an existing, we now have:
|
||||||
// - vdir1/dir1/testFileName.rename (initial testFileName1)
|
// - vdir1/dir1/testFileName.rename (initial testFileName1)
|
||||||
// - vdir2/dir1/testFileName.rename (initial testFileName1)
|
// - vdir2/dir1/testFileName.rename (initial testFileName1)
|
||||||
|
@ -6393,8 +6393,8 @@ func TestQuotaRenameInsideSameVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -6414,8 +6414,8 @@ func TestQuotaRenameInsideSameVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -6536,8 +6536,8 @@ func TestQuotaRenameBetweenVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1+testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -6555,8 +6555,8 @@ func TestQuotaRenameBetweenVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize*2, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize*2, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize*2, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1*2, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1*2, f.UsedQuotaSize)
|
||||||
|
@ -6573,8 +6573,8 @@ func TestQuotaRenameBetweenVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1+testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1+testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -6590,8 +6590,8 @@ func TestQuotaRenameBetweenVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -6621,8 +6621,8 @@ func TestQuotaRenameBetweenVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize1*3+testFileSize*2, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize1*3+testFileSize*2, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1*3+testFileSize*2, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 5, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
|
@ -6636,8 +6636,8 @@ func TestQuotaRenameBetweenVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize1*2+testFileSize, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize1*2+testFileSize, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1*2+testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 3, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -6758,8 +6758,8 @@ func TestQuotaRenameFromVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -6777,8 +6777,8 @@ func TestQuotaRenameFromVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize+testFileSize1+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -6841,8 +6841,8 @@ func TestQuotaRenameFromVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize*3+testFileSize1*3, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize*3+testFileSize1*3, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
|
@ -6975,8 +6975,8 @@ func TestQuotaRenameToVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
// rename a file from user home dir to vdir2, vdir2 is not included in user quota so we have:
|
// rename a file from user home dir to vdir2, vdir2 is not included in user quota so we have:
|
||||||
// - /vdir2/dir1/testFileName
|
// - /vdir2/dir1/testFileName
|
||||||
// - /vdir1/dir1/testFileName1
|
// - /vdir1/dir1/testFileName1
|
||||||
|
@ -7015,8 +7015,8 @@ func TestQuotaRenameToVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -7032,8 +7032,8 @@ func TestQuotaRenameToVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -7055,8 +7055,8 @@ func TestQuotaRenameToVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize*2+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize*2+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -7073,8 +7073,8 @@ func TestQuotaRenameToVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize*2+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize*2+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize*2+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 3, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -7099,8 +7099,8 @@ func TestQuotaRenameToVirtualFolder(t *testing.T) {
|
||||||
assert.Equal(t, testFileSize*2+testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, testFileSize*2+testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize*2+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 3, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize1*2+testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize1*2+testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -7368,8 +7368,8 @@ func TestVFolderQuotaSize(t *testing.T) {
|
||||||
|
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize, f.UsedQuotaSize)
|
||||||
|
@ -9147,8 +9147,8 @@ func TestSSHCopy(t *testing.T) {
|
||||||
assert.Equal(t, 2*testFileSize+2*testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, 2*testFileSize+2*testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 2, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, testFileSize+testFileSize1, f.UsedQuotaSize)
|
||||||
|
@ -9226,8 +9226,8 @@ func TestSSHCopy(t *testing.T) {
|
||||||
assert.Equal(t, 5*testFileSize+4*testFileSize1, user.UsedQuotaSize)
|
assert.Equal(t, 5*testFileSize+4*testFileSize1, user.UsedQuotaSize)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, 2*testFileSize+2*testFileSize1, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, 4, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
}
|
}
|
||||||
// cross folder copy
|
// cross folder copy
|
||||||
newDir := "newdir"
|
newDir := "newdir"
|
||||||
|
@ -9923,8 +9923,8 @@ func TestGitIncludedVirtualFolders(t *testing.T) {
|
||||||
|
|
||||||
folder, _, err := httpdtest.GetFolderByName(folderName, http.StatusOK)
|
folder, _, err := httpdtest.GetFolderByName(folderName, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, user.UsedQuotaFiles, folder.UsedQuotaFiles)
|
assert.Equal(t, 0, folder.UsedQuotaFiles)
|
||||||
assert.Equal(t, user.UsedQuotaSize, folder.UsedQuotaSize)
|
assert.Equal(t, int64(0), folder.UsedQuotaSize)
|
||||||
|
|
||||||
_, err = httpdtest.RemoveUser(user, http.StatusOK)
|
_, err = httpdtest.RemoveUser(user, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
|
@ -10709,8 +10709,8 @@ func TestSCPVirtualFoldersQuota(t *testing.T) {
|
||||||
assert.Equal(t, expectedQuotaSize, user.UsedQuotaSize)
|
assert.Equal(t, expectedQuotaSize, user.UsedQuotaSize)
|
||||||
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
f, _, err := httpdtest.GetFolderByName(folderName1, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, expectedQuotaSize, f.UsedQuotaSize)
|
assert.Equal(t, int64(0), f.UsedQuotaSize)
|
||||||
assert.Equal(t, expectedQuotaFiles, f.UsedQuotaFiles)
|
assert.Equal(t, 0, f.UsedQuotaFiles)
|
||||||
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
f, _, err = httpdtest.GetFolderByName(folderName2, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, expectedQuotaSize, f.UsedQuotaSize)
|
assert.Equal(t, expectedQuotaSize, f.UsedQuotaSize)
|
||||||
|
|
|
@ -2539,6 +2539,7 @@ func TestStat(t *testing.T) {
|
||||||
|
|
||||||
func TestUploadOverwriteVfolder(t *testing.T) {
|
func TestUploadOverwriteVfolder(t *testing.T) {
|
||||||
u := getTestUser()
|
u := getTestUser()
|
||||||
|
u.QuotaFiles = 1000
|
||||||
vdir := "/vdir"
|
vdir := "/vdir"
|
||||||
mappedPath := filepath.Join(os.TempDir(), "mappedDir")
|
mappedPath := filepath.Join(os.TempDir(), "mappedDir")
|
||||||
folderName := filepath.Base(mappedPath)
|
folderName := filepath.Base(mappedPath)
|
||||||
|
@ -2585,15 +2586,25 @@ func TestUploadOverwriteVfolder(t *testing.T) {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
folder, _, err := httpdtest.GetFolderByName(folderName, http.StatusOK)
|
folder, _, err := httpdtest.GetFolderByName(folderName, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, folder.UsedQuotaSize)
|
assert.Equal(t, int64(0), folder.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, folder.UsedQuotaFiles)
|
assert.Equal(t, 0, folder.UsedQuotaFiles)
|
||||||
|
user, _, err = httpdtest.GetUserByUsername(user.Username, http.StatusOK)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
||||||
|
assert.Equal(t, 1, user.UsedQuotaFiles)
|
||||||
|
|
||||||
err = uploadFileWithRawClient(testFilePath, path.Join(vdir, testFileName), user.Username,
|
err = uploadFileWithRawClient(testFilePath, path.Join(vdir, testFileName), user.Username,
|
||||||
defaultPassword, true, testFileSize, client)
|
defaultPassword, true, testFileSize, client)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
folder, _, err = httpdtest.GetFolderByName(folderName, http.StatusOK)
|
folder, _, err = httpdtest.GetFolderByName(folderName, http.StatusOK)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.Equal(t, testFileSize, folder.UsedQuotaSize)
|
assert.Equal(t, int64(0), folder.UsedQuotaSize)
|
||||||
assert.Equal(t, 1, folder.UsedQuotaFiles)
|
assert.Equal(t, 0, folder.UsedQuotaFiles)
|
||||||
|
user, _, err = httpdtest.GetUserByUsername(user.Username, http.StatusOK)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Equal(t, testFileSize, user.UsedQuotaSize)
|
||||||
|
assert.Equal(t, 1, user.UsedQuotaFiles)
|
||||||
|
|
||||||
err = os.Remove(testFilePath)
|
err = os.Remove(testFilePath)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
_, err = httpdtest.RemoveUser(user, http.StatusOK)
|
_, err = httpdtest.RemoveUser(user, http.StatusOK)
|
||||||
|
|
Loading…
Reference in a new issue