shareSubItemOfSpace.feature: Used sharingNG for sharing in given step
This commit is contained in:
@@ -294,7 +294,7 @@ The expected failures in this file are from features in the owncloud/ocis repo.
|
|||||||
|
|
||||||
### [500 when deleting share role](https://github.com/owncloud/ocis/issues/8747)
|
### [500 when deleting share role](https://github.com/owncloud/ocis/issues/8747)
|
||||||
|
|
||||||
- [apiSpacesShares/shareSubItemOfSpace.feature:147](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature#L147)
|
- [apiSpacesShares/shareSubItemOfSpace.feature:159](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature#L159)
|
||||||
|
|
||||||
- Note: always have an empty line at the end of this file.
|
- 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.
|
The bash script that processes this file requires that the last line has a newline on the end.
|
||||||
|
|||||||
@@ -41,9 +41,11 @@ Feature: Share a file or folder that is inside a space
|
|||||||
|
|
||||||
|
|
||||||
Scenario Outline: user participant of the project space with manager role can share an entity to another user
|
Scenario Outline: user participant of the project space with manager role can share an entity to another user
|
||||||
Given user "Alice" has shared a space "share sub-item" with settings:
|
Given user "Alice" has sent the following space share invitation:
|
||||||
| shareWith | Brian |
|
| space | share sub-item |
|
||||||
| role | manager |
|
| sharee | Brian |
|
||||||
|
| shareType | user |
|
||||||
|
| permissionsRole | Manager |
|
||||||
When user "Brian" creates a share inside of space "share sub-item" with settings:
|
When user "Brian" creates a share inside of space "share sub-item" with settings:
|
||||||
| path | <resource> |
|
| path | <resource> |
|
||||||
| shareWith | Bob |
|
| shareWith | Bob |
|
||||||
@@ -64,9 +66,11 @@ Feature: Share a file or folder that is inside a space
|
|||||||
|
|
||||||
@skipOnRevaMaster
|
@skipOnRevaMaster
|
||||||
Scenario Outline: user participant of the project space without space manager role cannot share an entity to another user
|
Scenario Outline: user participant of the project space without space manager role cannot share an entity to another user
|
||||||
Given user "Alice" has shared a space "share sub-item" with settings:
|
Given user "Alice" has sent the following space share invitation:
|
||||||
| shareWith | Brian |
|
| space | share sub-item |
|
||||||
| role | <space-role> |
|
| sharee | Brian |
|
||||||
|
| shareType | user |
|
||||||
|
| permissionsRole | <space-role> |
|
||||||
When user "Brian" creates a share inside of space "share sub-item" with settings:
|
When user "Brian" creates a share inside of space "share sub-item" with settings:
|
||||||
| path | <resource> |
|
| path | <resource> |
|
||||||
| shareWith | Bob |
|
| shareWith | Bob |
|
||||||
@@ -75,17 +79,19 @@ Feature: Share a file or folder that is inside a space
|
|||||||
And the OCS status code should be "403"
|
And the OCS status code should be "403"
|
||||||
And the OCS status message should be "No share permission"
|
And the OCS status message should be "No share permission"
|
||||||
Examples:
|
Examples:
|
||||||
| resource | space-role |
|
| resource | space-role |
|
||||||
| folder | editor |
|
| folder | Space Editor |
|
||||||
| file.txt | editor |
|
| file.txt | Space Editor |
|
||||||
| file.txt | viewer |
|
| file.txt | Space Viewer |
|
||||||
| folder | viewer |
|
| folder | Space Viewer |
|
||||||
|
|
||||||
|
|
||||||
Scenario Outline: user participant of the project space can see the created resources share
|
Scenario Outline: user participant of the project space can see the created resources share
|
||||||
Given user "Alice" has shared a space "share sub-item" with settings:
|
Given user "Alice" has sent the following space share invitation:
|
||||||
| shareWith | Brian |
|
| space | share sub-item |
|
||||||
| role | <space-role> |
|
| sharee | Brian |
|
||||||
|
| shareType | user |
|
||||||
|
| permissionsRole | <space-role> |
|
||||||
When user "Alice" creates a share inside of space "share sub-item" with settings:
|
When user "Alice" creates a share inside of space "share sub-item" with settings:
|
||||||
| path | file.txt |
|
| path | file.txt |
|
||||||
| shareWith | Bob |
|
| shareWith | Bob |
|
||||||
@@ -93,10 +99,10 @@ Feature: Share a file or folder that is inside a space
|
|||||||
Then for user "Alice" the space "share sub-item" should contain the last created share of the file "file.txt"
|
Then for user "Alice" the space "share sub-item" should contain the last created share of the file "file.txt"
|
||||||
And for user "Brian" the space "share sub-item" should contain the last created share of the file "file.txt"
|
And for user "Brian" the space "share sub-item" should contain the last created share of the file "file.txt"
|
||||||
Examples:
|
Examples:
|
||||||
| space-role |
|
| space-role |
|
||||||
| editor |
|
| Space Editor |
|
||||||
| viewer |
|
| Space Viewer |
|
||||||
| manager |
|
| Manager |
|
||||||
|
|
||||||
|
|
||||||
Scenario: user shares the folder to the group
|
Scenario: user shares the folder to the group
|
||||||
@@ -117,11 +123,14 @@ Feature: Share a file or folder that is inside a space
|
|||||||
|
|
||||||
|
|
||||||
Scenario: user changes the expiration date
|
Scenario: user changes the expiration date
|
||||||
Given user "Alice" has created a share inside of space "share sub-item" with settings:
|
Given using SharingNG
|
||||||
| path | folder |
|
And user "Alice" has sent the following resource share invitation:
|
||||||
| shareWith | Brian |
|
| resource | folder |
|
||||||
| role | viewer |
|
| space | share sub-item |
|
||||||
| expireDate | 2042-01-01T23:59:59+0100 |
|
| sharee | Brian |
|
||||||
|
| shareType | user |
|
||||||
|
| permissionsRole | Viewer |
|
||||||
|
| expireDate | 2042-01-01T23:59:59.000Z |
|
||||||
When user "Alice" changes the last share with settings:
|
When user "Alice" changes the last share with settings:
|
||||||
| expireDate | 2044-01-01T23:59:59.999+01:00 |
|
| expireDate | 2044-01-01T23:59:59.999+01:00 |
|
||||||
| role | viewer |
|
| role | viewer |
|
||||||
@@ -131,11 +140,14 @@ Feature: Share a file or folder that is inside a space
|
|||||||
|
|
||||||
|
|
||||||
Scenario: user deletes the expiration date
|
Scenario: user deletes the expiration date
|
||||||
Given user "Alice" has created a share inside of space "share sub-item" with settings:
|
Given using SharingNG
|
||||||
| path | folder |
|
And user "Alice" has sent the following resource share invitation:
|
||||||
| shareWith | Brian |
|
| resource | folder |
|
||||||
| role | viewer |
|
| space | share sub-item |
|
||||||
| expireDate | 2042-01-01T23:59:59+0100 |
|
| sharee | Brian |
|
||||||
|
| shareType | user |
|
||||||
|
| permissionsRole | Viewer |
|
||||||
|
| expireDate | 2042-01-01T23:59:59.000Z |
|
||||||
When user "Alice" changes the last share with settings:
|
When user "Alice" changes the last share with settings:
|
||||||
| expireDate | |
|
| expireDate | |
|
||||||
| role | viewer |
|
| role | viewer |
|
||||||
@@ -143,39 +155,47 @@ Feature: Share a file or folder that is inside a space
|
|||||||
And the information about the last share for user "Brian" should include
|
And the information about the last share for user "Brian" should include
|
||||||
| expiration | |
|
| expiration | |
|
||||||
|
|
||||||
|
@issue-8747
|
||||||
Scenario: user cannot delete share role
|
Scenario: user cannot delete share role
|
||||||
Given using OCS API version "<ocs_api_version>"
|
Given using OCS API version "<ocs_api_version>"
|
||||||
And user "Alice" has created a share inside of space "share sub-item" with settings:
|
And using SharingNG
|
||||||
| path | folder |
|
And user "Alice" has sent the following resource share invitation:
|
||||||
| shareWith | Brian |
|
| resource | folder |
|
||||||
| role | viewer |
|
| space | share sub-item |
|
||||||
| expireDate | 2042-01-01T23:59:59+0100 |
|
| sharee | Brian |
|
||||||
|
| shareType | user |
|
||||||
|
| permissionsRole | Viewer |
|
||||||
|
| expireDate | 2042-01-01T23:59:59.000Z |
|
||||||
When user "Alice" changes the last share with settings:
|
When user "Alice" changes the last share with settings:
|
||||||
| role | |
|
| role | |
|
||||||
Then the HTTP status code should be "400"
|
Then the HTTP status code should be "400"
|
||||||
|
|
||||||
|
|
||||||
Scenario: check the end of expiration date in user share
|
Scenario: check the end of expiration date in user share
|
||||||
Given user "Alice" has created a share inside of space "share sub-item" with settings:
|
Given using SharingNG
|
||||||
| path | folder |
|
And user "Alice" has sent the following resource share invitation:
|
||||||
| shareWith | Brian |
|
| resource | folder |
|
||||||
| role | viewer |
|
| space | share sub-item |
|
||||||
| expireDate | 2042-01-01T23:59:59+0100 |
|
| sharee | Brian |
|
||||||
When user "Alice" expires the last share
|
| shareType | user |
|
||||||
|
| permissionsRole | Viewer |
|
||||||
|
| expireDate | 2042-01-01T23:59:59.000Z |
|
||||||
|
When user "Alice" expires the last share of resource "folder" inside of the space "share sub-item"
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
And as "Brian" folder "Shares/folder" should not exist
|
And as "Brian" folder "Shares/folder" should not exist
|
||||||
|
|
||||||
@issue-5823
|
@issue-5823
|
||||||
Scenario: check the end of expiration date in group share
|
Scenario: check the end of expiration date in group share
|
||||||
Given group "sales" has been created
|
Given group "sales" has been created
|
||||||
|
And using SharingNG
|
||||||
And the administrator has added a user "Brian" to the group "sales" using the Graph API
|
And the administrator has added a user "Brian" to the group "sales" using the Graph API
|
||||||
And user "Alice" has created a share inside of space "share sub-item" with settings:
|
And user "Alice" has sent the following resource share invitation:
|
||||||
| path | folder |
|
| resource | folder |
|
||||||
| shareWith | sales |
|
| space | share sub-item |
|
||||||
| shareType | 1 |
|
| sharee | sales |
|
||||||
| role | viewer |
|
| shareType | group |
|
||||||
| expireDate | 2042-01-01T23:59:59+0100 |
|
| permissionsRole | Viewer |
|
||||||
When user "Alice" expires the last share
|
| expireDate | 2042-01-01T23:59:59.000Z |
|
||||||
|
When user "Alice" expires the last share of resource "folder" inside of the space "share sub-item"
|
||||||
Then the HTTP status code should be "200"
|
Then the HTTP status code should be "200"
|
||||||
And as "Brian" folder "Shares/folder" should not exist
|
And as "Brian" folder "Shares/folder" should not exist
|
||||||
|
|||||||
@@ -1934,10 +1934,11 @@ trait Sharing {
|
|||||||
* @param TableNode $table
|
* @param TableNode $table
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function userGetsTheLastShareSharedWithHimUsingTheSharingApi(string $user, TableNode $table):void {
|
public function userGetsTheLastShareSharedWithHimUsingTheSharingApi(string $user, TableNode $table):void {
|
||||||
$user = $this->getActualUsername($user);
|
$user = $this->getActualUsername($user);
|
||||||
$shareId = (string) $this->getLastCreatedPublicShare()->id;
|
$shareId = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId();
|
||||||
$response = $this->getShareData($user, $shareId);
|
$response = $this->getShareData($user, $shareId);
|
||||||
$this->checkFields($user, $table, $response);
|
$this->checkFields($user, $table, $response);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2244,7 +2244,8 @@ class SpacesContext implements Context {
|
|||||||
$this->featureContext->getStepLineRef()
|
$this->featureContext->getStepLineRef()
|
||||||
);
|
);
|
||||||
$responseXml = $this->featureContext->getResponseXml($response, __METHOD__);
|
$responseXml = $this->featureContext->getResponseXml($response, __METHOD__);
|
||||||
$this->featureContext->addToCreatedPublicShares($responseXml->data);
|
$sharer = (string) $responseXml->data->uid_owner;
|
||||||
|
$this->featureContext->addToCreatedUserGroupshares($sharer, $responseXml->data);
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2314,7 +2315,7 @@ class SpacesContext implements Context {
|
|||||||
* @throws JsonException
|
* @throws JsonException
|
||||||
*/
|
*/
|
||||||
public function updateSharedResource(string $user, array $rows):ResponseInterface {
|
public function updateSharedResource(string $user, array $rows):ResponseInterface {
|
||||||
$shareId = (string) $this->featureContext->getLastCreatedPublicShare()->id;
|
$shareId = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedUserGroupShareID() : $this->featureContext->getLastCreatedUserGroupShareId();
|
||||||
$fullUrl = $this->baseUrl . $this->ocsApiUrl . '/' . $shareId;
|
$fullUrl = $this->baseUrl . $this->ocsApiUrl . '/' . $shareId;
|
||||||
return HttpRequestHelper::sendRequest(
|
return HttpRequestHelper::sendRequest(
|
||||||
$fullUrl,
|
$fullUrl,
|
||||||
@@ -2328,17 +2329,44 @@ class SpacesContext implements Context {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @When /^user "([^"]*)" expires the last share$/
|
* @When user :user expires the last share of resource :resource inside of the space :spaceName
|
||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
|
* @param string $resource
|
||||||
|
* @param string $spaceName
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws GuzzleException|JsonException
|
||||||
*/
|
*/
|
||||||
public function userExpiresLastResourceShare(string $user): void {
|
public function userExpiresTheLastShareOfResourceInsideOfTheSpace(string $user, string $resource, string $spaceName): void {
|
||||||
$dateTime = new DateTime('yesterday');
|
$dateTime = new DateTime('yesterday');
|
||||||
$rows['expireDate'] = $dateTime->format('Y-m-d\\TH:i:sP');
|
$rows['expireDate'] = $dateTime->format('Y-m-d\\TH:i:sP');
|
||||||
$rows['permissions'] = (string) $this->featureContext->getLastCreatedPublicShare()->permissions;
|
if ($this->featureContext->isUsingSharingNG()) {
|
||||||
$this->featureContext->setResponse($this->updateSharedResource($user, $rows));
|
if (!\in_array($spaceName, ['Personal', 'Shares'])) {
|
||||||
|
$space = $this->getSpaceByName($user, $spaceName);
|
||||||
|
$itemId = $this->getResourceId($user, $spaceName, $resource);
|
||||||
|
} else {
|
||||||
|
$space = $this->getCreatedSpace($spaceName);
|
||||||
|
$itemId = $space['fileId'];
|
||||||
|
}
|
||||||
|
$body['expirationDateTime'] = $rows['expireDate'];
|
||||||
|
$permissionID = $this->featureContext->shareNgGetLastCreatedUserGroupShareID();
|
||||||
|
$this->featureContext->setResponse(
|
||||||
|
GraphHelper::updateShare(
|
||||||
|
$this->featureContext->getBaseUrl(),
|
||||||
|
$this->featureContext->getStepLineRef(),
|
||||||
|
$user,
|
||||||
|
$this->featureContext->getPasswordForUser($user),
|
||||||
|
$space["id"],
|
||||||
|
$itemId,
|
||||||
|
\json_encode($body),
|
||||||
|
$permissionID
|
||||||
|
)
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$rows['permissions'] = (string)$this->featureContext->getLastCreatedUserGroupShare()->permissions;
|
||||||
|
$this->featureContext->setResponse($this->updateSharedResource($user, $rows));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3410,12 +3438,12 @@ class SpacesContext implements Context {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @Then /^for user "([^"]*)" the space "([^"]*)" should (not|)\s?contain the last created public link$/
|
* @Then /^for user "([^"]*)" the space "([^"]*)" should (not|)\s?contain the last created public link$/
|
||||||
* @Then /^for user "([^"]*)" the space "([^"]*)" should (not|)\s?contain the last created public link of the file "([^"]*)"$/
|
* @Then /^for user "([^"]*)" the space "([^"]*)" should (not|)\s?contain the last created (public link|share) of the file "([^"]*)"$/
|
||||||
* @Then /^for user "([^"]*)" the space "([^"]*)" should (not|)\s?contain the last created share of the file "([^"]*)"$/
|
|
||||||
*
|
*
|
||||||
* @param string $user
|
* @param string $user
|
||||||
* @param string $spaceName
|
* @param string $spaceName
|
||||||
* @param string $shouldOrNot (not|)
|
* @param string $shouldOrNot (not|)
|
||||||
|
* @param string $shareType
|
||||||
* @param string $fileName
|
* @param string $fileName
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
@@ -3426,6 +3454,7 @@ class SpacesContext implements Context {
|
|||||||
string $user,
|
string $user,
|
||||||
string $spaceName,
|
string $spaceName,
|
||||||
string $shouldOrNot,
|
string $shouldOrNot,
|
||||||
|
string $shareType = 'public link',
|
||||||
string $fileName = ''
|
string $fileName = ''
|
||||||
): void {
|
): void {
|
||||||
if (!empty($fileName)) {
|
if (!empty($fileName)) {
|
||||||
@@ -3449,8 +3478,13 @@ class SpacesContext implements Context {
|
|||||||
if ($should) {
|
if ($should) {
|
||||||
Assert::assertNotEmpty($responseArray, __METHOD__ . ' Response should contain a link, but it is empty');
|
Assert::assertNotEmpty($responseArray, __METHOD__ . ' Response should contain a link, but it is empty');
|
||||||
foreach ($responseArray as $element) {
|
foreach ($responseArray as $element) {
|
||||||
$expectedLinkId = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareID() : (string) $this->featureContext->getLastCreatedPublicShare()->id;
|
if ($shareType === 'public link') {
|
||||||
Assert::assertEquals($element["id"], $expectedLinkId, "link IDs are different");
|
$expectedLinkId = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareID() : (string) $this->featureContext->getLastCreatedPublicShare()->id;
|
||||||
|
Assert::assertEquals($element["id"], $expectedLinkId, "link IDs are different");
|
||||||
|
} else {
|
||||||
|
$expectedShareId = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedUserGroupShareID() : (string)$this->featureContext->getLastCreatedUserGroupShareId();
|
||||||
|
Assert::assertEquals($element["id"], $expectedShareId, "share IDs are different");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Assert::assertEmpty($responseArray, __METHOD__ . ' Response should be empty');
|
Assert::assertEmpty($responseArray, __METHOD__ . ' Response should be empty');
|
||||||
|
|||||||
Reference in New Issue
Block a user