Skip to content

Commit

Permalink
[tests-only][full-ci] adding user quota using graph api instead of Pr…
Browse files Browse the repository at this point in the history
…ovisioning 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
  • Loading branch information
S-Panta authored Jan 24, 2024
1 parent 7d6cdd6 commit be8973d
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 225 deletions.
15 changes: 7 additions & 8 deletions tests/acceptance/expected-failures-API-on-OCIS-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down
178 changes: 0 additions & 178 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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$/
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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-version> 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
Expand All @@ -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-version> 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
Expand All @@ -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
Expand All @@ -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-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
Expand All @@ -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
Expand All @@ -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-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@issue-1276 @issue-1277 @issue-1269
@issue-1276 @issue-1269

Feature: changing a public link share
As a user
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@issue-1276 @issue-1277
@issue-1276

Feature: upload to a public link share
As a user
Expand Down Expand Up @@ -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"

Expand Down
Loading

0 comments on commit be8973d

Please sign in to comment.