mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
test(integration): Add integration test for accept share
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
3a1c30b402
commit
8f0f2e7fec
2 changed files with 72 additions and 0 deletions
|
|
@ -97,6 +97,15 @@ trait Sharing {
|
|||
$this->asCreatingAShareWith($this->currentUser, $body);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^accepting last share via the accept endpoint$/
|
||||
*/
|
||||
public function acceptingLastShareViaAcceptEndpoint(): void {
|
||||
$share_id = $this->lastShareData->data[0]->id;
|
||||
$url = "/index.php/apps/files_sharing/accept/ocinternal:$share_id";
|
||||
$this->sendingToDirectUrl('GET', $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @When /^accepting last share$/
|
||||
*/
|
||||
|
|
|
|||
63
build/integration/sharing_features/sharing-accept.feature
Normal file
63
build/integration/sharing_features/sharing-accept.feature
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
# SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
Feature: sharing-accept
|
||||
Background:
|
||||
Given using api version "1"
|
||||
Given using old dav path
|
||||
|
||||
Scenario: Accepting a non-existent share
|
||||
Given user "user0" exists
|
||||
And As an "user0"
|
||||
When sending "GET" with exact url to "/index.php/apps/files_sharing/accept/ocinternal:999999"
|
||||
Then the HTTP status code should be "404"
|
||||
|
||||
Scenario: Accepting a share with an invalid share ID
|
||||
Given user "user0" exists
|
||||
And As an "user0"
|
||||
When sending "GET" with exact url to "/index.php/apps/files_sharing/accept/invalid:format"
|
||||
Then the HTTP status code should be "404"
|
||||
|
||||
Scenario: Accepting a valid share
|
||||
Given user "user0" exists
|
||||
And user "user1" exists
|
||||
And As an "user0"
|
||||
When creating a share with
|
||||
| path | welcome.txt |
|
||||
| shareWith | user1 |
|
||||
| shareType | 0 |
|
||||
Then the OCS status code should be "100"
|
||||
And the HTTP status code should be "200"
|
||||
And As an "user1"
|
||||
When accepting last share via the accept endpoint
|
||||
Then the HTTP status code should be "200"
|
||||
|
||||
Scenario: Accepting a share as a different user
|
||||
Given user "user0" exists
|
||||
And user "user1" exists
|
||||
And user "user2" exists
|
||||
And As an "user0"
|
||||
When creating a share with
|
||||
| path | welcome.txt |
|
||||
| shareWith | user1 |
|
||||
| shareType | 0 |
|
||||
Then the OCS status code should be "100"
|
||||
And the HTTP status code should be "200"
|
||||
And As an "user2"
|
||||
When accepting last share via the accept endpoint
|
||||
Then the HTTP status code should be "404"
|
||||
|
||||
Scenario: Accepting a share that is not a user share
|
||||
Given user "user0" exists
|
||||
And user "user1" exists
|
||||
And user "user2" exists
|
||||
And As an "user0"
|
||||
And User user0 created a folder drop
|
||||
When creating a share with
|
||||
| path | drop |
|
||||
| shareType | 3 |
|
||||
| publicUpload | true |
|
||||
Then the OCS status code should be "100"
|
||||
And the HTTP status code should be "200"
|
||||
And As an "user2"
|
||||
When accepting last share via the accept endpoint
|
||||
Then the HTTP status code should be "404"
|
||||
Loading…
Reference in a new issue