From be8973def1604ee9979c88a64ab891be4e2b630d Mon Sep 17 00:00:00 2001 From: Sabin Panta <64484313+S-Panta@users.noreply.github.com> Date: Wed, 24 Jan 2024 10:12:42 +0545 Subject: [PATCH] [tests-only][full-ci] adding user quota using graph api instead of Provisioning api (#7000) * refactored getQuota scenario * deleted quota step inside provisioning file * updating feature file of quota as per graphapi * updated expected failures file * updated expected failures file * removed issue tag --- .../expected-failures-API-on-OCIS-storage.md | 15 +- .../features/bootstrap/Provisioning.php | 178 ------------------ .../uploadToShare.feature | 20 +- .../changingPublicLinkShare.feature | 2 +- .../uploadToPublicLinkShare.feature | 8 +- .../coreApiWebdavProperties/getQuota.feature | 49 ++--- 6 files changed, 47 insertions(+), 225 deletions(-) diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 763f401dec6..a91c9f7ef19 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -125,10 +125,14 @@ cannot share a folder with create permission - [coreApiSharePublicLink2/uploadToPublicLinkShare.feature:13](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/uploadToPublicLinkShare.feature#L13) - [coreApiSharePublicLink2/uploadToPublicLinkShare.feature:121](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/uploadToPublicLinkShare.feature#L121) -#### [Set quota over settings](https://github.com/owncloud/ocis/issues/1290) +#### [d:quota-available-bytes in dprop of PROPFIND give wrong response value](https://github.com/owncloud/ocis/issues/8197) -- [coreApiSharePublicLink2/uploadToPublicLinkShare.feature:91](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/uploadToPublicLinkShare.feature#L91) -- [coreApiSharePublicLink2/uploadToPublicLinkShare.feature:101](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/uploadToPublicLinkShare.feature#L101) +- [coreApiWebdavProperties/getQuota.feature:55](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/getQuota.feature#L55) +- [coreApiWebdavProperties/getQuota.feature:56](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/getQuota.feature#L56) +- [coreApiWebdavProperties/getQuota.feature:57](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/getQuota.feature#L57) +- [coreApiWebdavProperties/getQuota.feature:71](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/getQuota.feature#L71) +- [coreApiWebdavProperties/getQuota.feature:72](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/getQuota.feature#L72) +- [coreApiWebdavProperties/getQuota.feature:73](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/getQuota.feature#L73) #### [deleting a file inside a received shared folder is moved to the trash-bin of the sharer not the receiver](https://github.com/owncloud/ocis/issues/1124) @@ -144,11 +148,6 @@ cannot share a folder with create permission - [coreApiTrashbin/trashbinSharingToShares.feature:201](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiTrashbin/trashbinSharingToShares.feature#L201) - [coreApiTrashbin/trashbinSharingToShares.feature:224](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiTrashbin/trashbinSharingToShares.feature#L224) -#### [changing user quota gives ocs status 103 / Cannot set quota](https://github.com/owncloud/product/issues/247) - -- [coreApiShareOperationsToShares2/uploadToShare.feature:202](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareOperationsToShares2/uploadToShare.feature#L202) -- [coreApiShareOperationsToShares2/uploadToShare.feature:203](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareOperationsToShares2/uploadToShare.feature#L203) - #### [Expiration date for shares is not implemented](https://github.com/owncloud/ocis/issues/1250) #### Expiration date of user shares diff --git a/tests/acceptance/features/bootstrap/Provisioning.php b/tests/acceptance/features/bootstrap/Provisioning.php index 1ef51bd4bf3..0f28e7c1904 100644 --- a/tests/acceptance/features/bootstrap/Provisioning.php +++ b/tests/acceptance/features/bootstrap/Provisioning.php @@ -1937,122 +1937,6 @@ public function userChangesTheDisplayNameOfUserUsingKey( ); } - /** - * @When /^the administrator changes the quota of user "([^"]*)" to "([^"]*)" using the provisioning API$/ - * - * @param string $user - * @param string $quota - * - * @return void - */ - public function adminChangesTheQuotaOfUserUsingTheProvisioningApi( - string $user, - string $quota - ):void { - $result = UserHelper::editUser( - $this->getBaseUrl(), - $this->getActualUsername($user), - 'quota', - $quota, - $this->getAdminUsername(), - $this->getAdminPassword(), - $this->getStepLineRef(), - $this->ocsApiVersion - ); - $this->response = $result; - } - - /** - * @Given /^the administrator has (?:changed|set) the quota of user "([^"]*)" to "([^"]*)"$/ - * - * @param string $user - * @param string $quota - * - * @return void - */ - public function adminHasChangedTheQuotaOfUserTo( - string $user, - string $quota - ):void { - $user = $this->getActualUsername($user); - $this->adminChangesTheQuotaOfUserUsingTheProvisioningApi( - $user, - $quota - ); - $this->theHTTPStatusCodeShouldBe( - 200, - "could not change quota of user $user" - ); - } - - /** - * @param string $requestingUser - * @param string $targetUser - * @param string $quota - * - * @return ResponseInterface - */ - public function userChangeQuotaOfUserUsingProvisioningApi( - string $requestingUser, - string $targetUser, - string $quota - ):ResponseInterface { - return UserHelper::editUser( - $this->getBaseUrl(), - $this->getActualUsername($targetUser), - 'quota', - $quota, - $this->getActualUsername($requestingUser), - $this->getPasswordForUser($requestingUser), - $this->getStepLineRef(), - $this->ocsApiVersion - ); - } - - /** - * @When /^user "([^"]*)" changes the quota of user "([^"]*)" to "([^"]*)" using the provisioning API$/ - * - * @param string $requestingUser - * @param string $targetUser - * @param string $quota - * - * @return void - */ - public function userChangesTheQuotaOfUserUsingTheProvisioningApi( - string $requestingUser, - string $targetUser, - string $quota - ):void { - $this->response = $this->userChangeQuotaOfUserUsingProvisioningApi( - $requestingUser, - $targetUser, - $quota - ); - $this->pushToLastStatusCodesArrays(); - } - - /** - * @Given /^user "([^"]*)" has changed the quota of user "([^"]*)" to "([^"]*)"$/ - * - * @param string $requestingUser - * @param string $targetUser - * @param string $quota - * - * @return void - */ - public function userHasChangedTheQuotaOfUserUsingTheProvisioningApi( - string $requestingUser, - string $targetUser, - string $quota - ):void { - $response = $this->userChangeQuotaOfUserUsingProvisioningApi( - $requestingUser, - $targetUser, - $quota - ); - $this->theHTTPStatusCodeShouldBeBetween(200, 299, $response); - } - /** * @param string $user * @@ -4450,68 +4334,6 @@ public function theFollowingUsersShouldBeEnabled(TableNode $table):void { } } - /** - * @When the administrator sets the quota of user :user to :quota using the provisioning API - * - * @param string $user - * @param string $quota - * - * @return void - */ - public function adminSetsUserQuotaToUsingTheProvisioningApi(string $user, string $quota):void { - $user = $this->getActualUsername($user); - $body - = [ - 'key' => 'quota', - 'value' => $quota, - ]; - - $this->response = OcsApiHelper::sendRequest( - $this->getBaseUrl(), - $this->getAdminUsername(), - $this->getAdminPassword(), - "PUT", - "/cloud/users/$user", - $this->getStepLineRef(), - $body - ); - } - - /** - * @Given the quota of user :user has been set to :quota - * - * @param string $user - * @param string $quota - * - * @return void - */ - public function theQuotaOfUserHasBeenSetTo(string $user, string $quota):void { - $this->adminSetsUserQuotaToUsingTheProvisioningApi($user, $quota); - $this->theHTTPStatusCodeShouldBe(200); - } - - /** - * @When the administrator gives unlimited quota to user :user using the provisioning API - * - * @param string $user - * - * @return void - */ - public function adminGivesUnlimitedQuotaToUserUsingTheProvisioningApi(string $user):void { - $this->adminSetsUserQuotaToUsingTheProvisioningApi($user, 'none'); - } - - /** - * @Given user :user has been given unlimited quota - * - * @param string $user - * - * @return void - */ - public function userHasBeenGivenUnlimitedQuota(string $user):void { - $this->theQuotaOfUserHasBeenSetTo($user, 'none'); - } - /** * @Then /^the user attributes returned by the API should include$/ * diff --git a/tests/acceptance/features/coreApiShareOperationsToShares2/uploadToShare.feature b/tests/acceptance/features/coreApiShareOperationsToShares2/uploadToShare.feature index 0661926f967..8e3e43e0016 100644 --- a/tests/acceptance/features/coreApiShareOperationsToShares2/uploadToShare.feature +++ b/tests/acceptance/features/coreApiShareOperationsToShares2/uploadToShare.feature @@ -140,11 +140,11 @@ Feature: sharing | old | | new | - @smokeTest @skipOnGraph + @smokeTest Scenario Outline: check quota of owners parent directory of a shared file Given using DAV path And user "Brian" has been created with default attributes and without skeleton files - And the quota of user "Brian" has been set to "0" + And user "Admin" has changed the quota of the personal space of "Brian Murphy" space to "0" And user "Alice" has uploaded file "filesForUpload/lorem.txt" to "/myfile.txt" And user "Alice" has shared file "myfile.txt" with user "Brian" When user "Brian" uploads file "filesForUpload/textfile.txt" to "/Shares/myfile.txt" using the WebDAV API @@ -162,17 +162,17 @@ Feature: sharing | old | | new | - @skipOnGraph + Scenario Outline: uploading to a user shared folder with read/write permission when the sharer has insufficient quota does not work Given using DAV path - And user "Brian" has been created with default attributes and small skeleton files + And user "Brian" has been created with default attributes and without skeleton files And user "Alice" has created folder "FOLDER" And user "Alice" has created a share with settings | path | FOLDER | | shareType | user | | permissions | change | | shareWith | Brian | - And the quota of user "Alice" has been set to "0" + And user "Admin" has changed the quota of the personal space of "Alice Hansen" space to "1" When user "Brian" uploads file "filesForUpload/textfile.txt" to "/Shares/FOLDER/myfile.txt" using the WebDAV API Then the HTTP status code should be "507" And as "Alice" file "/FOLDER/myfile.txt" should not exist @@ -193,7 +193,7 @@ Feature: sharing | shareType | group | | permissions | change | | shareWith | grp1 | - And the quota of user "Alice" has been set to "0" + And user "Admin" has changed the quota of the personal space of "Alice Hansen" space to "1" When user "Brian" uploads file "filesForUpload/textfile.txt" to "/Shares/FOLDER/myfile.txt" using the WebDAV API Then the HTTP status code should be "507" And as "Alice" file "/FOLDER/myfile.txt" should not exist @@ -202,7 +202,7 @@ Feature: sharing | old | | new | - @skipOnGraph + Scenario Outline: uploading to a user shared folder with upload-only permission when the sharer has insufficient quota does not work Given using DAV path And user "Brian" has been created with default attributes and without skeleton files @@ -212,7 +212,7 @@ Feature: sharing | shareType | user | | permissions | create | | shareWith | Brian | - And the quota of user "Alice" has been set to "0" + And user "Admin" has changed the quota of the personal space of "Alice Hansen" space to "1" When user "Brian" uploads file "filesForUpload/textfile.txt" to "/Shares/FOLDER/myfile.txt" using the WebDAV API Then the HTTP status code should be "507" And as "Alice" file "/FOLDER/myfile.txt" should not exist @@ -221,7 +221,7 @@ Feature: sharing | old | | new | - @skipOnGraph + Scenario Outline: uploading to a group shared folder with upload-only permission when the sharer has insufficient quota does not work Given using DAV path And user "Brian" has been created with default attributes and without skeleton files @@ -233,7 +233,7 @@ Feature: sharing | shareType | group | | permissions | create | | shareWith | grp1 | - And the quota of user "Alice" has been set to "0" + And user "Admin" has changed the quota of the personal space of "Alice Hansen" space to "1" When user "Brian" uploads file "filesForUpload/textfile.txt" to "/Shares/FOLDER/myfile.txt" using the WebDAV API Then the HTTP status code should be "507" And as "Alice" file "/FOLDER/myfile.txt" should not exist diff --git a/tests/acceptance/features/coreApiSharePublicLink1/changingPublicLinkShare.feature b/tests/acceptance/features/coreApiSharePublicLink1/changingPublicLinkShare.feature index a06d0eb26b8..14ea10de4d1 100644 --- a/tests/acceptance/features/coreApiSharePublicLink1/changingPublicLinkShare.feature +++ b/tests/acceptance/features/coreApiSharePublicLink1/changingPublicLinkShare.feature @@ -1,4 +1,4 @@ -@issue-1276 @issue-1277 @issue-1269 +@issue-1276 @issue-1269 Feature: changing a public link share As a user diff --git a/tests/acceptance/features/coreApiSharePublicLink2/uploadToPublicLinkShare.feature b/tests/acceptance/features/coreApiSharePublicLink2/uploadToPublicLinkShare.feature index 6ce38263778..c8ba39ab75d 100644 --- a/tests/acceptance/features/coreApiSharePublicLink2/uploadToPublicLinkShare.feature +++ b/tests/acceptance/features/coreApiSharePublicLink2/uploadToPublicLinkShare.feature @@ -1,4 +1,4 @@ -@issue-1276 @issue-1277 +@issue-1276 Feature: upload to a public link share As a user @@ -93,17 +93,17 @@ Feature: upload to a public link share | path | FOLDER | | permissions | change | | password | %public% | - And the quota of user "Alice" has been set to "0" + And user "Admin" has changed the quota of the personal space of "Alice Hansen" space to "1" When the public uploads file "test.txt" with password "%public%" and content "test2" using the new public WebDAV API Then the HTTP status code should be "507" - @issue-1290 + Scenario: uploading file to a public shared folder with upload-only permission when the sharer has insufficient quota does not work with public API Given user "Alice" has created a public link share with settings | path | FOLDER | | permissions | create | | password | %public% | - And the quota of user "Alice" has been set to "0" + And user "Admin" has changed the quota of the personal space of "Alice Hansen" space to "1" When the public uploads file "test.txt" with password "%public%" and content "test2" using the new public WebDAV API Then the HTTP status code should be "507" diff --git a/tests/acceptance/features/coreApiWebdavProperties/getQuota.feature b/tests/acceptance/features/coreApiWebdavProperties/getQuota.feature index 631b7d9d275..68117166606 100644 --- a/tests/acceptance/features/coreApiWebdavProperties/getQuota.feature +++ b/tests/acceptance/features/coreApiWebdavProperties/getQuota.feature @@ -1,4 +1,4 @@ -@issue-1313 @skipOnGraph +@issue-1313 @skipOnReva Feature: get quota As a user I want to be able to find out my available storage quota @@ -11,9 +11,9 @@ Feature: get quota Scenario Outline: retrieving folder quota when no quota is set Given using DAV path - When the administrator gives unlimited quota to user "Alice" using the provisioning API + When user "Admin" changes the quota of the "Alice Hansen" space to "0" Then the HTTP status code should be "200" - And as user "Alice" folder "/" should contain a property "d:quota-available-bytes" with value "-3" + And as user "Alice" folder "/" should contain a property "d:quota-available-bytes" with value "0" Examples: | dav-path-version | | old | @@ -23,66 +23,67 @@ Feature: get quota @smokeTest Scenario Outline: retrieving folder quota when quota is set Given using DAV path - When the administrator sets the quota of user "Alice" to "10 MB" using the provisioning API + When user "Admin" changes the quota of the "Alice Hansen" space to "10000" Then the HTTP status code should be "200" - And as user "Alice" folder "/" should contain a property "d:quota-available-bytes" with value "10485406" + And as user "Alice" folder "/" should contain a property "d:quota-available-bytes" with value "10000" Examples: | dav-path-version | | old | | new | | spaces | - + @issue-8197 Scenario Outline: retrieving folder quota of shared folder with quota when no quota is set for recipient Given using DAV path And user "Brian" has been created with default attributes and without skeleton files - And user "Alice" has been given unlimited quota - And the quota of user "Brian" has been set to "10 MB" + And user "Admin" has changed the quota of the personal space of "Alice Hansen" space to "0" + And user "Admin" has changed the quota of the personal space of "Brian Murphy" space to "10000" And user "Brian" has created folder "/testquota" + And user "Brian" has uploaded file "/testquota/Brian.txt" of size 1000 bytes And user "Brian" has created a share with settings | path | testquota | | shareType | user | | permissions | all | | shareWith | Alice | - When user "Alice" gets the following properties of folder "/testquota" using the WebDAV API + When user "Alice" gets the following properties of folder "" inside space "Shares" using the WebDAV API | propertyName | | d:quota-available-bytes | - Then the HTTP status code should be "200" - And the single response should contain a property "d:quota-available-bytes" with value "10485406" + Then the HTTP status code should be "207" + And the single response should contain a property "d:quota-available-bytes" with value "9000" Examples: - | dav-path-version | - | old | - | new | - | spaces | - + | dav-path-version | folder-path | + | old | /Shares/testquota | + | new | /Shares/testquota | + | spaces | /testquota | + @issue-8197 Scenario Outline: retrieving folder quota when quota is set and a file was uploaded Given using DAV path - And the quota of user "Alice" has been set to "1 KB" - And user "Alice" has uploaded file "/prueba.txt" of size 93 bytes + And user "Admin" has changed the quota of the personal space of "Alice Hansen" space to "10000" + And user "Alice" has uploaded file "/prueba.txt" of size 1000 bytes When user "Alice" gets the following properties of folder "/" using the WebDAV API | propertyName | | d:quota-available-bytes | - Then the HTTP status code should be "201" - And the single response should contain a property "d:quota-available-bytes" with value "577" + Then the HTTP status code should be "207" + And the single response should contain a property "d:quota-available-bytes" with value "9000" Examples: | dav-path-version | | old | | new | | spaces | - @skipOnReva + Scenario Outline: retrieving folder quota when quota is set and a file was received Given using DAV path And user "Brian" has been created with default attributes and without skeleton files - And the quota of user "Brian" has been set to "1 KB" + And user "Admin" has changed the quota of the personal space of "Brian Murphy" space to "10000" And user "Alice" has uploaded file "/Alice.txt" of size 93 bytes And user "Alice" has shared file "Alice.txt" with user "Brian" When user "Brian" gets the following properties of folder "/" using the WebDAV API | propertyName | | d:quota-available-bytes | - Then the HTTP status code should be "200" - And the single response should contain a property "d:quota-available-bytes" with value "670" + Then the HTTP status code should be "207" + And the single response should contain a property "d:quota-available-bytes" with value "10000" Examples: | dav-path-version | | old |