Merge pull request #11026 from owncloud/test/enable-sync-ocm-shares

[tests-only][full-ci] add test to enable sync of federated shared resource
This commit is contained in:
Prashant Gurung authored and GitHub committed 2025-03-06 16:57:58 +05:45
commit 9089871a59
4 files changed
+120

No files matched your search

@@ -1405,6 +1405,31 @@ class SharingNgContext implements Context {
$this->featureContext->setResponse($response);
}
/**
* @When user :user enables sync of federated share :share using the Graph API
*
* @param string $user
* @param string $share
*
* @return void
* @throws Exception
*/
public function userEnablesSyncOfFederatedShareUsingTheGraphApi(
string $user,
string $share,
): void {
$remoteItemId = $this->spacesContext->getSharesRemoteItemId($user, $share);
$response = GraphHelper::enableShareSync(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$this->featureContext->getActualUsername($user),
$this->featureContext->getPasswordForUser($user),
$remoteItemId,
GraphHelper::SHARES_SPACE_ID
);
$this->featureContext->setResponse($response);
}
/**
* step definition for enabling sync for items for non-existing group|user|space sharer
*
@@ -298,6 +298,7 @@ class SpacesContext implements Context {
* @throws Exception|GuzzleException
*/
public function getSharesRemoteItemId(string $user, string $share): string {
$share = ltrim($share, '/');
$credentials = $this->featureContext->graphContext->getAdminOrUserCredentials($user);
$response = GraphHelper::getSharesSharedWithMe(
$this->featureContext->getBaseUrl(),
@@ -331,6 +331,7 @@ The expected failures in this file are from features in the owncloud/ocis repo.
#### [[OCM] Hide & Enable Sync fail with received federated shares](https://github.com/owncloud/ocis/issues/10719)
- [apiOcm/share.feature:1204](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L1204)
- [apiOcm/share.feature:1228](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L1228)
- [apiOcm/share.feature:1339](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L1339)
#### [[OCM] federated user trying to download file shared with permissions role Secure Viewer returns 500 status code](https://github.com/owncloud/ocis/issues/10822)
- [apiOcm/enableDisablePermissionsRole.feature:18](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/enableDisablePermissionsRole.feature#L18)
@@ -1297,3 +1297,96 @@ Feature: an user shares resources using ScienceMesh application
And as user "Alice" the PROPFIND response should contain a resource "newFolder" with these key and value pairs:
| key | value |
| oc:name | newFolder |
@issue-10719
Scenario: enable sync of a federated shared resource
Given using server "LOCAL"
And user "Alice" has created folder "folderToShare"
And user "Alice" has sent the following resource share invitation to federated user:
| resource | folderToShare |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
And using server "REMOTE"
When user "Brian" enables sync of federated share "folderToShare" using the Graph API
Then the HTTP status code should be "201"
When user "Brian" lists the shares shared with him using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["value"],
"properties": {
"value": {
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"type": "object",
"required": ["@client.synchronize"],
"properties": {
"@client.synchronize": { "const": true }
}
}
}
}
}
"""
@issue-10719
Scenario: enable sync of a federated shared resource when multiple federated shares exist
Given using server "LOCAL"
And user "Alice" has created folder "folderOneShare"
And user "Alice" has created folder "folderTwoShare"
And user "Alice" has sent the following resource share invitation to federated user:
| resource | folderOneShare |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
And user "Alice" has sent the following resource share invitation to federated user:
| resource | folderTwoShare |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
And using server "REMOTE"
When user "Brian" enables sync of federated share "folderOneShare" using the Graph API
Then the HTTP status code should be "201"
When user "Brian" lists the shares shared with him using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["value"],
"properties": {
"value": {
"type": "array",
"minItems": 2,
"maxItems": 2,
"uniqueItems": true,
"items": {
"oneOf":[
{
"type": "object",
"required": ["@client.synchronize"],
"properties": {
"@client.synchronize": { "const": true }
}
},
{
"type": "object",
"required": ["@client.synchronize"],
"properties": {
"@client.synchronize": { "const": false }
}
}
]
}
}
}
}
"""