diff --git a/tests/acceptance/features/apiSharingNg/mountOrUnmountShare.feature b/tests/acceptance/features/apiSharingNg/mountOrUnmountShare.feature index 72b860deb2..9439ffd461 100644 --- a/tests/acceptance/features/apiSharingNg/mountOrUnmountShare.feature +++ b/tests/acceptance/features/apiSharingNg/mountOrUnmountShare.feature @@ -86,3 +86,65 @@ Feature: mount or unmount incoming share | resource | | textfile0.txt | | folder | + + + Scenario Outline: enable a group share sync by only one user in a group + Given user "Carol" has been created with default attributes and without skeleton files + And group "grp1" has been created + And user "Alice" has been added to group "grp1" + And user "Brian" has been added to group "grp1" + And user "Alice" has disabled the auto-sync share + And user "Brian" has disabled the auto-sync share + And user "Carol" has uploaded file with content "hello world" to "/textfile0.txt" + And user "Carol" has created folder "FolderToShare" + And user "Carol" has sent the following share invitation: + | resource | | + | space | Personal | + | sharee | grp1 | + | shareType | group | + | permissionsRole | Viewer | + When user "Alice" mounts share "" offered by "Carol" from "Personal" space using the Graph API + Then the HTTP status code should be "201" + And the JSON data of the response should match + """ + { + "type": "object", + "required": [ + "@client.synchronize" + ], + "properties": { + "@client.synchronize": { + "const": true + } + } + } + """ + And user "Alice" should have sync enabled for share "" + And user "Brian" should have sync disabled for share "" + Examples: + | resource | + | textfile0.txt | + | FolderToShare | + + + Scenario Outline: disable group share sync by only one user in a group + Given user "Carol" has been created with default attributes and without skeleton files + And group "grp1" has been created + And user "Alice" has been added to group "grp1" + And user "Brian" has been added to group "grp1" + And user "Carol" has created folder "FolderToShare" + And user "Carol" has uploaded file with content "hello world" to "/textfile0.txt" + And user "Carol" has sent the following share invitation: + | resource | | + | space | Personal | + | sharee | grp1 | + | shareType | group | + | permissionsRole | Viewer | + When user "Alice" unmounts share "" using the Graph API + Then the HTTP status code should be "200" + And user "Alice" should have sync disabled for share "" + And user "Brian" should have sync enabled for share "" + Examples: + | resource | + | textfile0.txt | + | FolderToShare | diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index a972082ffc..a860d9fe48 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -620,4 +620,38 @@ class SharingNgContext implements Context { ); $this->featureContext->setResponse($response); } + + /** + * @Then /^user "([^"]*)" should have sync (enabled|disabled) for share "([^"]*)"$/ + * + * @param string $user + * @param string $status + * @param string $resource + * + * @return void + * @throws \GuzzleHttp\Exception\GuzzleException + */ + public function userShouldHaveSyncEnabledOrDisabledForShare(string $user, string $status, string $resource):void { + $response = GraphHelper::getSharesSharedWithMe( + $this->featureContext->getBaseUrl(), + $this->featureContext->getStepLineRef(), + $user, + $this->featureContext->getPasswordForUser($user) + ); + $responseBody = $this->featureContext->getJsonDecodedResponse($response); + $expectedValue = $status === "enabled" ? "true" : "false"; + foreach ($responseBody["value"] as $value) { + if ($value["remoteItem"]["name"] === $resource) { + // var_export converts values to their string representations + // e.g.: true -> 'true' + $actaulValue = var_export($value["@client.synchronize"], true); + break; + } + } + Assert::assertSame( + $actaulValue, + $expectedValue, + "Expected property '@client.synchronize' to be '$expectedValue' but found '$actaulValue'" + ); + } }