aboutsummaryrefslogtreecommitdiffstats
path: root/build/integration
diff options
context:
space:
mode:
Diffstat (limited to 'build/integration')
-rw-r--r--build/integration/features/bootstrap/FilesDropContext.php20
-rw-r--r--build/integration/filesdrop_features/filesdrop.feature31
2 files changed, 48 insertions, 3 deletions
diff --git a/build/integration/features/bootstrap/FilesDropContext.php b/build/integration/features/bootstrap/FilesDropContext.php
index b611e55ea0f..1b9d598645f 100644
--- a/build/integration/features/bootstrap/FilesDropContext.php
+++ b/build/integration/features/bootstrap/FilesDropContext.php
@@ -15,7 +15,7 @@ class FilesDropContext implements Context, SnippetAcceptingContext {
/**
* @When Dropping file :path with :content
*/
- public function droppingFileWith($path, $content) {
+ public function droppingFileWith($path, $content, $nickName = null) {
$client = new Client();
$options = [];
if (count($this->lastShareData->data->element) > 0) {
@@ -25,11 +25,16 @@ class FilesDropContext implements Context, SnippetAcceptingContext {
}
$base = substr($this->baseUrl, 0, -4);
- $fullUrl = $base . "/public.php/dav/files/$token/$path";
+ $fullUrl = str_replace('//', '/', $base . "/public.php/dav/files/$token/$path");
$options['headers'] = [
'X-REQUESTED-WITH' => 'XMLHttpRequest'
];
+
+ if ($nickName) {
+ $options['headers']['X-NC-NICKNAME'] = $nickName;
+ }
+
$options['body'] = \GuzzleHttp\Psr7\Utils::streamFor($content);
try {
@@ -38,6 +43,15 @@ class FilesDropContext implements Context, SnippetAcceptingContext {
$this->response = $e->getResponse();
}
}
+
+
+ /**
+ * @When Dropping file :path with :content as :nickName
+ */
+ public function droppingFileWithAs($path, $content, $nickName) {
+ $this->droppingFileWith($path, $content, $nickName);
+ }
+
/**
* @When Creating folder :folder in drop
@@ -52,7 +66,7 @@ class FilesDropContext implements Context, SnippetAcceptingContext {
}
$base = substr($this->baseUrl, 0, -4);
- $fullUrl = $base . "/public.php/dav/files/$token/$folder";
+ $fullUrl = str_replace('//', '/', $base . "/public.php/dav/files/$token/$folder");
$options['headers'] = [
'X-REQUESTED-WITH' => 'XMLHttpRequest'
diff --git a/build/integration/filesdrop_features/filesdrop.feature b/build/integration/filesdrop_features/filesdrop.feature
index 211f780fb1c..2c9156dea02 100644
--- a/build/integration/filesdrop_features/filesdrop.feature
+++ b/build/integration/filesdrop_features/filesdrop.feature
@@ -59,3 +59,34 @@ Feature: FilesDrop
| permissions | 4 |
When Creating folder "folder" in drop
Then the HTTP status code should be "405"
+
+ Scenario: Files request drop
+ Given user "user0" exists
+ And As an "user0"
+ And user "user0" created a folder "/drop"
+ And as "user0" creating a share with
+ | path | drop |
+ | shareType | 4 |
+ | permissions | 4 |
+ | attributes | [{"scope":"fileRequest","key":"enabled","value":true}] |
+ | shareWith | |
+ When Dropping file "/folder/a.txt" with "abc" as "Alice"
+ And Downloading file "/drop/Alice/a.txt"
+ Then Downloaded content should be "abc"
+
+ Scenario: Put file same file multiple times via files drop
+ Given user "user0" exists
+ And As an "user0"
+ And user "user0" created a folder "/drop"
+ And as "user0" creating a share with
+ | path | drop |
+ | shareType | 4 |
+ | permissions | 4 |
+ | attributes | [{"scope":"fileRequest","key":"enabled","value":true}] |
+ | shareWith | |
+ When Dropping file "/folder/a.txt" with "abc" as "Mallory"
+ And Dropping file "/folder/a.txt" with "def" as "Mallory"
+ And Downloading file "/drop/Mallory/a.txt"
+ Then Downloaded content should be "abc"
+ And Downloading file "/drop/Mallory/a (2).txt"
+ Then Downloaded content should be "def"