diff --git a/tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature b/tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature index 27f9cd37db..10944f5d41 100644 --- a/tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature +++ b/tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature @@ -641,3 +641,116 @@ Feature: enable or disable sync of incoming shares } } """ + + @issue-9001 + Scenario: try to disable share sync of a non-existent resource + When user "Brian" tries to disable share sync of a resource "nonexistent" using the Graph API + Then the HTTP status code should be "404" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["error"], + "properties": { + "error": { + "type": "object", + "required": [ + "code", + "innererror", + "message" + ], + "properties": { + "code" : { + "const": "itemNotFound" + }, + "innererror" : { + "type": "object", + "required": [ + "date", + "request-id" + ] + }, + "message" : { + "const": "error getting received share" + } + } + } + } + } + """ + + + Scenario: try to disable share sync with empty resource id + When user "Brian" tries to disable share sync of a resource "" 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": "invalid driveID or itemID" + } + } + } + } + } + """ + + + Scenario: try to disable share sync with not shared resource id + Given user "Alice" has uploaded file with content "some data" to "/fileNotShared.txt" + And we save it into "FILEID" + When user "Brian" tries to disable share sync of a resource "<>" using the Graph API + Then the HTTP status code should be "404" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["error"], + "properties": { + "error": { + "type": "object", + "required": [ + "code", + "innererror", + "message" + ], + "properties": { + "code" : { + "const": "itemNotFound" + }, + "innererror" : { + "type": "object", + "required": [ + "date", + "request-id" + ] + }, + "message" : { + "const": "error getting received share" + } + } + } + } + } + """ diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index 01519c4837..f3ab0a013a 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -1188,6 +1188,30 @@ class SharingNgContext implements Context { $this->featureContext->setResponse($response); } + /** + * @When user :user tries to disable share sync of a resource :resource using the Graph API + * + * @param string $user + * @param string $resource + * + * @return void + * @throws Exception|GuzzleException + */ + public function userTriesToDisableShareSyncOfResourceUsingTheGraphApi(string $user, string $resource):void { + $shareSpaceId = FeatureContext::SHARES_SPACE_ID; + $shareID = ($resource === 'nonexistent') ? WebDavHelper::generateUUIDv4() : $resource; + $itemId = $shareSpaceId . '!' . $shareID; + $response = GraphHelper::disableShareSync( + $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 "([^"]*)"$/ *