[tests-only][full-ci]added test with step definition for mounting share when auto accept env set to false (#8623)
* added test with step definition for accepting pending share * addressing review
This commit is contained in:
@@ -1922,4 +1922,39 @@ 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 mountShare(
|
||||
string $baseUrl,
|
||||
string $xRequestId,
|
||||
string $user,
|
||||
string $password,
|
||||
string $itemId,
|
||||
string $shareSpaceId
|
||||
): ResponseInterface {
|
||||
$body = [
|
||||
"remoteItem" => [
|
||||
"id" => $itemId
|
||||
]
|
||||
];
|
||||
$url = self::getBetaFullUrl($baseUrl, "drives/$shareSpaceId/root/children");
|
||||
return HttpRequestHelper::post(
|
||||
$url,
|
||||
$xRequestId,
|
||||
$user,
|
||||
$password,
|
||||
self::getRequestHeaders(),
|
||||
\json_encode($body)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,3 +54,35 @@ Feature: mount or unmount incoming share
|
||||
| resource |
|
||||
| textfile0.txt |
|
||||
| FolderToShare |
|
||||
|
||||
|
||||
Scenario Outline: mount shared resource when auto-sync is disabled
|
||||
Given user "Brian" has disabled the auto-sync share
|
||||
And user "Alice" has uploaded file with content "hello world" to "/textfile0.txt"
|
||||
And user "Alice" has created folder "folder"
|
||||
And user "Alice" has sent the following share invitation:
|
||||
| resource | <resource> |
|
||||
| space | Personal |
|
||||
| sharee | Brian |
|
||||
| shareType | user |
|
||||
| permissionsRole | Viewer |
|
||||
When user "Brian" mounts share "<resource>" offered by "Alice" from "Personal" space using the Graph API
|
||||
Then the HTTP status code should be "201"
|
||||
And the JSON data of the response should match
|
||||
"""
|
||||
{
|
||||
"type": "object",
|
||||
"required": [
|
||||
"@client.synchronize"
|
||||
],
|
||||
"properties": {
|
||||
"@client.synchronize": {
|
||||
"const": true
|
||||
}
|
||||
}
|
||||
}
|
||||
"""
|
||||
Examples:
|
||||
| resource |
|
||||
| textfile0.txt |
|
||||
| folder |
|
||||
|
||||
@@ -594,4 +594,30 @@ class SharingNgContext implements Context {
|
||||
$this->featureContext->setResponse($this->unmountShare($user, $itemId, $shareSpaceId));
|
||||
$this->featureContext->pushToLastStatusCodesArrays();
|
||||
}
|
||||
|
||||
/**
|
||||
* @When user :user mounts share :share offered by :offeredBy from :space space using the Graph API
|
||||
*
|
||||
* @param string $user
|
||||
* @param string $share
|
||||
* @param string $offeredBy
|
||||
* @param string $space
|
||||
*
|
||||
* @return void
|
||||
* @throws Exception
|
||||
*/
|
||||
public function userMountsShareOfferedByFromSpaceUsingTheGraphApi(string $user, string $share, string $offeredBy, string $space):void {
|
||||
$share = ltrim($share, '/');
|
||||
$itemId = $this->spacesContext->getResourceId($offeredBy, $space, $share);
|
||||
$shareSpaceId = FeatureContext::SHARES_SPACE_ID;
|
||||
$response = GraphHelper::mountShare(
|
||||
$this->featureContext->getBaseUrl(),
|
||||
$this->featureContext->getStepLineRef(),
|
||||
$this->featureContext->getActualUsername($user),
|
||||
$this->featureContext->getPasswordForUser($user),
|
||||
$itemId,
|
||||
$shareSpaceId
|
||||
);
|
||||
$this->featureContext->setResponse($response);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user