Skip to content

Commit

Permalink
Api tests for deleting the expiration date of a space
Browse files Browse the repository at this point in the history
  • Loading branch information
SwikritiT committed Feb 21, 2023
1 parent 22f3577 commit 3dc0cdc
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 4 deletions.
42 changes: 41 additions & 1 deletion tests/acceptance/features/apiSpacesShares/shareSpaces.feature
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,44 @@ Feature: Share spaces
| role |
| manager |
| editor |
| viewer |
| viewer |


Scenario Outline: delete 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 | |
| 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 ""
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 | |
| 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 ""
Examples:
| role |
| manager |
| editor |
| viewer |
5 changes: 2 additions & 3 deletions tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SpacesContext implements Context {
* @var ChecksumContext
*/
private ChecksumContext $checksumContext;

/**
* @var FilesVersionsContext
*/
Expand Down Expand Up @@ -3228,8 +3228,7 @@ public function theUserShouldHaveSpaceWithRecipient(
foreach ($spaceAsArray['root']['permissions'] as $permission) {
if (isset($permission['grantedToIdentities'][0][$recipientType]) && $permission['roles'][0] === $role && $permission['grantedToIdentities'][0][$recipientType]['id'] === $recipientId) {
$foundRoleInResponse = true;
if ($expirationDate !== null) {
Assert::assertArrayHasKey('expirationDateTime', $permission, 'expirationDateTime key not found in response');
if ($expirationDate !== null && isset($permission['expirationDateTime'])) {
Assert::assertEquals($expirationDate, (preg_split("/[\sT]+/", $permission['expirationDateTime']))[0], "$expirationDate is different in the response");
}
break;
Expand Down

0 comments on commit 3dc0cdc

Please sign in to comment.