add test to hide federated shared resource

Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
prashant-gurung899 committed 2025-02-27 17:33:48 +05:45
1 parent 82e55b81e8
commit 0e7e3bb4d3
3 files changed
+80 -2

No files matched your search

@@ -1229,14 +1229,24 @@ class SharingNgContext implements Context {
* @param string $sharee
* @param string $shareID
* @param bool $hide
* @param bool $federatedShare
*
* @return ResponseInterface
* @throws GuzzleException
* @throws JsonException
*/
public function hideOrUnhideSharedResource(string $sharee, string $shareID, bool $hide = true): ResponseInterface {
public function hideOrUnhideSharedResource(
string $sharee,
string $shareID,
bool $hide = true,
bool $federatedShare = false
): ResponseInterface {
$shareSpaceId = GraphHelper::SHARES_SPACE_ID;
$itemId = $shareSpaceId . '!' . $shareID;
if ($federatedShare) {
$itemId = $shareID;
} else {
$itemId = $shareSpaceId . '!' . $shareID;
}
$body['@UI.Hidden'] = $hide;
return GraphHelper::hideOrUnhideShare(
$this->featureContext->getBaseUrl(),
@@ -1318,6 +1328,22 @@ class SharingNgContext implements Context {
$this->featureContext->setResponse($response);
}
/**
* @When user :user hides the federated share :share using the Graph API
*
* @param string $user
* @param string $share
*
* @return void
* @throws Exception
* @throws GuzzleException
*/
public function userHidesTheFederatedShareUsingTheGraphApi(string $user, string $share): void {
$remoteItemId = $this->spacesContext->getSharesRemoteItemId($user, $share);
$response = $this->hideOrUnhideSharedResource($user, $remoteItemId, true, true);
$this->featureContext->setResponse($response);
}
/**
* @Given user :user has hidden the share :sharedResource
*
@@ -332,5 +332,9 @@ The expected failures in this file are from features in the owncloud/ocis repo.
- [apiOcm/share.feature:1154](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L1154)
- [apiOcm/share.feature:1174](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L1174)
#### [[OCM] Hide & Enable Sync fail with received federated shares](https://github.com/owncloud/ocis/issues/10719)
- [apiOcm/share.feature:1194](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L1194)
- [apiOcm/share.feature:1218](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiOcm/share.feature#L1218)
Note: always have an empty line at the end of this file.
The bash script that processes this file requires that the last line has a newline on the end.
@@ -1189,3 +1189,51 @@ Feature: an user shares resources using ScienceMesh application
And user "Brian" should not have a federated share "folderToShare" shared by user "Alice" from space "Personal"
And using server "LOCAL"
And as "Alice" file "folderToShare/file.txt" should not exist
@issue-10719
Scenario: federated user hides the file shared by local user
Given using server "LOCAL"
And user "Alice" has uploaded file with content "hello world" to "testfile.txt"
And user "Alice" has sent the following resource share invitation to federated user:
| resource | testfile.txt |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
And using server "REMOTE"
When user "Brian" hides the federated share "testfile.txt" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["@UI.Hidden"],
"properties": {
"@UI.Hidden": { "const": true }
}
}
"""
@issue-10719
Scenario: federated user hides the folder shared by local user
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" hides the federated share "folderToShare" using the Graph API
Then the HTTP status code should be "200"
And the JSON data of the response should match
"""
{
"type": "object",
"required": ["@UI.Hidden"],
"properties": {
"@UI.Hidden": { "const": true }
}
}
"""