Skip to content

Commit

Permalink
Merge pull request #37106 from owncloud/permutationsForIncomingOutgoi…
Browse files Browse the repository at this point in the history
…ngFederationShares

[Tests-Only] Acceptance tests when incoming and outgoing federated share settings are enabled or disabled
  • Loading branch information
phil-davis authored Mar 13, 2020
2 parents 47b2495 + 568c66f commit ce294a8
Show file tree
Hide file tree
Showing 2 changed files with 143 additions and 0 deletions.
124 changes: 124 additions & 0 deletions tests/acceptance/features/apiFederation/federated.feature
Original file line number Diff line number Diff line change
Expand Up @@ -864,6 +864,130 @@ Feature: federated
And using server "LOCAL"
Then as "user1" file "/CHILD/newRandomFolder/RandomFolder/newFile" should exist
And the content of file "/CHILD/newRandomFolder/RandomFolder/file-to-share" for user "user1" should be "theContentIsChanged"
Examples:
| ocs-api-version |
| 1 |
| 2 |

Scenario Outline: Both Incoming and Outgoing federation shares are allowed
Given parameter "incoming_server2server_share_enabled" of app "files_sharing" has been set to "yes"
And parameter "outgoing_server2server_share_enabled" of app "files_sharing" has been set to "yes"
And using OCS API version "<ocs-api-version>"
And user "user1" has uploaded file with content "thisContentIsVisible" to "/file-to-share"
When user "user1" from server "LOCAL" shares "file-to-share" with user "user0" from server "REMOTE" using the sharing API
And user "user0" from server "REMOTE" accepts the last pending share using the sharing API
And using server "REMOTE"
Then as "user0" file "/file-to-share" should exist
And the content of file "/file-to-share" for user "user0" should be "thisContentIsVisible"
When user "user0" uploads file with content "thisFileIsShared" to "/newFile" using the WebDAV API
And user "user0" from server "REMOTE" shares "/newFile" with user "user1" from server "LOCAL" using the sharing API
And using server "LOCAL"
When user "user1" from server "LOCAL" accepts the last pending share using the sharing API
Then as "user1" file "/newFile" should exist
And the content of file "/newFile" for user "user1" should be "thisFileIsShared"
Examples:
| ocs-api-version |
| 1 |
| 2 |

Scenario Outline: Incoming federation shares are allowed but outgoing federation shares are restricted
Given parameter "incoming_server2server_share_enabled" of app "files_sharing" has been set to "yes"
And parameter "outgoing_server2server_share_enabled" of app "files_sharing" has been set to "no"
And user "user1" has uploaded file with content "thisContentIsVisible" to "/file-to-share"
And using OCS API version "<ocs-api-version>"
When user "user1" from server "LOCAL" shares "file-to-share" with user "user0" from server "REMOTE" using the sharing API
And using server "REMOTE"
Then user "user0" should not have any pending federated cloud share
And as "user0" file "/file-to-share" should not exist
When user "user0" uploads file with content "thisFileIsShared" to "/newFile" using the WebDAV API
And user "user0" from server "REMOTE" shares "/newFile" with user "user1" from server "LOCAL" using the sharing API
And using server "LOCAL"
When user "user1" from server "LOCAL" accepts the last pending share using the sharing API
Then as "user1" file "/newFile" should exist
Examples:
| ocs-api-version |
| 1 |
| 2 |

Scenario Outline: Incoming federation shares are restricted but outgoing federation shares are allowed
Given parameter "incoming_server2server_share_enabled" of app "files_sharing" has been set to "no"
And parameter "outgoing_server2server_share_enabled" of app "files_sharing" has been set to "yes"
And user "user1" has uploaded file with content "thisContentIsVisible" to "/file-to-share"
And using OCS API version "<ocs-api-version>"
When user "user1" from server "LOCAL" shares "/file-to-share" with user "user0" from server "REMOTE" using the sharing API
And using server "REMOTE"
And user "user0" from server "REMOTE" accepts the last pending share using the sharing API
Then as "user0" file "/file-to-share" should exist
When user "user0" uploads file with content "thisFileIsShared" to "/newFile" using the WebDAV API
And user "user0" from server "REMOTE" shares "/newFile" with user "user1" from server "LOCAL" using the sharing API
And using server "LOCAL"
Then user "user1" should not have any pending federated cloud share
And as "user1" file "/newFile" should not exist
Examples:
| ocs-api-version |
| 1 |
| 2 |

Scenario Outline: Both Incoming and outgoing federation shares are restricted
Given parameter "incoming_server2server_share_enabled" of app "files_sharing" has been set to "no"
And parameter "outgoing_server2server_share_enabled" of app "files_sharing" has been set to "no"
And user "user1" has uploaded file with content "thisContentIsVisible" to "/file-to-share"
And using OCS API version "<ocs-api-version>"
When user "user1" from server "LOCAL" shares "/file-to-share" with user "user0" from server "REMOTE" using the sharing API
And using server "REMOTE"
Then user "user0" should not have any pending federated cloud share
And as "user0" file "/file-to-share" should not exist
When user "user0" uploads file with content "thisFileIsShared" to "/newFile" using the WebDAV API
And user "user0" from server "REMOTE" shares "/newFile" with user "user1" from server "LOCAL" using the sharing API
And using server "LOCAL"
Then user "user1" should not have any pending federated cloud share
And as "user1" file "/newFile" should not exist
Examples:
| ocs-api-version |
| 1 |
| 2 |

Scenario Outline: Incoming and outgoing federation shares are enabled for local server but incoming federation shares are restricted for remote server
Given using server "REMOTE"
And parameter "incoming_server2server_share_enabled" of app "files_sharing" has been set to "no"
And parameter "outgoing_server2server_share_enabled" of app "files_sharing" has been set to "yes"
And using server "LOCAL"
And parameter "incoming_server2server_share_enabled" of app "files_sharing" has been set to "yes"
And parameter "outgoing_server2server_share_enabled" of app "files_sharing" has been set to "yes"
And user "user1" has uploaded file with content "thisContentIsVisible" to "/file-to-share"
And using OCS API version "<ocs-api-version>"
When user "user1" from server "LOCAL" shares "/file-to-share" with user "user0" from server "REMOTE" using the sharing API
And using server "REMOTE"
Then user "user0" should not have any pending federated cloud share
And as "user0" file "/file-to-share" should not exist
When user "user0" uploads file with content "thisFileIsShared" to "/newFile" using the WebDAV API
And user "user0" from server "REMOTE" shares "/newFile" with user "user1" from server "LOCAL" using the sharing API
And using server "LOCAL"
And user "user1" from server "LOCAL" accepts the last pending share using the sharing API
Then as "user1" file "/newFile" should exist
Examples:
| ocs-api-version |
| 1 |
| 2 |

Scenario Outline: Incoming and outgoing federation shares are enabled for local server but outgoing federation shares are restricted for remote server
Given using server "REMOTE"
And parameter "incoming_server2server_share_enabled" of app "files_sharing" has been set to "yes"
And parameter "outgoing_server2server_share_enabled" of app "files_sharing" has been set to "no"
And using server "LOCAL"
And parameter "incoming_server2server_share_enabled" of app "files_sharing" has been set to "yes"
And parameter "outgoing_server2server_share_enabled" of app "files_sharing" has been set to "yes"
And user "user1" has uploaded file with content "thisContentIsVisible" to "/file-to-share"
And using OCS API version "<ocs-api-version>"
When user "user1" from server "LOCAL" shares "/file-to-share" with user "user0" from server "REMOTE" using the sharing API
And using server "REMOTE"
And user "user0" from server "REMOTE" accepts the last pending share using the sharing API
Then as "user0" file "/file-to-share" should exist
When user "user0" uploads file with content "thisFileIsShared" to "/newFile" using the WebDAV API
And user "user0" from server "REMOTE" shares "/newFile" with user "user1" from server "LOCAL" using the sharing API
And using server "LOCAL"
Then user "user1" should not have any pending federated cloud share
And as "user1" file "/newFile" should not exist
Examples:
| ocs-api-version |
| 1 |
Expand Down
19 changes: 19 additions & 0 deletions tests/acceptance/features/bootstrap/FederationContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use Behat\Behat\Context\Context;
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
use TestHelpers\SharingHelper;
use PHPUnit\Framework\Assert;

require_once 'bootstrap.php';

Expand Down Expand Up @@ -202,6 +203,24 @@ public function userRetrievesInformationOfLastFederatedShare($user) {
);
}

/**
* @Then user :user should not have any pending federated cloud share
*
* @param string $user
*
* @return void
*/
public function userShouldHaveNoLastPendingFederatedCloudShare($user) {
$this->userGetsTheListOfPendingFederatedCloudShares($user);
$responseXml = $this->featureContext->getResponseXml();
$xmlPart = $responseXml->xpath("//data/element[last()]/id");
Assert::assertTrue(
!\is_array($xmlPart) || (\count($xmlPart) === 0),
__METHOD__
. " No pending federated cloud shares were expected, but got unexpectedly."
);
}

/**
* @When /^user "([^"]*)" retrieves the information of the last pending federated cloud share using the sharing API$/
*
Expand Down

0 comments on commit ce294a8

Please sign in to comment.