mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-02 16:59:56 -05:00
[tests-only][full-ci]Added test for hide shared resources (personal and project space) in shares (#8999)
* Added test for hide shared resources in shares Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com> * review address Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com> * review address: refactor feature file Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com> --------- Signed-off-by: sagargurung1001@gmail.com <sagargurung1001@gmail.com>
This commit is contained in:
@@ -2010,6 +2010,39 @@ class GraphHelper {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $itemId
|
||||
* @param string $shareSpaceId
|
||||
* @param array $body
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function hideShare(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $itemId,
|
||||
string $shareSpaceId,
|
||||
array $body
|
||||
):ResponseInterface {
|
||||
$url = self::getBetaFullUrl($baseUrl, "drives/$shareSpaceId/items/$itemId");
|
||||
return HttpRequestHelper::sendRequest(
|
||||
$url,
|
||||
$xRequestId,
|
||||
'PATCH',
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders(),
|
||||
\json_encode($body)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
|
||||
@@ -4840,3 +4840,171 @@ Feature: an user gets the resources shared to them
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
Scenario Outline: sharee hides the shared resource (Personal space)
|
||||
Given user "Alice" has created folder "folder"
|
||||
And user "Alice" has uploaded file with content "hello world" to "testfile.txt"
|
||||
And user "Alice" has sent the following share invitation:
|
||||
| resource | <resource> |
|
||||
| space | Personal |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | Viewer |
|
||||
When user "Brian" hides the shared resource "<resource>" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["hidden", "mount_point"],
|
||||
"properties": {
|
||||
"hidden": {
|
||||
"const": true
|
||||
},
|
||||
"mount_point": {
|
||||
"type": "object",
|
||||
"required": ["path"],
|
||||
"properties": {
|
||||
"path": {
|
||||
"const": "<resource>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| resource |
|
||||
| testfile.txt |
|
||||
| folder |
|
||||
|
||||
|
||||
Scenario Outline: sharee hides the shared resource (Project space)
|
||||
Given using spaces DAV path
|
||||
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
|
||||
And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
|
||||
And user "Alice" has uploaded a file inside space "NewSpace" with content "share space items" to "testfile.txt"
|
||||
And user "Alice" has created a folder "FolderToShare" in space "NewSpace"
|
||||
And user "Alice" has sent the following share invitation:
|
||||
| resource | <resource> |
|
||||
| space | NewSpace |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | Viewer |
|
||||
When user "Brian" hides the shared resource "<resource>" using the Graph API
|
||||
Then the HTTP status code should be "200"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["hidden", "mount_point"],
|
||||
"properties": {
|
||||
"hidden": {
|
||||
"const": true
|
||||
},
|
||||
"mount_point": {
|
||||
"type": "object",
|
||||
"required": ["path"],
|
||||
"properties": {
|
||||
"path": {
|
||||
"const": "<resource>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| resource |
|
||||
| testfile.txt |
|
||||
| FolderToShare |
|
||||
|
||||
|
||||
Scenario Outline: sharee lists the shares after hiding (Personal space)
|
||||
Given user "Alice" has created folder "folder"
|
||||
And user "Alice" has uploaded file with content "hello world" to "testfile.txt"
|
||||
And user "Alice" has sent the following share invitation:
|
||||
| resource | <resource> |
|
||||
| space | Personal |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | Viewer |
|
||||
And user "Brian" has hidden the share "<resource>"
|
||||
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",
|
||||
"maxItems": 1,
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"@UI.Hidden"
|
||||
],
|
||||
"properties": {
|
||||
"@UI.Hidden":{
|
||||
"const": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| resource |
|
||||
| testfile.txt |
|
||||
| folder |
|
||||
|
||||
|
||||
Scenario Outline: sharee lists the shares after hiding (Project space)
|
||||
Given using spaces DAV path
|
||||
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
|
||||
And user "Alice" has created a space "NewSpace" with the default quota using the Graph API
|
||||
And user "Alice" has uploaded a file inside space "NewSpace" with content "share space items" to "testfile.txt"
|
||||
And user "Alice" has created a folder "FolderToShare" in space "NewSpace"
|
||||
And user "Alice" has sent the following share invitation:
|
||||
| resource | <resource> |
|
||||
| space | NewSpace |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | Viewer |
|
||||
And user "Brian" has hidden the share "<resource>"
|
||||
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",
|
||||
"maxItems": 1,
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"@UI.Hidden"
|
||||
],
|
||||
"properties": {
|
||||
"@UI.Hidden":{
|
||||
"const": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| resource |
|
||||
| testfile.txt |
|
||||
| FolderToShare |
|
||||
|
||||
@@ -697,6 +697,29 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sharee
|
||||
* @param string $shareID
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
* @throws JsonException
|
||||
*/
|
||||
public function hideSharedResource(string $sharee, string $shareID): ResponseInterface {
|
||||
$shareSpaceId = FeatureContext::SHARES_SPACE_ID;
|
||||
$itemId = $shareSpaceId . '!' . $shareID;
|
||||
$body['@UI.Hidden'] = true;
|
||||
return GraphHelper::hideShare(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getStepLineRef(),
|
||||
$this->featureContext->getActualUsername($sharee),
|
||||
$this->featureContext->getPasswordForUser($sharee),
|
||||
$itemId,
|
||||
$shareSpaceId,
|
||||
$body
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Then /^for user "([^"]*)" the space Shares should (not|)\s?contain these (files|entries):$/
|
||||
*
|
||||
@@ -774,6 +797,36 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user hides the shared resource :sharedResource using the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function userHidesTheSharedResourceUsingTheGraphApi(string $user):void {
|
||||
$shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
|
||||
$response = $this->hideSharedResource($user, $shareItemId);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Given user :user has hidden the share :sharedResource
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function userHasHiddenTheShare(string $user):void {
|
||||
$shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
|
||||
$response = $this->hideSharedResource($user, $shareItemId);
|
||||
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user enables sync of share :share offered by :offeredBy from :space space using the Graph API
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user