Added test to send share invitation with user for deleted file
This commit is contained in:
@@ -1947,3 +1947,45 @@ Feature: Send a sharing invitations
|
|||||||
| Space Editor |
|
| Space Editor |
|
||||||
| Co Owner |
|
| Co Owner |
|
||||||
| Manager |
|
| Manager |
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: send share invitation to user for deleted file
|
||||||
|
Given user "Alice" has uploaded file with content "to share" to "textfile1.txt"
|
||||||
|
And we save it into "FILEID"
|
||||||
|
And user "Alice" has deleted file "textfile1.txt"
|
||||||
|
When user "Alice" sends the following share invitation with file-id "<<FILEID>>" using the Graph API:
|
||||||
|
| space | Personal |
|
||||||
|
| sharee | Brian |
|
||||||
|
| shareType | user |
|
||||||
|
| permissionsRole | Viewer |
|
||||||
|
Then the HTTP status code should be "404"
|
||||||
|
And for user "Brian" the space Shares should not contain these entries:
|
||||||
|
| textfile1.txt |
|
||||||
|
And the JSON data of the response should match
|
||||||
|
"""
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"error"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"error": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"code",
|
||||||
|
"message"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"code": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["itemNotFound"]
|
||||||
|
},
|
||||||
|
"message": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["stat: error: not found: "]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ class SharingNgContext implements Context {
|
|||||||
/**
|
/**
|
||||||
* @param string $user
|
* @param string $user
|
||||||
* @param TableNode $table
|
* @param TableNode $table
|
||||||
|
* @param string|null $fileId
|
||||||
*
|
*
|
||||||
* @return ResponseInterface
|
* @return ResponseInterface
|
||||||
*
|
*
|
||||||
@@ -137,7 +138,7 @@ class SharingNgContext implements Context {
|
|||||||
* @throws \GuzzleHttp\Exception\GuzzleException
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function sendShareInvitation(string $user, TableNode $table): ResponseInterface {
|
public function sendShareInvitation(string $user, TableNode $table, string $fileId = null): ResponseInterface {
|
||||||
$rows = $table->getRowsHash();
|
$rows = $table->getRowsHash();
|
||||||
if ($rows['space'] === 'Personal' || $rows['space'] === 'Shares') {
|
if ($rows['space'] === 'Personal' || $rows['space'] === 'Shares') {
|
||||||
$space = $this->spacesContext->getSpaceByName($user, $rows['space']);
|
$space = $this->spacesContext->getSpaceByName($user, $rows['space']);
|
||||||
@@ -146,8 +147,11 @@ class SharingNgContext implements Context {
|
|||||||
}
|
}
|
||||||
$spaceId = $space['id'];
|
$spaceId = $space['id'];
|
||||||
|
|
||||||
|
// $fileId is used for sharing deleted files
|
||||||
// for resharing a resource, "item-id" in API endpoint takes shareMountId
|
// for resharing a resource, "item-id" in API endpoint takes shareMountId
|
||||||
if ($rows['space'] === 'Shares') {
|
if ($fileId) {
|
||||||
|
$itemId = $fileId;
|
||||||
|
} elseif ($rows['space'] === 'Shares') {
|
||||||
$itemId = GraphHelper::getShareMountId(
|
$itemId = GraphHelper::getShareMountId(
|
||||||
$this->featureContext->getBaseUrl(),
|
$this->featureContext->getBaseUrl(),
|
||||||
$this->featureContext->getStepLineRef(),
|
$this->featureContext->getStepLineRef(),
|
||||||
@@ -236,6 +240,23 @@ class SharingNgContext implements Context {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @When user :user sends the following share invitation with file-id :fileId using the Graph API:
|
||||||
|
*
|
||||||
|
* @param string $user
|
||||||
|
* @param string $fileId
|
||||||
|
* @param TableNode $table
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws JsonException
|
||||||
|
* @throws \GuzzleHttp\Exception\GuzzleException
|
||||||
|
*/
|
||||||
|
public function userSendsTheFollowingShareInvitationWithFileIdUsingTheGraphApi(string $user, string $fileId, TableNode $table): void {
|
||||||
|
$this->featureContext->setResponse(
|
||||||
|
$this->sendShareInvitation($user, $table, $fileId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @When /^user "([^"]*)" creates the following link share using the Graph API:$/
|
* @When /^user "([^"]*)" creates the following link share using the Graph API:$/
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user