From 2b43d4f871effc0f477e5ade191b2c65d842adaf Mon Sep 17 00:00:00 2001 From: Niraj Acharya Date: Wed, 17 Apr 2024 12:12:51 +0545 Subject: [PATCH] adding test for trying to enable sync with invalid remote item id --- .../enableDisableShareSync.feature | 39 +++++++++++++++++++ .../features/bootstrap/SharingNgContext.php | 20 ++++++++++ 2 files changed, 59 insertions(+) diff --git a/tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature b/tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature index 1e9f7a3596d..4adc1d46253 100644 --- a/tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature +++ b/tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature @@ -297,3 +297,42 @@ Feature: enable or disable sync of incoming shares | resource | | textfile0.txt | | FolderToShare | + + @issue-8724 + Scenario: trying to enable share sync of non-existing resource + When user "Brian" tries to enable share sync of non-existing 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": "mounting share failed" + } + } + } + } + } + """ diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index ef510e191e5..f65ca0cfa66 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -714,6 +714,26 @@ public function userEnablesSyncOfShareUsingTheGraphApi(string $user, string $sha $this->featureContext->setResponse($response); } + /** + * @When user :user tries to enable share sync of non-existing resource using the Graph API + * + * @param string $user + * + * @return void + */ + public function userTriesToEnablsShareSyncOfNonExistingResourceUsingTheGraphApi(string $user):void { + $shareSpaceId = FeatureContext::SHARES_SPACE_ID; + $response = GraphHelper::enableShareSync( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $this->featureContext->getActualUsername($user), + $this->featureContext->getPasswordForUser($user), + WebDavHelper::generateUUIDv4(), + $shareSpaceId + ); + $this->featureContext->setResponse($response); + } + /** * @Then /^user "([^"]*)" should have sync (enabled|disabled) for share "([^"]*)"$/ *