App tests for updating the exoiration date of a space (#5605)

This commit is contained in:
Swikriti Tripathi
2023-02-22 09:21:57 +05:45
committed by GitHub
parent 04afa6d35a
commit 77e9d4f920
2 changed files with 46 additions and 5 deletions
@@ -294,7 +294,7 @@ Feature: Share spaces
| role | viewer |
When user "Brian" uploads a file inside space "share space" with content "Test" to "test.txt" using the WebDAV API
Then the HTTP status code should be "403"
When user "Alice" has shared a space "share space" with settings:
When user "Alice" shares a space "share space" with settings:
| shareWith | Brian |
| role | editor |
Then the HTTP status code should be "200"
@@ -310,7 +310,7 @@ Feature: Share spaces
| role | viewer |
When user "Brian" uploads a file inside space "share space" with content "Test" to "test.txt" using the WebDAV API
Then the HTTP status code should be "403"
When user "Alice" has shared a space "share space" with settings:
When user "Alice" shares a space "share space" with settings:
| shareWith | sales |
| shareType | 8 |
| role | editor |
@@ -347,4 +347,44 @@ Feature: Share spaces
| role |
| manager |
| editor |
| viewer |
| viewer |
Scenario Outline: update the expiration date of a space in user share
Given user "Alice" has shared a space "share space" with settings:
| shareWith | Brian |
| role | <role> |
| expireDate | 2042-03-25T23:59:59+0100 |
When user "Alice" updates the space "share space" with settings:
| shareWith | Brian |
| expireDate | 2044-01-01T23:59:59.999+01:00 |
| role | <role> |
Then the HTTP status code should be "200"
And the user "Brian" should have a space called "share space" granted to user "Brian" with role "<role>" and expiration date "2044-01-01"
Examples:
| role |
| manager |
| editor |
| viewer |
Scenario Outline: update the expiration date of a space in group share
Given group "sales" has been created
And the administrator has added a user "Brian" to the group "sales" using GraphApi
And user "Alice" has shared a space "share space" with settings:
| shareWith | sales |
| shareType | 8 |
| role | <role> |
| expireDate | 2042-03-25T23:59:59+0100 |
When user "Alice" updates the space "share space" with settings:
| shareWith | sales |
| shareType | 8 |
| expireDate | 2044-01-01T23:59:59.999+01:00 |
| role | <role> |
Then the HTTP status code should be "200"
And the user "Brian" should have a space called "share space" granted to group "sales" with role "<role>" and expiration date "2044-01-01"
Examples:
| role |
| manager |
| editor |
| viewer |
@@ -69,7 +69,7 @@ class SpacesContext implements Context {
* @var ChecksumContext
*/
private ChecksumContext $checksumContext;
/**
* @var FilesVersionsContext
*/
@@ -1906,9 +1906,10 @@ class SpacesContext implements Context {
$space = $this->getSpaceByName($user, $spaceName);
$availableRoleToAssignToShareSpace = ['manager', 'editor', 'viewer'];
$rows = $table->getRowsHash();
if (!\in_array(\strtolower($rows['role']), $availableRoleToAssignToShareSpace)) {
if (isset($rows['role']) && !\in_array(\strtolower($rows['role']), $availableRoleToAssignToShareSpace)) {
throw new Error("The Selected " . $rows['role'] . " Cannot be Found");
}
$rows["role"] = \array_key_exists("role", $rows) ? $rows["role"] : "viewer";
$rows["shareType"] = \array_key_exists("shareType", $rows) ? $rows["shareType"] : 7;
$rows["expireDate"] = \array_key_exists("expireDate", $rows) ? $rows["expireDate"] : null;