Skip to content

Commit 8f0f2e7

Browse files
nickvergessenbackportbot[bot]
authored andcommitted
test(integration): Add integration test for accept share
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent 3a1c30b commit 8f0f2e7

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

build/integration/features/bootstrap/Sharing.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,15 @@ public function creatingShare($body) {
9797
$this->asCreatingAShareWith($this->currentUser, $body);
9898
}
9999

100+
/**
101+
* @When /^accepting last share via the accept endpoint$/
102+
*/
103+
public function acceptingLastShareViaAcceptEndpoint(): void {
104+
$share_id = $this->lastShareData->data[0]->id;
105+
$url = "/index.php/apps/files_sharing/accept/ocinternal:$share_id";
106+
$this->sendingToDirectUrl('GET', $url);
107+
}
108+
100109
/**
101110
* @When /^accepting last share$/
102111
*/
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
2+
# SPDX-License-Identifier: AGPL-3.0-or-later
3+
Feature: sharing-accept
4+
Background:
5+
Given using api version "1"
6+
Given using old dav path
7+
8+
Scenario: Accepting a non-existent share
9+
Given user "user0" exists
10+
And As an "user0"
11+
When sending "GET" with exact url to "/index.php/apps/files_sharing/accept/ocinternal:999999"
12+
Then the HTTP status code should be "404"
13+
14+
Scenario: Accepting a share with an invalid share ID
15+
Given user "user0" exists
16+
And As an "user0"
17+
When sending "GET" with exact url to "/index.php/apps/files_sharing/accept/invalid:format"
18+
Then the HTTP status code should be "404"
19+
20+
Scenario: Accepting a valid share
21+
Given user "user0" exists
22+
And user "user1" exists
23+
And As an "user0"
24+
When creating a share with
25+
| path | welcome.txt |
26+
| shareWith | user1 |
27+
| shareType | 0 |
28+
Then the OCS status code should be "100"
29+
And the HTTP status code should be "200"
30+
And As an "user1"
31+
When accepting last share via the accept endpoint
32+
Then the HTTP status code should be "200"
33+
34+
Scenario: Accepting a share as a different user
35+
Given user "user0" exists
36+
And user "user1" exists
37+
And user "user2" exists
38+
And As an "user0"
39+
When creating a share with
40+
| path | welcome.txt |
41+
| shareWith | user1 |
42+
| shareType | 0 |
43+
Then the OCS status code should be "100"
44+
And the HTTP status code should be "200"
45+
And As an "user2"
46+
When accepting last share via the accept endpoint
47+
Then the HTTP status code should be "404"
48+
49+
Scenario: Accepting a share that is not a user share
50+
Given user "user0" exists
51+
And user "user1" exists
52+
And user "user2" exists
53+
And As an "user0"
54+
And User user0 created a folder drop
55+
When creating a share with
56+
| path | drop |
57+
| shareType | 3 |
58+
| publicUpload | true |
59+
Then the OCS status code should be "100"
60+
And the HTTP status code should be "200"
61+
And As an "user2"
62+
When accepting last share via the accept endpoint
63+
Then the HTTP status code should be "404"

0 commit comments

Comments
 (0)