Skip to content

Commit

Permalink
adding test for trying to enable sync with invalid remote item id
Browse files Browse the repository at this point in the history
  • Loading branch information
nirajacharya2 committed Apr 18, 2024
1 parent 7820279 commit 0988e09
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,55 @@ Feature: enable or disable sync of incoming shares
| resource |
| textfile0.txt |
| FolderToShare |

@issue-8724
Scenario Outline: trying to enable sync of a share with invalid remoteItem id
Given user "Alice" has created folder "FolderToShare"
And user "Alice" has uploaded file with content "hello world" to "textfile0.txt"
And user "Alice" has uploaded a file inside space "Personal" with content "hello world" to "textfile0.txt"
And user "Alice" has sent the following share invitation:
| resource | <resource> |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
When user "Brian" tries to enable sync of the share with invalid remoteItem id "invalid item id" using the Graph API
Then the HTTP status code should be "400"
And the JSON data of the response should match
"""
{
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"code",
"innererror",
"message"
],
"properties": {
"code" : {
"const": "invalidRequest"
},
"innererror" : {
"type": "object",
"required": [
"date",
"request-id"
]
},
"message" : {
"const": "mounting share failed"
}
}
}
}
}
"""
Examples:
| resource |
| textfile0.txt |
| FolderToShare |
21 changes: 21 additions & 0 deletions tests/acceptance/features/bootstrap/SharingNgContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,27 @@ public function userEnablesSyncOfShareUsingTheGraphApi(string $user, string $sha
$this->featureContext->setResponse($response);
}

/**
* @When user :user tries to enable sync of the share with invalid remoteItem id :itemId using the Graph API
*
* @param string $user
* @param string $itemId
*
* @return void
*/
public function userTriesToEnablsSyncOfShareOfferedByFromSpaceUsingTheGraphApi(string $user, string $itemId) {
$shareSpaceId = FeatureContext::SHARES_SPACE_ID;
$response = GraphHelper::enableShareSync(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$this->featureContext->getActualUsername($user),
$this->featureContext->getPasswordForUser($user),
$itemId,
$shareSpaceId
);
$this->featureContext->setResponse($response);
}

/**
* @Then /^user "([^"]*)" should have sync (enabled|disabled) for share "([^"]*)"$/
*
Expand Down

0 comments on commit 0988e09

Please sign in to comment.