Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only][full-ci] Refactor share related scenerio #6587

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions tests/acceptance/features/bootstrap/Sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -3491,6 +3491,25 @@ public function assertNoSharesOfUserAreInState(string $user, string $state):void
* @throws JsonException
*/
public function userHasUnsharedResourceSharedTo(string $sharer, string $path, string $sharee): void {
$this->userUnsharesSharedTo($sharer, $path, $sharee);
$this->ocsContext->assertOCSResponseIndicatesSuccess(
'The ocs share response does not indicate success.',
);
$this->emptyLastHTTPStatusCodesArray();
$this->emptyLastOCSStatusCodesArray();
}

/**
* @When /^user "([^"]*)" unshares (?:folder|file|entity) "([^"]*)" shared to "([^"]*)"$/
*
* @param string $sharer
* @param string $path
* @param string $sharee
*
* @return void
* @throws JsonException
*/
public function userUnsharesSharedTo(string $sharer, string $path, string $sharee): void {
$sharer = $this->getActualUsername($sharer);
$sharee = $this->getActualUsername($sharee);

Expand All @@ -3512,12 +3531,6 @@ public function userHasUnsharedResourceSharedTo(string $sharer, string $path, st
'DELETE',
'/apps/files_sharing/api/v' . $this->sharingApiVersion . '/shares/' . $shareId
);

$this->ocsContext->assertOCSResponseIndicatesSuccess(
'The ocs share response does not indicate success.',
);
$this->emptyLastHTTPStatusCodesArray();
$this->emptyLastOCSStatusCodesArray();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -3338,7 +3338,7 @@ public function fileHasBeenDeleted(string $file, string $user):void {
}

/**
* @When /^user "([^"]*)" (?:deletes|unshares) (?:file|folder) "([^"]*)" using the WebDAV API$/
* @When /^user "([^"]*)" deletes (?:file|folder) "([^"]*)" using the WebDAV API$/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @When /^user "([^"]*)" deletes (?:file|folder) "([^"]*)" using the WebDAV API$/
* @When user :user deletes file/folder :file using the WebDAV API

*
* @param string $user
* @param string $file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Feature: sharing
And as "Alice" file "/shared_file.txt" should exist in the trashbin
And as "Brian" file "/shared_file.txt" should exist in the trashbin


Scenario: deleting a folder out of a share as recipient creates a backup for the owner
Given using OCS API version "1"
And user "Alice" has created folder "/shared"
Expand Down Expand Up @@ -226,3 +226,15 @@ Feature: sharing
| ocs_api_version | ocs_status_code | http_status_code |
| 1 | 404 | 200 |
| 2 | 404 | 404 |


Scenario: unshare a shared resources
Given using OCS API version "1"
And user "Alice" has shared file "textfile0.txt" with user "Brian"
And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice"
When user "Alice" unshares file "textfile0.txt" shared to "Brian"
Then the OCS status code should be "100"
And the HTTP status code should be "200"
And as "Brian" file "/Shares/shared/textfile0.txt" should not exist


Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ Feature: dav-versions
| new | Brian | /testshare |


Scenario: receiver tries to get file versions of unshared file from the sharer
Scenario: receiver tries to get file versions of file not shared by the sharer
Given user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has uploaded file with content "textfile0" to "textfile0.txt"
And user "Alice" has uploaded file with content "textfile1" to "textfile1.txt"
Expand Down