summaryrefslogtreecommitdiffstats
path: root/build/integration
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2021-01-22 14:34:02 +0100
committerVincent Petry <vincent@nextcloud.com>2021-11-05 09:48:49 +0100
commit66b5a2d56afd1d84117b99e468ec7788c44d21b1 (patch)
treee88cf36a06c750d47f390a970608d39154ccb08f /build/integration
parentec4474c459c296c8fd87aa16a0399b4fb9ab0a92 (diff)
downloadnextcloud-server-66b5a2d56afd1d84117b99e468ec7788c44d21b1.tar.gz
nextcloud-server-66b5a2d56afd1d84117b99e468ec7788c44d21b1.zip
Add integration tests for deleting federated shares
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'build/integration')
-rw-r--r--build/integration/features/bootstrap/FederationContext.php14
-rw-r--r--build/integration/federation_features/federated.feature96
2 files changed, 102 insertions, 8 deletions
diff --git a/build/integration/features/bootstrap/FederationContext.php b/build/integration/features/bootstrap/FederationContext.php
index 2754cf668e6..d859afc610f 100644
--- a/build/integration/features/bootstrap/FederationContext.php
+++ b/build/integration/features/bootstrap/FederationContext.php
@@ -39,6 +39,9 @@ class FederationContext implements Context, SnippetAcceptingContext {
use AppConfiguration;
use CommandLine;
+ /** @var string */
+ private $lastAcceptedRemoteShareId;
+
/**
* @BeforeScenario
*/
@@ -109,6 +112,17 @@ class FederationContext implements Context, SnippetAcceptingContext {
$this->theHTTPStatusCodeShouldBe('200');
$this->theOCSStatusCodeShouldBe('100');
$this->usingServer($previous);
+
+ $this->lastAcceptedRemoteShareId = $share_id;
+ }
+
+ /**
+ * @When /^user "([^"]*)" deletes last accepted remote share$/
+ * @param string $user
+ */
+ public function deleteLastAcceptedRemoteShare($user) {
+ $this->asAn($user);
+ $this->sendingToWith('DELETE', "/apps/files_sharing/api/v1/remote_shares/" . $this->lastAcceptedRemoteShareId, null);
}
protected function resetAppConfigs() {
diff --git a/build/integration/federation_features/federated.feature b/build/integration/federation_features/federated.feature
index 17ec6b4b43e..46794e02ff8 100644
--- a/build/integration/federation_features/federated.feature
+++ b/build/integration/federation_features/federated.feature
@@ -278,13 +278,93 @@ Feature: federated
+ Scenario: Delete federated share with another server
+ Given Using server "LOCAL"
+ And user "user0" exists
+ Given Using server "REMOTE"
+ And user "user1" exists
+ # Rename file so it has a unique name in the target server (as the target
+ # server may have its own /textfile0.txt" file)
+ And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
+ And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
+ And As an "user1"
+ And sending "GET" to "/apps/files_sharing/api/v1/shares"
+ And the list of returned shares has 1 shares
+ And Using server "LOCAL"
+ And User "user0" from server "LOCAL" accepts last pending share
+ And as "user0" the file "/remote-share.txt" exists
+ And As an "user0"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 1 shares
+ And Using server "REMOTE"
+ When As an "user1"
+ And Deleting last share
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And As an "user1"
+ And sending "GET" to "/apps/files_sharing/api/v1/shares"
+ And the list of returned shares has 0 shares
+ And Using server "LOCAL"
+ And as "user0" the file "/remote-share.txt" does not exist
+ And As an "user0"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 0 shares
+ Scenario: Delete federated share from another server
+ Given Using server "LOCAL"
+ And user "user0" exists
+ Given Using server "REMOTE"
+ And user "user1" exists
+ # Rename file so it has a unique name in the target server (as the target
+ # server may have its own /textfile0.txt" file)
+ And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
+ And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
+ And As an "user1"
+ And sending "GET" to "/apps/files_sharing/api/v1/shares"
+ And the list of returned shares has 1 shares
+ And Using server "LOCAL"
+ And User "user0" from server "LOCAL" accepts last pending share
+ And as "user0" the file "/remote-share.txt" exists
+ And As an "user0"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 1 shares
+ When user "user0" deletes last accepted remote share
+ Then the OCS status code should be "100"
+ And the HTTP status code should be "200"
+ And as "user0" the file "/remote-share.txt" does not exist
+ And As an "user0"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 0 shares
+ And Using server "REMOTE"
+ And As an "user1"
+ And sending "GET" to "/apps/files_sharing/api/v1/shares"
+ And the list of returned shares has 0 shares
-
-
-
-
-
-
-
-
+ Scenario: Delete federated share file from another server
+ Given Using server "LOCAL"
+ And user "user0" exists
+ Given Using server "REMOTE"
+ And user "user1" exists
+ # Rename file so it has a unique name in the target server (as the target
+ # server may have its own /textfile0.txt" file)
+ And User "user1" copies file "/textfile0.txt" to "/remote-share.txt"
+ And User "user1" from server "REMOTE" shares "/remote-share.txt" with user "user0" from server "LOCAL"
+ And As an "user1"
+ And sending "GET" to "/apps/files_sharing/api/v1/shares"
+ And the list of returned shares has 1 shares
+ And Using server "LOCAL"
+ And User "user0" from server "LOCAL" accepts last pending share
+ And as "user0" the file "/remote-share.txt" exists
+ And As an "user0"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 1 shares
+ When User "user0" deletes file "/remote-share.txt"
+ Then the HTTP status code should be "204"
+ And as "user0" the file "/remote-share.txt" does not exist
+ And As an "user0"
+ And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
+ And the list of returned shares has 0 shares
+ And Using server "REMOTE"
+ And As an "user1"
+ And sending "GET" to "/apps/files_sharing/api/v1/shares"
+ And the list of returned shares has 0 shares