Skip to content

Commit

Permalink
updated feature file for user quota
Browse files Browse the repository at this point in the history
  • Loading branch information
S-Panta committed Jan 2, 2024
1 parent 64132b0 commit da17489
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 32 deletions.
43 changes: 26 additions & 17 deletions tests/acceptance/features/bootstrap/Provisioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -4550,7 +4550,7 @@ public function theFollowingUsersShouldBeEnabled(TableNode $table):void {
}

/**
* @When the administrator sets the quota of user :user to :quota using the provisioning API
* @When the administrator sets the quota of user :user to :quota bytes using the provisioning API
*
* @param string $user
* @param string $quota
Expand All @@ -4559,21 +4559,30 @@ public function theFollowingUsersShouldBeEnabled(TableNode $table):void {
*/
public function adminSetsUserQuotaToUsingTheProvisioningApi(string $user, string $quota):void {
$user = $this->getActualUsername($user);
$body
= [
'key' => 'quota',
'value' => $quota,
];
$adminUser = $this->getAdminUsername();
$bodyData = ["quota" => ["total" => (int)$quota]];
$spaceId = $this->spacesContext->getSpaceIdByName($user, "Personal");
$body = json_encode($bodyData, JSON_THROW_ON_ERROR);

$this->response = OcsApiHelper::sendRequest(
$this->getBaseUrl(),
$this->getAdminUsername(),
$this->getAdminPassword(),
"PUT",
"/cloud/users/$user",
$this->getStepLineRef(),
$body
);
if (OcisHelper::isTestingWithGraphApi()) {
$this->response = GraphHelper::updateSpace(
$this->getBaseUrl(),
$adminUser,
$this->getAdminPassword(),
$body,
$spaceId
);
} else {
$this->response = OcsApiHelper::sendRequest(
$this->getBaseUrl(),
$this->getAdminUsername(),
$this->getAdminPassword(),
"PUT",
"/cloud/users/$user",
$this->getStepLineRef(),
$body
);
}
}

/**
Expand All @@ -4597,7 +4606,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 All @@ -4608,7 +4617,7 @@ public function adminGivesUnlimitedQuotaToUserUsingTheProvisioningApi(string $us
* @return void
*/
public function userHasBeenGivenUnlimitedQuota(string $user):void {
$this->theQuotaOfUserHasBeenSetTo($user, 'none');
$this->theQuotaOfUserHasBeenSetTo($user, "0");
}

/**
Expand Down
29 changes: 14 additions & 15 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" bytes 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,33 @@ 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 "/Shares/testquota" 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 |


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 "1000"
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 "1000"
Examples:
| dav-path-version |
| old |
Expand All @@ -75,14 +74,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 "1000"
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 "1000"
Examples:
| dav-path-version |
| old |
Expand Down

0 comments on commit da17489

Please sign in to comment.