mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-07-18 11:34:29 -04:00
[tests-only][full-ci]added test for declining a share (#8636)
* added test for declining a share * updated step definition for disabling user * addressing review
This commit is contained in:
@@ -1893,4 +1893,33 @@ class GraphHelper {
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $baseUrl
|
||||
* @param string $xRequestId
|
||||
* @param string $user
|
||||
* @param string $password
|
||||
* @param string $itemId
|
||||
* @param string $shareSpaceId
|
||||
*
|
||||
* @return ResponseInterface
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public static function unmountShare(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $itemId,
|
||||
string $shareSpaceId
|
||||
):ResponseInterface {
|
||||
$url = self::getBetaFullUrl($baseUrl, "drives/$shareSpaceId/items/$itemId");
|
||||
return HttpRequestHelper::delete(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
Feature: mount or unmount incoming share
|
||||
As a user
|
||||
I want to have control over the share received
|
||||
So that I can filter out the files and folder shared with Me
|
||||
|
||||
Background:
|
||||
Given these users have been created with default attributes and without skeleton files:
|
||||
| username |
|
||||
| Alice |
|
||||
| Brian |
|
||||
And using spaces DAV path
|
||||
|
||||
|
||||
Scenario Outline: unmount shared resource
|
||||
And user "Alice" has created folder "FolderToShare"
|
||||
And user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
|
||||
And user "Alice" has sent the following share invitation:
|
||||
| resource | <resource> |
|
||||
| space | Personal |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | Viewer |
|
||||
When user "Brian" unmounts share "<resource>" using the Graph API
|
||||
And user "Brian" lists the shares shared with him using the Graph API
|
||||
Then the HTTP status code of responses on all endpoints 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": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| resource |
|
||||
| textfile0.txt |
|
||||
| FolderToShare |
|
||||
@@ -184,6 +184,7 @@ class FeatureContext extends BehatVariablesContext {
|
||||
*/
|
||||
private bool $dbConversion = false;
|
||||
|
||||
public const SHARES_SPACE_ID = 'a0ca6a90-a365-4782-871e-d44447bbc668$a0ca6a90-a365-4782-871e-d44447bbc668';
|
||||
/**
|
||||
* @param bool $value
|
||||
*
|
||||
|
||||
@@ -2536,6 +2536,7 @@ class GraphContext implements Context {
|
||||
$credentials['password']
|
||||
)
|
||||
);
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -559,4 +559,39 @@ class SharingNgContext implements Context {
|
||||
|
||||
Assert::assertSame($should, $fileFound, $assertMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $itemId
|
||||
* @param string $shareSpaceId
|
||||
*
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function unmountShare(string $user, string $itemId, string $shareSpaceId): ResponseInterface {
|
||||
return GraphHelper::unmountShare(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getStepLineRef(),
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$itemId,
|
||||
$shareSpaceId,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user unmounts share :share using the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userUnmountsShareUsingTheGraphApi(string $user):void {
|
||||
$shareItemId = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
|
||||
$shareSpaceId = FeatureContext::SHARES_SPACE_ID;
|
||||
$itemId = $shareSpaceId . '!' . $shareItemId;
|
||||
$this->featureContext->setResponse($this->unmountShare($user, $itemId, $shareSpaceId));
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user