diff options
author | Bjoern Schiessle <bjoern@schiessle.org> | 2018-07-05 13:51:34 +0200 |
---|---|---|
committer | Bjoern Schiessle <bjoern@schiessle.org> | 2018-07-11 10:11:49 +0200 |
commit | 0c09f566c24e45b3d4dc91dc2bddc341e4f76fbd (patch) | |
tree | cc2dc43acfb8400487c63559203714c0a21ca24a /build/integration | |
parent | f0aaf62b24a0ecdb964665c94cfac330b86afed2 (diff) | |
download | nextcloud-server-0c09f566c24e45b3d4dc91dc2bddc341e4f76fbd.tar.gz nextcloud-server-0c09f566c24e45b3d4dc91dc2bddc341e4f76fbd.zip |
add some integration tests
Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org>
Diffstat (limited to 'build/integration')
-rw-r--r-- | build/integration/features/bootstrap/FederationContext.php | 27 | ||||
-rw-r--r-- | build/integration/federation_features/federated.feature | 94 |
2 files changed, 121 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/FederationContext.php b/build/integration/features/bootstrap/FederationContext.php index f3eb004fb84..12bf9c0fe63 100644 --- a/build/integration/features/bootstrap/FederationContext.php +++ b/build/integration/features/bootstrap/FederationContext.php @@ -35,6 +35,7 @@ require __DIR__ . '/../../vendor/autoload.php'; class FederationContext implements Context, SnippetAcceptingContext { use WebDav; + use AppConfiguration; /** * @Given /^User "([^"]*)" from server "(LOCAL|REMOTE)" shares "([^"]*)" with user "([^"]*)" from server "(LOCAL|REMOTE)"$/ @@ -56,6 +57,27 @@ class FederationContext implements Context, SnippetAcceptingContext { $this->usingServer($previous); } + + /** + * @Given /^User "([^"]*)" from server "(LOCAL|REMOTE)" shares "([^"]*)" with group "([^"]*)" from server "(LOCAL|REMOTE)"$/ + * + * @param string $sharerUser + * @param string $sharerServer "LOCAL" or "REMOTE" + * @param string $sharerPath + * @param string $shareeUser + * @param string $shareeServer "LOCAL" or "REMOTE" + */ + public function federateGroupSharing($sharerUser, $sharerServer, $sharerPath, $shareeGroup, $shareeServer){ + if ($shareeServer == "REMOTE"){ + $shareWith = "$shareeGroup@" . substr($this->remoteBaseUrl, 0, -4); + } else { + $shareWith = "$shareeGroup@" . substr($this->localBaseUrl, 0, -4); + } + $previous = $this->usingServer($sharerServer); + $this->createShare($sharerUser, $sharerPath, 9, $shareWith, null, null, null); + $this->usingServer($previous); + } + /** * @When /^User "([^"]*)" from server "(LOCAL|REMOTE)" accepts last pending share$/ * @param string $user @@ -73,4 +95,9 @@ class FederationContext implements Context, SnippetAcceptingContext { $this->theOCSStatusCodeShouldBe('100'); $this->usingServer($previous); } + + protected function resetAppConfigs() { + $this->modifyServerConfig('files_sharing', 'incoming_server2server_group_share_enabled', 'no'); + $this->modifyServerConfig('files_sharing', 'outgoing_server2server_group_share_enabled', 'no'); + } } diff --git a/build/integration/federation_features/federated.feature b/build/integration/federation_features/federated.feature index c7b20cf86a7..87515e2ccab 100644 --- a/build/integration/federation_features/federated.feature +++ b/build/integration/federation_features/federated.feature @@ -28,6 +28,40 @@ Feature: federated | share_with | user1@REMOTE | | share_with_displayname | user1@REMOTE | + Scenario: Federated group share a file with another server + Given Using server "REMOTE" + And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes" + And user "gs-user1" exists + And user "gs-user2" exists + And group "group1" exists + And As an "admin" + And Add user "gs-user1" to the group "group1" + And Add user "gs-user2" to the group "group1" + And Using server "LOCAL" + And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes" + And user "gs-user0" exists + When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE" + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And Share fields of last share match with + | id | A_NUMBER | + | item_type | file | + | item_source | A_NUMBER | + | share_type | 9 | + | file_source | A_NUMBER | + | path | /textfile0.txt | + | permissions | 19 | + | stime | A_NUMBER | + | storage | A_NUMBER | + | mail_send | 0 | + | uid_owner | gs-user0 | + | storage_id | home::gs-user0 | + | file_parent | A_NUMBER | + | displayname_owner | gs-user0 | + | share_with | group1@REMOTE | + | share_with_displayname | group1@REMOTE | + + Scenario: Federate share a file with local server Given Using server "LOCAL" And user "user0" exists @@ -76,6 +110,49 @@ Feature: federated | mountpoint | {{TemporaryMountPointName#/textfile0.txt}} | | accepted | 0 | + Scenario: Remote sharee can see the pending group share + Given Using server "REMOTE" + And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes" + And user "gs-user1" exists + And user "gs-user2" exists + And group "group1" exists + And As an "admin" + And Add user "gs-user1" to the group "group1" + And Add user "gs-user2" to the group "group1" + And Using server "LOCAL" + And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes" + And user "gs-user0" exists + When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE" + And Using server "REMOTE" + And As an "gs-user1" + When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending" + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And Share fields of last share match with + | id | A_NUMBER | + | remote | LOCAL | + | remote_id | A_NUMBER | + | share_token | A_TOKEN | + | name | /textfile0.txt | + | owner | gs-user0 | + | user | group1 | + | mountpoint | {{TemporaryMountPointName#/textfile0.txt}} | + | accepted | 0 | + And As an "gs-user2" + When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending" + Then the OCS status code should be "100" + And the HTTP status code should be "200" + And Share fields of last share match with + | id | A_NUMBER | + | remote | LOCAL | + | remote_id | A_NUMBER | + | share_token | A_TOKEN | + | name | /textfile0.txt | + | owner | gs-user0 | + | user | group1 | + | mountpoint | {{TemporaryMountPointName#/textfile0.txt}} | + | accepted | 0 | + Scenario: accept a pending remote share Given Using server "REMOTE" And user "user1" exists @@ -86,6 +163,23 @@ Feature: federated Then the OCS status code should be "100" And the HTTP status code should be "200" + Scenario: accept a pending remote group share + Given Using server "REMOTE" + And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes" + And user "gs-user1" exists + And user "gs-user2" exists + And group "group1" exists + And As an "admin" + And Add user "gs-user1" to the group "group1" + And Add user "gs-user2" to the group "group1" + And Using server "LOCAL" + And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes" + And user "gs-user0" exists + When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE" + When User "gs-user1" from server "REMOTE" accepts last pending share + Then the OCS status code should be "100" + And the HTTP status code should be "200" + Scenario: Reshare a federated shared file Given Using server "REMOTE" And user "user1" exists |