From 4911a4b084757094cb00b8ea3d1c387a7e411a3c Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Fri, 17 Jun 2022 12:49:20 +0545 Subject: [PATCH 1/2] added bug demonstration quota tests --- .../apiEncryption/quotaOc10Issue40140.feature | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 tests/acceptance/features/apiEncryption/quotaOc10Issue40140.feature diff --git a/tests/acceptance/features/apiEncryption/quotaOc10Issue40140.feature b/tests/acceptance/features/apiEncryption/quotaOc10Issue40140.feature new file mode 100644 index 00000000..54a8988d --- /dev/null +++ b/tests/acceptance/features/apiEncryption/quotaOc10Issue40140.feature @@ -0,0 +1,67 @@ +@api @issue-40140 +Feature: quota + + Background: + Given using OCS API version "1" + And user "Alice" has been created with default attributes and without skeleton files + + @files_sharing-app-required + Scenario: share receiver with insufficient quota should not be able to copy received shared file to home folder + Given the administrator has set the default folder for received shares to "Shares" + And auto-accept shares has been disabled + And user "Brian" has been created with default attributes and without skeleton files + And the quota of user "Brian" has been set to "10 B" + And the quota of user "Alice" has been set to "10 MB" + And user "Alice" has uploaded file with content "test-content-15" to "/testquota.txt" + And user "Alice" has shared file "/testquota.txt" with user "Brian" + And user "Brian" has accepted share "/testquota.txt" offered by user "Alice" + When user "Brian" copies file "/Shares/testquota.txt" to "/testquota.txt" using the WebDAV API + # The status indicates that the copy was successful, but actually the copied file does not exist + # The status is misleading + Then the HTTP status code should be "201" + #Then the HTTP status code should be "507" + #And the DAV exception should be "Sabre\DAV\Exception\InsufficientStorage" + # And as "Brian" file "/testquota.txt" should not exist + And as "Brian" file "/testquota.txt" should exist + + @files_sharing-app-required + Scenario: share receiver with insufficient quota should not be able to copy file from shared folder to home folder + Given the administrator has set the default folder for received shares to "Shares" + And auto-accept shares has been disabled + And user "Brian" has been created with default attributes and without skeleton files + And the quota of user "Brian" has been set to "10 B" + And the quota of user "Alice" has been set to "10 MB" + And user "Alice" has created folder "shareFolder" + And user "Alice" has uploaded file with content "test-content-15" to "/shareFolder/testquota.txt" + And user "Alice" has shared folder "/shareFolder" with user "Brian" + And user "Brian" has accepted share "/shareFolder" offered by user "Alice" + When user "Brian" copies file "/Shares/shareFolder/testquota.txt" to "/testquota.txt" using the WebDAV API + # The status indicates that the copy was successful, but actually the copied file does not exist + # The status is misleading + Then the HTTP status code should be "201" + #Then the HTTP status code should be "507" + #And the DAV exception should be "Sabre\DAV\Exception\InsufficientStorage" + # And as "Brian" file "/testquota.txt" should not exist + And as "Brian" file "/testquota.txt" should exist + + @files_sharing-app-required + Scenario: share receiver of a share with insufficient quota should not be able to copy file from home folder to the received shared folder + Given the administrator has set the default folder for received shares to "Shares" + And auto-accept shares has been disabled + And user "Brian" has been created with default attributes and without skeleton files + And the quota of user "Brian" has been set to "10 MB" + And the quota of user "Alice" has been set to "10 B" + And user "Alice" has created folder "shareFolder" + And user "Alice" has shared folder "/shareFolder" with user "Brian" + And user "Brian" has accepted share "/shareFolder" offered by user "Alice" + And user "Brian" has uploaded file with content "test-content-15" to "/testquota.txt" + When user "Brian" copies file "/testquota.txt" to "/Shares/shareFolder/testquota.txt" using the WebDAV API + # The status indicates that the copy was successful, but actually the copied file does not exist + # The status is misleading + Then the HTTP status code should be "201" + #Then the HTTP status code should be "507" + #And the DAV exception should be "Sabre\DAV\Exception\InsufficientStorage" + And as "Brian" file "/testquota.txt" should exist + # The copy should have failed, so Alice should not see the file + # And as "Alice" file "/shareFolder/testquota.txt" should not exist + And as "Alice" file "/shareFolder/testquota.txt" should exist From d8574cb2112d1976632b4cbd653737dc0ece14ea Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Fri, 17 Jun 2022 13:50:32 +0545 Subject: [PATCH 2/2] Adjust comment about bad behavior because in the case of encryption, the file does exist and the quota is exceeded. --- .../features/apiEncryption/quotaOc10Issue40140.feature | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/acceptance/features/apiEncryption/quotaOc10Issue40140.feature b/tests/acceptance/features/apiEncryption/quotaOc10Issue40140.feature index 54a8988d..bc87bd5d 100644 --- a/tests/acceptance/features/apiEncryption/quotaOc10Issue40140.feature +++ b/tests/acceptance/features/apiEncryption/quotaOc10Issue40140.feature @@ -16,8 +16,7 @@ Feature: quota And user "Alice" has shared file "/testquota.txt" with user "Brian" And user "Brian" has accepted share "/testquota.txt" offered by user "Alice" When user "Brian" copies file "/Shares/testquota.txt" to "/testquota.txt" using the WebDAV API - # The status indicates that the copy was successful, but actually the copied file does not exist - # The status is misleading + # The status indicates that the copy was successful, but actually 507 InsufficientStorage should happen Then the HTTP status code should be "201" #Then the HTTP status code should be "507" #And the DAV exception should be "Sabre\DAV\Exception\InsufficientStorage" @@ -36,8 +35,7 @@ Feature: quota And user "Alice" has shared folder "/shareFolder" with user "Brian" And user "Brian" has accepted share "/shareFolder" offered by user "Alice" When user "Brian" copies file "/Shares/shareFolder/testquota.txt" to "/testquota.txt" using the WebDAV API - # The status indicates that the copy was successful, but actually the copied file does not exist - # The status is misleading + # The status indicates that the copy was successful, but actually 507 InsufficientStorage should happen Then the HTTP status code should be "201" #Then the HTTP status code should be "507" #And the DAV exception should be "Sabre\DAV\Exception\InsufficientStorage" @@ -56,8 +54,7 @@ Feature: quota And user "Brian" has accepted share "/shareFolder" offered by user "Alice" And user "Brian" has uploaded file with content "test-content-15" to "/testquota.txt" When user "Brian" copies file "/testquota.txt" to "/Shares/shareFolder/testquota.txt" using the WebDAV API - # The status indicates that the copy was successful, but actually the copied file does not exist - # The status is misleading + # The status indicates that the copy was successful, but actually 507 InsufficientStorage should happen Then the HTTP status code should be "201" #Then the HTTP status code should be "507" #And the DAV exception should be "Sabre\DAV\Exception\InsufficientStorage"