aboutsummaryrefslogtreecommitdiffstats
path: root/build/integration/federation_features/federated.feature
blob: 81a3d3abd02c07b68377bbba5d8b6c66ee4d7674 (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
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
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
# SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-FileCopyrightText: 2015-2016 ownCloud, Inc.
# SPDX-License-Identifier: AGPL-3.0-only
Feature: federated
	Background:
		Given using api version "1"

	Scenario: Federate share a file with another server
		Given Using server "REMOTE"
		And user "user1" exists
		And Using server "LOCAL"
		And user "user0" exists
		When User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
		Then the OCS status code should be "100"
		And the HTTP status code should be "200"
		And Share fields of last share match with
			| id | A_NUMBER |
			| item_type | file |
			| item_source | A_NUMBER |
			| share_type | 6 |
			| file_source | A_NUMBER |
			| path | /textfile0.txt |
			| permissions | 19 |
			| stime | A_NUMBER |
			| storage | A_NUMBER |
			| mail_send | 0 |
			| uid_owner | user0 |
			| storage_id | home::user0 |
			| file_parent | A_NUMBER |
			| displayname_owner | user0 |
			| share_with | user1@REMOTE |
			| share_with_displayname | user1 |

	Scenario: Federated group share a file with another server
		Given Using server "REMOTE"
		And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
		And user "gs-user1" exists
		And user "gs-user2" exists
		And group "group1" exists
		And As an "admin"
		And Add user "gs-user1" to the group "group1"
		And Add user "gs-user2" to the group "group1"
		And Using server "LOCAL"
		And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
		And user "gs-user0" exists
		When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE"
		Then the OCS status code should be "100"
		And the HTTP status code should be "200"
		And Share fields of last share match with
			| id | A_NUMBER |
			| item_type | file |
			| item_source | A_NUMBER |
			| share_type | 9 |
			| file_source | A_NUMBER |
			| path | /textfile0.txt |
			| permissions | 19 |
			| stime | A_NUMBER |
			| storage | A_NUMBER |
			| mail_send | 0 |
			| uid_owner | gs-user0 |
			| storage_id | home::gs-user0 |
			| file_parent | A_NUMBER |
			| displayname_owner | gs-user0 |
			| share_with | group1@REMOTE |
			| share_with_displayname | group1@REMOTE |


	Scenario: Federate share a file with local server
		Given Using server "LOCAL"
		And user "user0" exists
		And Using server "REMOTE"
		And user "user1" exists
		When User "user1" from server "REMOTE" shares "/textfile0.txt" with user "user0" from server "LOCAL"
		Then the OCS status code should be "100"
		And the HTTP status code should be "200"
		And Share fields of last share match with
			| id | A_NUMBER |
			| item_type | file |
			| item_source | A_NUMBER |
			| share_type | 6 |
			| file_source | A_NUMBER |
			| path | /textfile0.txt |
			| permissions | 19 |
			| stime | A_NUMBER |
			| storage | A_NUMBER |
			| mail_send | 0 |
			| uid_owner | user1 |
			| storage_id | home::user1 |
			| file_parent | A_NUMBER |
			| displayname_owner | user1 |
			| share_with | user0@LOCAL |
			| share_with_displayname | user0 |

	Scenario: Remote sharee can see the pending share
		Given Using server "REMOTE"
		And user "user1" exists
		And Using server "LOCAL"
		And user "user0" exists
		And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
		And Using server "REMOTE"
		And As an "user1"
		When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
		Then the OCS status code should be "100"
		And the HTTP status code should be "200"
		And Share fields of last share match with
			| id | A_NUMBER |
			| remote | LOCAL |
			| remote_id | A_NUMBER |
			| share_token | A_TOKEN |
			| name | /textfile0.txt |
			| owner | user0 |
			| user | user1 |
			| mountpoint | {{TemporaryMountPointName#/textfile0.txt}} |
			| accepted | 0 |

	Scenario: Remote sharee can see the pending group share
		Given Using server "REMOTE"
		And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
		And user "gs-user1" exists
		And user "gs-user2" exists
		And group "group1" exists
		And As an "admin"
		And Add user "gs-user1" to the group "group1"
		And Add user "gs-user2" to the group "group1"
		And Using server "LOCAL"
		And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
		And user "gs-user0" exists
		When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE"
		And Using server "REMOTE"
		And As an "gs-user1"
		When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
		Then the OCS status code should be "100"
		And the HTTP status code should be "200"
		And Share fields of last share match with
			| id | A_NUMBER |
			| remote | LOCAL |
			| remote_id | A_NUMBER |
			| share_token | A_TOKEN |
			| name | /textfile0.txt |
			| owner | gs-user0 |
			| user | group1 |
			| mountpoint | {{TemporaryMountPointName#/textfile0.txt}} |
			| accepted | 0 |
		And As an "gs-user2"
		When sending "GET" to "/apps/files_sharing/api/v1/remote_shares/pending"
		Then the OCS status code should be "100"
		And the HTTP status code should be "200"
		And Share fields of last share match with
			| id | A_NUMBER |
			| remote | LOCAL |
			| remote_id | A_NUMBER |
			| share_token | A_TOKEN |
			| name | /textfile0.txt |
			| owner | gs-user0 |
			| user | group1 |
			| mountpoint | {{TemporaryMountPointName#/textfile0.txt}} |
			| accepted | 0 |

	Scenario: accept a pending remote share
		Given Using server "REMOTE"
		And user "user1" exists
		And Using server "LOCAL"
		And user "user0" exists
		And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
		When User "user1" from server "REMOTE" accepts last pending share
		Then the OCS status code should be "100"
		And the HTTP status code should be "200"

	Scenario: accept a pending remote group share
		Given Using server "REMOTE"
		And parameter "incoming_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
		And user "gs-user1" exists
		And user "gs-user2" exists
		And group "group1" exists
		And As an "admin"
		And Add user "gs-user1" to the group "group1"
		And Add user "gs-user2" to the group "group1"
		And Using server "LOCAL"
		And parameter "outgoing_server2server_group_share_enabled" of app "files_sharing" is set to "yes"
		And user "gs-user0" exists
		When User "gs-user0" from server "LOCAL" shares "/textfile0.txt" with group "group1" from server "REMOTE"
		When User "gs-user1" from server "REMOTE" accepts last pending share
		Then the OCS status code should be "100"
		And the HTTP status code should be "200"

	Scenario: Reshare a federated shared file
		Given Using server "REMOTE"
		And user "user1" exists
		And user "user2" exists
		And Using server "LOCAL"
		And user "user0" exists
		And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
		And User "user1" from server "REMOTE" accepts last pending share
		And Using server "REMOTE"
		And As an "user1"
		When creating a share with
			| path | /textfile0 (2).txt |
			| shareType | 0 |
			| shareWith | user2 |
			| permissions | 19 |
		#Then the OCS status code should be "100"
		#And the HTTP status code should be "200"
		#And Share fields of last share match with
		#	| id | A_NUMBER |
		#	| item_type | file |
		#	| item_source | A_NUMBER |
		#	| share_type | 0 |
		#	| file_source | A_NUMBER |
		#	| path | /textfile0 (2).txt |
		#	| permissions | 19 |
		#	| stime | A_NUMBER |
		#	| storage | A_NUMBER |
		#	| mail_send | 1 |
		#	| uid_owner | user1 |
		#	| file_parent | A_NUMBER |
		#	| displayname_owner | user1 |
		#	| share_with | user2 |
		#	| share_with_displayname | user2 |

	Scenario: Overwrite a federated shared file as recipient
		Given Using server "REMOTE"
		And user "user1" exists
		And user "user2" exists
		And Using server "LOCAL"
		And user "user0" exists
		And User "user0" from server "LOCAL" shares "/textfile0.txt" with user "user1" from server "REMOTE"
		And User "user1" from server "REMOTE" accepts last pending share
		And Using server "REMOTE"
		And As an "user1"
		And User "user1" modifies text of "/textfile0.txt" with text "BLABLABLA"
		When User "user1" uploads file "../../data/user1/files/textfile0.txt" to "/textfile0 (2).txt"
		And Downloading file "/textfile0 (2).txt" with range "bytes=0-8"
		Then Downloaded content should be "BLABLABLA"

	Scenario: Overwrite a federated shared folder as recipient
		Given Using server "REMOTE"
		And user "user1" exists
		And user "user2" exists
		And Using server "LOCAL"
		And user "user0" exists
		And User "user0" from server "LOCAL" shares "/PARENT" with user "user1" from server "REMOTE"
		And User "user1" from server "REMOTE" accepts last pending share
		And Using server "REMOTE"
		And As an "user1"
		And User "user1" modifies text of "/textfile0.txt" with text "BLABLABLA"
		#When User "user1" uploads file "../../data/user1/files/textfile0.txt" to "/PARENT (2)/textfile0.txt"
		#And Downloading file "/PARENT (2)/textfile0.txt" with range "bytes=0-8"
		#Then Downloaded content should be "BLABLABLA"

	Scenario: List federated share from another server not accepted yet
		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 Using server "LOCAL"
		When As an "user0"
		And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
		Then the list of returned shares has 0 shares

	Scenario: List 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 Using server "LOCAL"
		And User "user0" from server "LOCAL" accepts last pending share
		When As an "user0"
		And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
		Then the list of returned shares has 1 shares
		And remote share 0 is returned with
			| remote      | http://localhost:8180/ |
			| name        | /remote-share.txt |
			| owner       | user1 |
			| user        | user0 |
			| mountpoint  | /remote-share.txt |
			| mimetype    | text/plain |
			| mtime        | A_NUMBER |
			| permissions | 27 |
			| type        | file |
			| file_id     | A_NUMBER |

	Scenario: List federated share from another server no longer reachable
		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 Using server "LOCAL"
		And User "user0" from server "LOCAL" accepts last pending share
		And remote server is stopped
		When As an "user0"
		And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
		Then the list of returned shares has 1 shares
		And remote share 0 is returned with
			| remote      | http://localhost:8180/ |
			| name        | /remote-share.txt |
			| owner       | user1 |
			| user        | user0 |
			| mountpoint  | /remote-share.txt |

	Scenario: List federated share from another server no longer reachable after caching the file entry
		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 Using server "LOCAL"
		And User "user0" from server "LOCAL" accepts last pending share
		# Checking that the file exists caches the file entry, which causes an
		# exception to be thrown when getting the file info if the remote server is
		# unreachable.
		And as "user0" the file "/remote-share.txt" exists
		And remote server is stopped
		When As an "user0"
		And sending "GET" to "/apps/files_sharing/api/v1/remote_shares"
		Then the list of returned shares has 1 shares
		And remote share 0 is returned with
			| remote      | http://localhost:8180/ |
			| name        | /remote-share.txt |
			| owner       | user1 |
			| user        | user0 |
			| mountpoint  | /remote-share.txt |



	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 from another server no longer reachable
		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 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 remote server is stopped
		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

	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

	Scenario: Delete federated share file from another server no longer reachable
		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 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 remote server is stopped
		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