aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2020-09-24 14:45:36 +0200
committerGitHub <noreply@github.com>2020-09-24 14:45:36 +0200
commitacba3da7c877fbb470078489fe6346fbf157d317 (patch)
treedbaaaac7aa2ffc033325444cab073df7856eda19
parent82ca70a5803d7ae4928f822c351086cd703d0e82 (diff)
parent7b9a40b40714e992ccbe9b2fd190121bdb2a809a (diff)
downloadnextcloud-server-acba3da7c877fbb470078489fe6346fbf157d317.tar.gz
nextcloud-server-acba3da7c877fbb470078489fe6346fbf157d317.zip
Merge pull request #22948 from nextcloud/add-more-integration-tests-for-files-transfer-ownership-command
Add more integration tests for "files:transfer-ownership" command
-rw-r--r--build/integration/features/bootstrap/CommandLineContext.php8
-rw-r--r--build/integration/features/bootstrap/Provisioning.php2
-rw-r--r--build/integration/features/transfer-ownership.feature97
3 files changed, 106 insertions, 1 deletions
diff --git a/build/integration/features/bootstrap/CommandLineContext.php b/build/integration/features/bootstrap/CommandLineContext.php
index 3acb59ec404..6db8de6b485 100644
--- a/build/integration/features/bootstrap/CommandLineContext.php
+++ b/build/integration/features/bootstrap/CommandLineContext.php
@@ -27,6 +27,7 @@
require __DIR__ . '/../../vendor/autoload.php';
use Behat\Behat\Hook\Scope\BeforeScenarioScope;
+use PHPUnit\Framework\Assert;
class CommandLineContext implements \Behat\Behat\Context\Context {
use CommandLine;
@@ -129,4 +130,11 @@ class CommandLineContext implements \Behat\Behat\Context\Context {
$davPath = rtrim($davPath, '/') . $this->lastTransferPath;
$this->featureContext->usingDavPath($davPath);
}
+
+ /**
+ * @Then /^transfer folder name contains "([^"]+)"$/
+ */
+ public function transferFolderNameContains($text) {
+ Assert::assertContains($text, $this->lastTransferPath);
+ }
}
diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php
index daf5b11569c..31331092ae7 100644
--- a/build/integration/features/bootstrap/Provisioning.php
+++ b/build/integration/features/bootstrap/Provisioning.php
@@ -70,7 +70,7 @@ trait Provisioning {
}
/**
- * @Given /^user "([^"]*)" with displayname "([^"]*)" exists$/
+ * @Given /^user "([^"]*)" with displayname "((?:[^"]|\\")*)" exists$/
* @param string $user
*/
public function assureUserWithDisplaynameExists($user, $displayname) {
diff --git a/build/integration/features/transfer-ownership.feature b/build/integration/features/transfer-ownership.feature
index 76e55af89a7..d8dd4d5c09d 100644
--- a/build/integration/features/transfer-ownership.feature
+++ b/build/integration/features/transfer-ownership.feature
@@ -29,6 +29,22 @@ Feature: transfer-ownership
And using received transfer folder of "user1" as dav path
And as "user1" the folder "/test" exists
+ Scenario: transferring ownership from user with risky display name
+ Given user "user0" with displayname "user0 \"risky\"? ヂspḷay 'na|\/|e':.#" exists
+ And user "user1" exists
+ And User "user0" created a folder "/test"
+ And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt"
+ When transferring ownership from "user0" to "user1"
+ And the command was successful
+ And As an "user1"
+ And using received transfer folder of "user1" as dav path
+ Then Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is"
+ And transfer folder name contains "transferred from user0 -risky- ヂspḷay -na|-|e- on"
+ And using old dav path
+ And as "user0" the folder "/test" does not exist
+ And using received transfer folder of "user1" as dav path
+ And as "user1" the folder "/test" exists
+
Scenario: transferring ownership of file shares
Given user "user0" exists
And user "user1" exists
@@ -290,6 +306,20 @@ Feature: transfer-ownership
Then the command error output contains the text "Unknown target user"
And the command failed with exit code 1
+ Scenario: transferring ownership of a file
+ Given user "user0" exists
+ And user "user1" exists
+ And User "user0" uploads file "data/textfile.txt" to "/somefile.txt"
+ When transferring ownership of path "somefile.txt" from "user0" to "user1"
+ And the command was successful
+ And As an "user1"
+ And using received transfer folder of "user1" as dav path
+ Then Downloaded content when downloading file "/somefile.txt" with range "bytes=0-6" should be "This is"
+ And using old dav path
+ And as "user0" the file "/somefile.txt" does not exist
+ And using received transfer folder of "user1" as dav path
+ And as "user1" the file "/somefile.txt" exists
+
Scenario: transferring ownership of a folder
Given user "user0" exists
And user "user1" exists
@@ -305,6 +335,73 @@ Feature: transfer-ownership
And using received transfer folder of "user1" as dav path
And as "user1" the folder "/test" exists
+ Scenario: transferring ownership from user with risky display name
+ Given user "user0" with displayname "user0 \"risky\"? ヂspḷay 'na|\/|e':.#" exists
+ And user "user1" exists
+ And User "user0" created a folder "/test"
+ And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt"
+ When transferring ownership of path "test" from "user0" to "user1"
+ And the command was successful
+ And As an "user1"
+ And using received transfer folder of "user1" as dav path
+ Then Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is"
+ And transfer folder name contains "transferred from user0 -risky- ヂspḷay -na|-|e- on"
+ And using old dav path
+ And as "user0" the folder "/test" does not exist
+ And using received transfer folder of "user1" as dav path
+ And as "user1" the folder "/test" exists
+
+ Scenario: transferring ownership of path does not affect other files
+ Given user "user0" exists
+ And user "user1" exists
+ And User "user0" created a folder "/test"
+ And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt"
+ And User "user0" created a folder "/test2"
+ And User "user0" uploads file "data/textfile.txt" to "/test2/somefile.txt"
+ When transferring ownership of path "test" from "user0" to "user1"
+ And the command was successful
+ And As an "user1"
+ And using received transfer folder of "user1" as dav path
+ Then Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is"
+ And using old dav path
+ And as "user0" the folder "/test" does not exist
+ And as "user0" the folder "/test2" exists
+ And as "user0" the file "/test2/somefile.txt" exists
+ And using received transfer folder of "user1" as dav path
+ And as "user1" the folder "/test" exists
+ And as "user1" the folder "/test2" does not exist
+
+ Scenario: transferring ownership of path does not affect other shares
+ Given user "user0" exists
+ And user "user1" exists
+ And User "user0" created a folder "/test"
+ And User "user0" uploads file "data/textfile.txt" to "/test/somefile.txt"
+ And User "user0" created a folder "/test2"
+ And User "user0" uploads file "data/textfile.txt" to "/test2/sharedfile.txt"
+ And file "/test2/sharedfile.txt" of user "user0" is shared with user "user1" with permissions 19
+ And user "user1" accepts last share
+ When transferring ownership of path "test" from "user0" to "user1"
+ And the command was successful
+ And As an "user1"
+ And using received transfer folder of "user1" as dav path
+ Then Downloaded content when downloading file "/test/somefile.txt" with range "bytes=0-6" should be "This is"
+ And using old dav path
+ And as "user0" the folder "/test" does not exist
+ And as "user0" the folder "/test2" exists
+ And as "user0" the file "/test2/sharedfile.txt" exists
+ And using received transfer folder of "user1" as dav path
+ And as "user1" the folder "/test" exists
+ And as "user1" the folder "/test2" does not exist
+ And using old dav path
+ And as "user1" the file "/sharedfile.txt" exists
+ And As an "user1"
+ And Getting info of last share
+ And the OCS status code should be "100"
+ And Share fields of last share match with
+ | uid_owner | user0 |
+ | uid_file_owner | user0 |
+ | share_with | user1 |
+
Scenario: transferring ownership of file shares
Given user "user0" exists
And user "user1" exists