Skip to content

Commit

Permalink
refactored getQuota scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Panta committed Jan 3, 2024
1 parent a711cc5 commit f846b78
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 35 deletions.
30 changes: 14 additions & 16 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -4559,21 +4559,19 @@ public function theFollowingUsersShouldBeEnabled(TableNode $table):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
);
$adminUser = $this->getAdminUsername();
$bodyData = ["quota" => ["total" => (int)$quota]];
$spaceId = $this->spacesContext->getSpaceIdByName($user, "Personal");
$body = json_encode($bodyData, JSON_THROW_ON_ERROR);
if (OcisHelper::isTestingWithGraphApi()) {
$this->response = GraphHelper::updateSpace(
$this->getBaseUrl(),
$adminUser,
$this->getAdminPassword(),
$body,
$spaceId
);
}
}

/**
Expand All @@ -4597,7 +4595,7 @@ public function theQuotaOfUserHasBeenSetTo(string $user, string $quota):void {
* @return void
*/
public function adminGivesUnlimitedQuotaToUserUsingTheProvisioningApi(string $user):void {
$this->adminSetsUserQuotaToUsingTheProvisioningApi($user, 'none');
$this->adminSetsUserQuotaToUsingTheProvisioningApi($user, '0');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Feature: sharing
@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 |
Expand Down
36 changes: 18 additions & 18 deletions tests/acceptance/features/coreApiWebdavProperties1/getQuota.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@issue-1313 @skipOnGraph
@issue-1313
Feature: get quota
As a user
I want to be able to find out my available storage quota
Expand All @@ -13,7 +13,7 @@ Feature: get quota
Given using <dav-path-version> DAV path
When the administrator gives unlimited quota to user "Alice" using the provisioning API
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 |
Expand All @@ -23,9 +23,9 @@ Feature: get quota
@smokeTest
Scenario Outline: retrieving folder quota when quota is set
Given using <dav-path-version> DAV path
When the administrator sets the quota of user "Alice" to "10 MB" using the provisioning API
When the administrator sets the quota of user "Alice" to "10000" using the provisioning API
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 |
Expand All @@ -37,34 +37,34 @@ Feature: get quota
Given using <dav-path-version> 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 the quota of user "Brian" has been set to "10000"
And user "Brian" has created folder "/testquota"
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 "<folder-path>" 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 "10000"
Examples:
| dav-path-version |
| old |
| new |
| spaces |
| dav-path-version | folder-path |
| old | /Shares/testquota |
| new | /Shares/testquota |
| spaces | /testquota |


Scenario Outline: retrieving folder quota when quota is set and a file was uploaded
Given using <dav-path-version> DAV path
And the quota of user "Alice" has been set to "1 KB"
And the quota of user "Alice" has been set to "10000"
And user "Alice" has uploaded file "/prueba.txt" of size 93 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 "10000"
Examples:
| dav-path-version |
| old |
Expand All @@ -75,14 +75,14 @@ Feature: get quota
Scenario Outline: retrieving folder quota when quota is set and a file was received
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 "1 KB"
And the quota of user "Brian" has been set 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 |
Expand Down

0 comments on commit f846b78

Please sign in to comment.