Skip to content

Commit

Permalink
adding test for deleting/removing share link of a project space using…
Browse files Browse the repository at this point in the history
… root endpoint
  • Loading branch information
nirajacharya2 committed May 22, 2024
1 parent bac3777 commit 4e02be4
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/acceptance/features/apiSharingNgLinkShare/linkShare.feature
Original file line number Diff line number Diff line change
Expand Up @@ -769,6 +769,7 @@ Feature: Create a share link for a resource
"""
And the public should be able to download file "textfile1.txt" from the last link share with password "%public%" and the content should be "other data"


Scenario: update password of a file's link share
Given user "Alice" has uploaded file with content "other data" to "textfile1.txt"
And user "Alice" has created the following resource link share:
Expand Down Expand Up @@ -2300,3 +2301,15 @@ Feature: Create a share link for a resource
"""
And the public should be able to download file "textfile.txt" from the last link share with password "%public%" and the content should be "to share"
And the public download of file "textfile.txt" from the last link share with password "$heLlo*1234*" should fail with HTTP status code "401" using shareNg


Scenario: remove of link share of project drive
Given using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "projectSpace" with the default quota using the Graph API
And user "Alice" has created the following space link share:
| space | projectSpace |
| permissionsRole | view |
| password | $heLlo*1234* |
When user "Alice" removes the link share of space "projectSpace"
Then the HTTP status code should be "204"
45 changes: 45 additions & 0 deletions tests/acceptance/features/bootstrap/SharingNgContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -1528,4 +1528,49 @@ public function userTriesToListThePermissionsOfSpaceOwnedByUsingRootEndpointOfTh
);
$this->featureContext->setResponse($response);
}

/**
* Delete link share using drives.root endpoint
*
* @param string $user
* @param string $space
* @param string $permissionID
*
* @return ResponseInterface
*/
public function deleteResourceShareLink(string $user, string $space, string $permissionID):ResponseInterface {
if ($space === 'Personal' || $space === 'Shares') {
$space = $this->spacesContext->getSpaceByName($user, $space);
} else {
$space = $this->spacesContext->getCreatedSpace($space);
}
return GraphHelper::removeAccessToSpace(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$user,
$this->featureContext->getPasswordForUser($user),
$space["id"],
$permissionID
);
}

/**
* @When user :user delets the link share of space :space
*
* @param string $user
* @param string $space
*
* @return void
*/
public function userDeletsTheLinkShare(string $user, string $space):void {
$response = $this->featureContext->shareNgGetLastCreatedLinkShare();
$permissionID = json_decode($response->getBody()->getContents())->id;
$this->featureContext->setResponse(
$this->deleteResourceShareLink(
$user,
$space,
$permissionID
)
);
}
}

0 comments on commit 4e02be4

Please sign in to comment.