From 7bb178bb1f018c55c8758154dc75e15caeb1ad85 Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Mon, 29 Apr 2024 12:58:31 +0545 Subject: [PATCH] Added tests for enabling share sync with not shared resource id (#8991) --- .../enableDisableShareSync.feature | 40 +++++++++++++++++++ .../features/bootstrap/SharingNgContext.php | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature b/tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature index 76e82e0785..6ef4d290ba 100644 --- a/tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature +++ b/tests/acceptance/features/apiSharingNg/enableDisableShareSync.feature @@ -373,3 +373,43 @@ Feature: enable or disable sync of incoming shares } } """ + + + Scenario: try to enable share sync with not shared resource id + Given user "Brian" has disabled the auto-sync share + And user "Alice" has uploaded file with content "some data" to "/fileNotShared.txt" + And we save it into "FILEID" + When user "Brian" tries to enable 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": "mounting share failed" + } + } + } + } + } + """ diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index a5b1fd4898..48b03fe087 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -751,7 +751,7 @@ class SharingNgContext implements Context { */ public function userTriesToEnableShareSyncOfResourceUsingTheGraphApi(string $user, string $resource):void { $shareSpaceId = FeatureContext::SHARES_SPACE_ID; - $itemId = ($resource === 'nonexistent') ? WebDavHelper::generateUUIDv4() : ''; + $itemId = ($resource === 'nonexistent') ? WebDavHelper::generateUUIDv4() : $resource; $response = GraphHelper::enableShareSync( $this->featureContext->getBaseUrl(),