-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy pathtrashbinRestore.feature
450 lines (418 loc) · 22.6 KB
/
trashbinRestore.feature
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
@api @files_trashbin-app-required @issue-ocis-reva-52
Feature: Restore deleted files/folders
As a user
I would like to restore files/folders
So that I can recover accidentally deleted files/folders in ownCloud
Background:
Given user "Alice" has been created with default attributes and without skeleton files
And user "Alice" has uploaded file with content "file to delete" to "/textfile0.txt"
@smokeTest
Scenario Outline: A deleted file can be restored
Given using <dav-path> DAV path
And user "Alice" has created folder "/FOLDER"
And user "Alice" has created folder "/PARENT"
And user "Alice" has uploaded file with content "parent text" to "/PARENT/parent.txt"
And user "Alice" has uploaded file with content "text file 1" to "/textfile1.txt"
And user "Alice" has deleted file "/textfile0.txt"
And as "Alice" file "/textfile0.txt" should exist in the trashbin
When user "Alice" restores the file with original path "/textfile0.txt" using the trashbin API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions for user "Alice"
| ETag | /^"[a-f0-9:\.]{1,32}"$/ |
And as "Alice" the file with original path "/textfile0.txt" should not exist in the trashbin
And the content of file "/textfile0.txt" for user "Alice" should be "file to delete"
And user "Alice" should see the following elements
| /FOLDER/ |
| /PARENT/ |
| /PARENT/parent.txt |
| /textfile0.txt |
| /textfile1.txt |
Examples:
| dav-path |
| old |
| new |
Scenario Outline: A file deleted from a folder can be restored to the original folder
Given using <dav-path> DAV path
And user "Alice" has created folder "/new-folder"
And user "Alice" has moved file "/textfile0.txt" to "/new-folder/new-file.txt"
And user "Alice" has deleted file "/new-folder/new-file.txt"
When user "Alice" restores the file with original path "/new-folder/new-file.txt" using the trashbin API
Then the HTTP status code should be "201"
And as "Alice" the file with original path "/new-folder/new-file.txt" should not exist in the trashbin
And as "Alice" file "/new-folder/new-file.txt" should exist
And the content of file "/new-folder/new-file.txt" for user "Alice" should be "file to delete"
Examples:
| dav-path |
| old |
| new |
Scenario Outline: A file deleted from a folder is restored to the original folder if the original folder was deleted and restored
Given using <dav-path> DAV path
And user "Alice" has created folder "/new-folder"
And user "Alice" has moved file "/textfile0.txt" to "/new-folder/new-file.txt"
And user "Alice" has deleted file "/new-folder/new-file.txt"
And user "Alice" has deleted folder "/new-folder"
When user "Alice" restores the folder with original path "/new-folder" using the trashbin API
And user "Alice" restores the file with original path "/new-folder/new-file.txt" using the trashbin API
Then the HTTP status code should be "201"
And as "Alice" the file with original path "/new-folder/new-file.txt" should not exist in the trashbin
And as "Alice" file "/new-folder/new-file.txt" should exist
And the content of file "/new-folder/new-file.txt" for user "Alice" should be "file to delete"
Examples:
| dav-path |
| old |
| new |
@skipOnFilesClassifier @issue-files-classifier-291
Scenario Outline: a file is deleted and restored to a new destination
Given using <dav-path> DAV path
And user "Alice" has created folder "/PARENT"
And user "Alice" has created folder "/PARENT/CHILD"
And user "Alice" has uploaded file with content "to delete" to "<delete-path>"
And user "Alice" has deleted file "<delete-path>"
When user "Alice" restores the file with original path "<delete-path>" to "<restore-path>" using the trashbin API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions for user "Alice"
| ETag | /^"[a-f0-9:\.]{1,32}"$/ |
And as "Alice" the file with original path "<delete-path>" should not exist in the trashbin
And as "Alice" file "<restore-path>" should exist
And as "Alice" file "<delete-path>" should not exist
And the content of file "<restore-path>" for user "Alice" should be "to delete"
Examples:
| dav-path | delete-path | restore-path |
| old | /PARENT/parent.txt | parent.txt |
| new | /PARENT/parent.txt | parent.txt |
| old | /PARENT/CHILD/child.txt | child.txt |
| new | /PARENT/CHILD/child.txt | child.txt |
| old | /textfile0.txt | PARENT/textfile0.txt |
| new | /textfile0.txt | PARENT/textfile0.txt |
@skipOnOcV10 @issue-35974
Scenario Outline: restoring a file to an already existing path overrides the file
Given user "Alice" has uploaded file with content "file to delete" to "/.hiddenfile0.txt"
And using <dav-path> DAV path
And user "Alice" has created folder "/PARENT"
And user "Alice" has uploaded file with content "PARENT file content" to <upload-path>
And user "Alice" has deleted file <delete-path>
When user "Alice" restores the file with original path <delete-path> to <upload-path> using the trashbin API
Then the HTTP status code should be "204"
# Sometimes <upload-path> is found in the trashbin. Should it? Or not?
# That seems to be what happens when the restore-overwrite happens properly,
# The original <upload-path> seems to be "deleted" and so goes to the trashbin
And as "Alice" the file with original path <upload-path> should not exist in the trashbin
And as "Alice" file <upload-path> should exist
# sometimes the restore from trashbin does overwrite the existing file, but sometimes it does not. That is also surprising.
# the current observed behavior is that if the original <upload-path> ended up in the trashbin,
# then the new <upload-path> has the "file to delete" content.
# otherwise <upload-path> has its old content
And the content of file <upload-path> for user "Alice" should be "file to delete"
Examples:
| dav-path | upload-path | delete-path |
| old | "/PARENT/textfile0.txt" | "/textfile0.txt" |
| new | "/PARENT/textfile0.txt" | "/textfile0.txt" |
| old | "/PARENT/.hiddenfile0.txt" | ".hiddenfile0.txt" |
| new | "/PARENT/.hiddenfile0.txt" | ".hiddenfile0.txt" |
Scenario Outline: A file deleted from a folder is restored to the original folder if the original folder was deleted and recreated
Given using <dav-path> DAV path
And user "Alice" has created folder "/new-folder"
And user "Alice" has moved file "/textfile0.txt" to "/new-folder/new-file.txt"
And user "Alice" has deleted file "/new-folder/new-file.txt"
And user "Alice" has deleted folder "/new-folder"
When user "Alice" creates folder "/new-folder" using the WebDAV API
And user "Alice" restores the file with original path "/new-folder/new-file.txt" using the trashbin API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions for user "Alice"
| ETag | /^"[a-f0-9:\.]{1,32}"$/ |
And as "Alice" the file with original path "/new-folder/new-file.txt" should not exist in the trashbin
And as "Alice" file "/new-folder/new-file.txt" should exist
And the content of file "/new-folder/new-file.txt" for user "Alice" should be "file to delete"
Examples:
| dav-path |
| old |
| new |
@local_storage
@skipOnEncryptionType:user-keys @encryption-issue-42
@skip_on_objectstore
Scenario Outline: Deleting a file into external storage moves it to the trashbin and can be restored
Given using <dav-path> DAV path
And the administrator has invoked occ command "files:scan --all"
And user "Alice" has created folder "/local_storage/tmp"
And user "Alice" has moved file "/textfile0.txt" to "/local_storage/tmp/textfile0.txt"
And user "Alice" has deleted file "/local_storage/tmp/textfile0.txt"
And as "Alice" the folder with original path "/local_storage/tmp/textfile0.txt" should exist in the trashbin
When user "Alice" restores the folder with original path "/local_storage/tmp/textfile0.txt" using the trashbin API
Then the HTTP status code should be "201"
And the following headers should match these regular expressions for user "Alice"
| ETag | /^"[a-f0-9:\.]{1,32}"$/ |
And as "Alice" the folder with original path "/local_storage/tmp/textfile0.txt" should not exist in the trashbin
And the content of file "/local_storage/tmp/textfile0.txt" for user "Alice" should be "file to delete"
And user "Alice" should see the following elements
| /local_storage/ |
| /local_storage/tmp/ |
| /local_storage/tmp/textfile0.txt |
Examples:
| dav-path |
| old |
| new |
@local_storage
@skipOnEncryptionType:user-keys @encryption-issue-42
@skip_on_objectstore
Scenario: Deleting an updated file into external storage moves it to the trashbin and can be restored
Given using old DAV path
And the administrator has invoked occ command "files:scan --all"
And user "Alice" has created folder "/local_storage/tmp"
And user "Alice" has moved file "/textfile0.txt" to "/local_storage/tmp/textfile0.txt"
And user "Alice" has uploaded chunk file "1" of "1" with "AA" to "/local_storage/tmp/textfile0.txt"
And user "Alice" has deleted file "/local_storage/tmp/textfile0.txt"
And as "Alice" the folder with original path "/local_storage/tmp/textfile0.txt" should exist in the trashbin
When user "Alice" restores the folder with original path "/local_storage/tmp/textfile0.txt" using the trashbin API
Then the HTTP status code should be "201"
And as "Alice" the folder with original path "/local_storage/tmp/textfile0.txt" should not exist in the trashbin
And the downloaded content when downloading file "/local_storage/tmp/textfile0.txt" for user "Alice" with range "bytes=0-1" should be "AA"
@local_storage
@skipOnEncryptionType:user-keys @encryption-issue-42
@skip_on_objectstore
Scenario: Deleting an updated file into external storage moves it to the trashbin and can be restored with new chunking
Given using new DAV path
And the administrator has invoked occ command "files:scan --all"
And user "Alice" has created folder "/local_storage/tmp"
And user "Alice" has moved file "/textfile0.txt" to "/local_storage/tmp/textfile0.txt"
And user "Alice" has uploaded the following chunks to "/local_storage/tmp/textfile0.txt" with new chunking
| number | content |
| 1 | AA |
And user "Alice" has deleted file "/local_storage/tmp/textfile0.txt"
And as "Alice" the folder with original path "/local_storage/tmp/textfile0.txt" should exist in the trashbin
When user "Alice" restores the folder with original path "/local_storage/tmp/textfile0.txt" using the trashbin API
Then the HTTP status code should be "201"
And as "Alice" the folder with original path "/local_storage/tmp/textfile0.txt" should not exist in the trashbin
And the downloaded content when downloading file "/local_storage/tmp/textfile0.txt" for user "Alice" with range "bytes=0-1" should be "AA"
@smokeTest @skipOnOcV10.3
Scenario Outline: A deleted file cannot be restored by a different user
Given using <dav-path> DAV path
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has deleted file "/textfile0.txt"
When user "Brian" tries to restore the file with original path "/textfile0.txt" from the trashbin of user "Alice" using the trashbin API
Then the HTTP status code should be "401"
And as "Alice" the folder with original path "/textfile0.txt" should exist in the trashbin
And user "Alice" should not see the following elements
| /textfile0.txt |
Examples:
| dav-path |
| old |
| new |
@smokeTest
Scenario Outline: A deleted file cannot be restored with invalid password
Given using <dav-path> DAV path
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has deleted file "/textfile0.txt"
When user "Alice" tries to restore the file with original path "/textfile0.txt" from the trashbin of user "Alice" using the password "invalid" and the trashbin API
Then the HTTP status code should be "401"
And as "Alice" the folder with original path "/textfile0.txt" should exist in the trashbin
And user "Alice" should not see the following elements
| /textfile0.txt |
Examples:
| dav-path |
| old |
| new |
@smokeTest
Scenario Outline: A deleted file cannot be restored without using a password
Given using <dav-path> DAV path
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has deleted file "/textfile0.txt"
When user "Alice" tries to restore the file with original path "/textfile0.txt" from the trashbin of user "Alice" using the password "" and the trashbin API
Then the HTTP status code should be "401"
And as "Alice" the folder with original path "/textfile0.txt" should exist in the trashbin
And user "Alice" should not see the following elements
| /textfile0.txt |
Examples:
| dav-path |
| old |
| new |
Scenario Outline: Files with strange names can be restored
Given using <dav-path> DAV path
And user "Alice" has uploaded file with content "file original content" to "<file-to-upload>"
And user "Alice" has deleted file "<file-to-upload>"
And user "Alice" restores the file with original path "<file-to-upload>" using the trashbin API
Then the HTTP status code should be "201"
And as "Alice" the file with original path "<file-to-upload>" should not exist in the trashbin
And as "Alice" file "<file-to-upload>" should exist
And the content of file "<file-to-upload>" for user "Alice" should be "file original content"
Examples:
| dav-path | file-to-upload |
| old | 😛 😜 🐱 🐭 ⌚️ ♀️ 🚴♂️ |
| new | 😛 😜 🐱 🐭 ⌚️ ♀️ 🚴♂️ |
| old | strängé नेपाली file |
| new | strängé नेपाली file |
| old | sample,1.txt |
| new | sample,1.txt |
Scenario Outline: A file deleted from a multi level sub-folder can be restored to the original folder
Given using <dav-path> DAV path
And user "Alice" has created folder "/new-folder"
And user "Alice" has created folder "/new-folder/folder1/"
And user "Alice" has created folder "/new-folder/folder1/folder2/"
And user "Alice" has moved file "/textfile0.txt" to "/new-folder/folder1/folder2/new-file.txt"
And user "Alice" has deleted file "/new-folder/folder1/folder2/new-file.txt"
When user "Alice" restores the file with original path "/new-folder/folder1/folder2/new-file.txt" using the trashbin API
Then the HTTP status code should be "201"
And as "Alice" the file with original path "/new-folder/folder1/folder2/new-file.txt" should not exist in the trashbin
And as "Alice" file "/new-folder/folder1/folder2/new-file.txt" should exist
And the content of file "/new-folder/folder1/folder2/new-file.txt" for user "Alice" should be "file to delete"
Examples:
| dav-path |
| old |
| new |
Scenario Outline: A deleted multi level folder can be restored including the content
Given using <dav-path> DAV path
And user "Alice" has created folder "/new-folder"
And user "Alice" has created folder "/new-folder/folder1/"
And user "Alice" has created folder "/new-folder/folder1/folder2/"
And user "Alice" has moved file "/textfile0.txt" to "/new-folder/folder1/folder2/new-file.txt"
And user "Alice" has deleted folder "/new-folder/"
When user "Alice" restores the folder with original path "/new-folder/" using the trashbin API
Then the HTTP status code should be "201"
And as "Alice" the file with original path "/new-folder/folder1/folder2/new-file.txt" should not exist in the trashbin
And as "Alice" file "/new-folder/folder1/folder2/new-file.txt" should exist
And the content of file "/new-folder/folder1/folder2/new-file.txt" for user "Alice" should be "file to delete"
Examples:
| dav-path |
| old |
| new |
Scenario Outline: A subfolder from a deleted multi level folder can be restored including the content
Given using <dav-path> DAV path
And user "Alice" has created folder "/new-folder"
And user "Alice" has created folder "/new-folder/folder1/"
And user "Alice" has created folder "/new-folder/folder1/folder2/"
And user "Alice" has moved file "/textfile0.txt" to "/new-folder/folder1/folder2/new-file.txt"
And user "Alice" has deleted folder "/new-folder/"
When user "Alice" restores the folder with original path "/new-folder/folder1" to "/folder1" using the trashbin API
Then the HTTP status code should be "201"
And as "Alice" the file with original path "/new-folder/folder1/folder2/new-file.txt" should not exist in the trashbin
And as "Alice" the folder with original path "/new-folder/folder1/" should not exist in the trashbin
And as "Alice" file "/folder1/folder2/new-file.txt" should exist
And the content of file "/folder1/folder2/new-file.txt" for user "Alice" should be "file to delete"
But as "Alice" the folder with original path "/new-folder/" should exist in the trashbin
Examples:
| dav-path |
| old |
| new |
Scenario Outline: A file from a deleted multi level sub-folder can be restored
Given using <dav-path> DAV path
And user "Alice" has created folder "/new-folder"
And user "Alice" has created folder "/new-folder/folder1/"
And user "Alice" has created folder "/new-folder/folder1/folder2/"
And user "Alice" has moved file "/textfile0.txt" to "/new-folder/folder1/folder2/new-file.txt"
And user "Alice" has uploaded file with content "to delete" to "/new-folder/folder1/folder2/not-restored.txt"
And user "Alice" has deleted folder "/new-folder/"
When user "Alice" restores the file with original path "/new-folder/folder1/folder2/new-file.txt" to "new-file.txt" using the trashbin API
Then the HTTP status code should be "201"
And as "Alice" the file with original path "/new-folder/folder1/folder2/new-file.txt" should not exist in the trashbin
And as "Alice" file "/new-file.txt" should exist
And the content of file "/new-file.txt" for user "Alice" should be "file to delete"
But as "Alice" the file with original path "/new-folder/folder1/folder2/not-restored.txt" should exist in the trashbin
Examples:
| dav-path |
| old |
| new |
Scenario Outline: A deleted hidden file can be restored
Given using <dav-path> DAV path
And user "Alice" has created folder "/FOLDER"
And user "Alice" has uploaded the following files with content "hidden file"
| path |
| .hidden_file |
| /FOLDER/.hidden_file |
And user "Alice" has deleted the following files
| path |
| .hidden_file |
| /FOLDER/.hidden_file |
When user "Alice" restores the following files with original path
| path |
| .hidden_file |
| /FOLDER/.hidden_file |
Then the HTTP status code of responses on all endpoints should be "201"
And as "Alice" the files with following original paths should not exist in the trashbin
| path |
| .hidden_file |
| /FOLDER/.hidden_file |
And as "Alice" the following files should exist
| path |
| .hidden_file |
| /FOLDER/.hidden_file |
And the content of the following files for user "Alice" should be "hidden file"
| path |
| .hidden_file |
| /FOLDER/.hidden_file |
Examples:
| dav-path |
| old |
| new |
Scenario Outline: restoring files with special characters
Given using <dav-path> DAV path
And user "Alice" has uploaded the following files with content "special character file"
| path |
| qa&dev.txt |
| !@tester$^.txt |
| %file *?2.txt |
| # %ab ab?=ed.txt |
And user "Alice" has deleted the following files
| path |
| qa&dev.txt |
| !@tester$^.txt |
| %file *?2.txt |
| # %ab ab?=ed.txt |
When user "Alice" restores the following files with original path
| path |
| qa&dev.txt |
| !@tester$^.txt |
| %file *?2.txt |
| # %ab ab?=ed.txt |
Then the HTTP status code of responses on all endpoints should be "201"
And as "Alice" the files with following original paths should not exist in the trashbin
| path |
| qa&dev.txt |
| !@tester$^.txt |
| %file *?2.txt |
| # %ab ab?=ed.txt |
But as "Alice" the following files should exist
| path |
| qa&dev.txt |
| !@tester$^.txt |
| %file *?2.txt |
| # %ab ab?=ed.txt |
Examples:
| dav-path |
| old |
| new |
Scenario Outline: restoring folders with special characters
Given using <dav-path> DAV path
And user "Alice" has created the following folders
| path |
| qa&dev |
| !@tester$^ |
| %file *?2 |
| # %ab ab?=ed |
And user "Alice" has deleted the following folders
| path |
| qa&dev |
| !@tester$^ |
| %file *?2 |
| # %ab ab?=ed |
When user "Alice" restores the following folders with original path
| path |
| qa&dev |
| !@tester$^ |
| %file *?2 |
| # %ab ab?=ed |
Then the HTTP status code of responses on all endpoints should be "201"
And as "Alice" the folders with following original paths should not exist in the trashbin
| path |
| qa&dev |
| !@tester$^ |
| %file *?2 |
| # %ab ab?=ed |
But as "Alice" the following folders should exist
| path |
| qa&dev |
| !@tester$^ |
| %file *?2 |
| # %ab ab?=ed |
Examples:
| dav-path |
| old |
| new |