aboutsummaryrefslogtreecommitdiffstats
path: root/build/integration/filesdrop_features/filesdrop.feature
blob: e37a4d7138b983120e2978aa98595c8457a14a2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: AGPL-3.0-or-later
Feature: FilesDrop

  Scenario: Put file 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 | 3 |
      | publicUpload | true |
    And Updating last share with
      | permissions | 4 |
    When Dropping file "/a.txt" with "abc"
    And Downloading file "/drop/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 | 3 |
      | publicUpload | true |
    And Updating last share with
      | permissions | 4 |
    When Dropping file "/a.txt" with "abc"
    And Dropping file "/a.txt" with "def"
    And Downloading file "/drop/a.txt"
    Then Downloaded content should be "abc"
    And Downloading file "/drop/a (2).txt"
    Then Downloaded content should be "def"

  Scenario: Files drop forbid directory without a nickname
    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 | 3 |
      | publicUpload | true |
    And Updating last share with
      | permissions | 4 |
    When Dropping file "/folder/a.txt" with "abc"
    Then the HTTP status code should be "405"

  Scenario: Files drop forbid MKCOL without a nickname
    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 | 3 |
      | publicUpload | true |
    And Updating last share with
      | permissions | 4 |
    When Creating folder "folder" in drop
    Then the HTTP status code should be "405"

  Scenario: Files drop allows MKCOL with a nickname
    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 | 3 |
      | publicUpload | true |
    And Updating last share with
      | permissions | 4 |
    When Creating folder "folder" in drop as "nickname"
    Then the HTTP status code should be "201"

  Scenario: Files drop forbid subfolder creation without a nickname
    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 | 3 |
      | publicUpload | true |
    And Updating last share with
      | permissions | 4 |
    When dropping file "/folder/a.txt" with "abc"
    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/folder/a.txt"
    Then Downloaded content should be "abc"

  Scenario: File drop uploading folder with name of file
    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" with "its a file" as "Alice"
    Then the HTTP status code should be "201"
    When Dropping file "/folder/a.txt" with "abc" as "Alice"
    Then the HTTP status code should be "201"
    When Downloading file "/drop/Alice/folder"
    Then the HTTP status code should be "200"
    And Downloaded content should be "its a file"
    When Downloading file "/drop/Alice/folder (2)/a.txt"
    Then Downloaded content should be "abc"

  Scenario: File drop uploading file with name of folder
    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"
    Then the HTTP status code should be "201"
    When Dropping file "/folder" with "its a file" as "Alice"
    Then the HTTP status code should be "201"
    When Downloading file "/drop/Alice/folder/a.txt"
    Then the HTTP status code should be "200"
    And Downloaded content should be "abc"
    When Downloading file "/drop/Alice/folder (2)"
    Then the HTTP status code should be "200"
    And Downloaded content should be "its a file"
    
  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"
    # Ensure folder structure and that we only checked
    # for files duplicates, but merged the existing folders
    Then as "user0" the folder "/drop/Mallory" exists
    Then as "user0" the folder "/drop/Mallory/folder" exists
    Then as "user0" the folder "/drop/Mallory (2)" does not exist
    Then as "user0" the folder "/drop/Mallory/folder (2)" does not exist
    Then as "user0" the file "/drop/Mallory/folder/a.txt" exists
    Then as "user0" the file "/drop/Mallory/folder/a (2).txt" exists
    And Downloading file "/drop/Mallory/folder/a.txt"
    Then Downloaded content should be "abc"
    And Downloading file "/drop/Mallory/folder/a (2).txt"
    Then Downloaded content should be "def"

  Scenario: Files drop prevents GET
    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 |
      | shareWith |  |
      | attributes | [{"scope":"fileRequest","key":"enabled","value":true}] |
    When Dropping file "/folder/a.txt" with "abc" as "Mallory"
    When as "user0" the file "/drop/Mallory/folder/a.txt" exists
    And Downloading public folder "Mallory"
    Then the HTTP status code should be "405"
    And Downloading public folder "Mallory/folder"
    Then the HTTP status code should be "405"
    And Downloading public file "Mallory/folder/a.txt"
    Then the HTTP status code should be "405"

  Scenario: Files drop requires nickname if file request is enabled
    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"
    Then the HTTP status code should be "405"