[tests-only][full-ci]adding scenerio for enable and disable sync feature in group share (#8734)

* adding scenerio for mount unmount feature in group share

* addressing review
This commit is contained in:
Sabin Panta
2024-04-05 12:20:09 +05:45
committed by GitHub
parent 8f290ce2ea
commit d7ad04c549
2 changed files with 96 additions and 0 deletions
@@ -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 | <resource> |
| space | Personal |
| sharee | grp1 |
| shareType | group |
| permissionsRole | Viewer |
When user "Alice" mounts share "<resource>" 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 "<resource>"
And user "Brian" should have sync disabled for share "<resource>"
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 | <resource> |
| space | Personal |
| sharee | grp1 |
| shareType | group |
| permissionsRole | Viewer |
When user "Alice" unmounts share "<resource>" using the Graph API
Then the HTTP status code should be "200"
And user "Alice" should have sync disabled for share "<resource>"
And user "Brian" should have sync enabled for share "<resource>"
Examples:
| resource |
| textfile0.txt |
| FolderToShare |
@@ -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'"
);
}
}