Merge pull request #9703 from owncloud/unhideShareTest

[test-only] unhide share
This commit is contained in:
Viktor Scharf
2024-07-29 15:01:19 +02:00
committed by GitHub
3 changed files with 139 additions and 6 deletions
+1 -1
View File
@@ -2021,7 +2021,7 @@ class GraphHelper {
* @return ResponseInterface
* @throws GuzzleException
*/
public static function hideShare(
public static function hideOrUnhideShare(
string $baseUrl,
string $xRequestId,
string $user,
@@ -5010,3 +5010,120 @@ Feature: an user gets the resources shared to them
| resource |
| testfile.txt |
| FolderToShare |
Scenario Outline: sharee lists the shares after unhiding share (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 resource share invitation:
| resource | <resource> |
| space | Personal |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
And user "Brian" has hidden the share "<resource>"
When user "Brian" unhides 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": ["@UI.Hidden"],
"properties": {
"@UI.Hidden": {
"const": false
}
}
}
"""
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": false
}
}
}
}
}
}
"""
Examples:
| resource |
| testfile.txt |
| folder |
Scenario Outline: sharee lists the shares after unhiding share (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 resource share invitation:
| resource | <resource> |
| space | NewSpace |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
And user "Brian" has hidden the share "<resource>"
When user "Brian" unhides 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": ["@UI.Hidden"],
"properties": {
"@UI.Hidden": {
"const": false
}
}
}
"""
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": false
}
}
}
}
}
}
"""
Examples:
| resource |
| testfile.txt |
| FolderToShare |
@@ -1036,16 +1036,17 @@ class SharingNgContext implements Context {
/**
* @param string $sharee
* @param string $shareID
* @param bool $hide
*
* @return ResponseInterface
* @throws GuzzleException
* @throws JsonException
*/
public function hideSharedResource(string $sharee, string $shareID): ResponseInterface {
public function hideOrUnhideSharedResource(string $sharee, string $shareID, bool $hide = true): ResponseInterface {
$shareSpaceId = FeatureContext::SHARES_SPACE_ID;
$itemId = $shareSpaceId . '!' . $shareID;
$body['@UI.Hidden'] = true;
return GraphHelper::hideShare(
$body['@UI.Hidden'] = $hide;
return GraphHelper::hideOrUnhideShare(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$this->featureContext->getActualUsername($sharee),
@@ -1147,7 +1148,7 @@ class SharingNgContext implements Context {
*/
public function userHidesTheSharedResourceUsingTheGraphApi(string $user):void {
$shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
$response = $this->hideSharedResource($user, $shareItemId);
$response = $this->hideOrUnhideSharedResource($user, $shareItemId);
$this->featureContext->setResponse($response);
}
@@ -1162,10 +1163,25 @@ class SharingNgContext implements Context {
*/
public function userHasHiddenTheShare(string $user):void {
$shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
$response = $this->hideSharedResource($user, $shareItemId);
$response = $this->hideOrUnhideSharedResource($user, $shareItemId);
$this->featureContext->theHTTPStatusCodeShouldBe(200, '', $response);
}
/**
* @When user :user unhides the shared resource :sharedResource using the Graph API
*
* @param string $user
*
* @return void
* @throws Exception
* @throws GuzzleException
*/
public function userUnhidesTheSharedResourceUsingTheGraphApi(string $user):void {
$shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
$response = $this->hideOrUnhideSharedResource($user, $shareItemId, false);
$this->featureContext->setResponse($response);
}
/**
* @When user :user enables sync of share :share offered by :offeredBy from :space space using the Graph API
*