Skip to content

Commit e0cc023

Browse files
Merge pull request #59601 from nextcloud/test/noid/add-integration-test-for-accepting-share
test(integration): Add integration test for accept share
2 parents 6d3ed45 + b8f146a commit e0cc023

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
@@ -88,6 +88,15 @@ public function creatingShare(?TableNode $body): void {
8888
$this->asCreatingAShareWith($this->currentUser, $body);
8989
}
9090

91+
/**
92+
* @When /^accepting last share via the accept endpoint$/
93+
*/
94+
public function acceptingLastShareViaAcceptEndpoint(): void {
95+
$share_id = $this->lastShareData->data[0]->id;
96+
$url = "/index.php/apps/files_sharing/accept/ocinternal:$share_id";
97+
$this->sendingToDirectUrl('GET', $url);
98+
}
99+
91100
/**
92101
* @When /^accepting last share$/
93102
*/
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)