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] Improve then steps for suite 'apiFederationToShares1' #40020

Merged
merged 2 commits into from
Apr 28, 2022
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ Feature: propagation of etags between federated and local server
And user "Alice" has stored etag of element "/Shares/PARENT"
And using server "LOCAL"
When user "Brian" uploads file "filesForUpload/file_to_overwrite.txt" to "/PARENT/textfile0.txt" using the WebDAV API
Then the etag of element "/Shares/PARENT" of user "Alice" on server "REMOTE" should have changed
Then the HTTP status code should be "201"
And the etag of element "/Shares/PARENT" of user "Alice" on server "REMOTE" should have changed

@issue-enterprise-2848
Scenario: Overwrite a federated shared folder as sharer propagates etag to root folder for recipient
Expand Down
28 changes: 16 additions & 12 deletions tests/acceptance/features/apiFederationToShares1/federated.feature
Original file line number Diff line number Diff line change
Expand Up @@ -543,16 +543,18 @@ Feature: federated
And user "Brian" has created folder "/zzzfolder"
And user "Brian" has created folder "zzzfolder/local"
And user "Brian" has uploaded file with content "local content" to "/randomfile.txt"
When user "Alice" from server "REMOTE" shares "zzzfolder" with user "Carol" from server "LOCAL" using the sharing API
And user "Alice" from server "REMOTE" has shared "zzzfolder" with user "Carol" from server "LOCAL"
And user "Alice" from server "REMOTE" has shared "randomfile.txt" with user "Carol" from server "LOCAL"
And user "Brian" has shared folder "zzzfolder" with user "Carol"
And user "Brian" has shared folder "randomfile.txt" with user "Carol"
When user "Carol" from server "LOCAL" accepts the last pending share using the sharing API
And user "Carol" from server "LOCAL" accepts the last pending share using the sharing API
And user "Alice" from server "REMOTE" shares "randomfile.txt" with user "Carol" from server "LOCAL" using the sharing API
And user "Carol" from server "LOCAL" accepts the last pending share using the sharing API
And user "Brian" shares folder "zzzfolder" with user "Carol" using the sharing API
And user "Carol" accepts share "/zzzfolder" offered by user "Brian" using the sharing API
And user "Brian" shares folder "randomfile.txt" with user "Carol" using the sharing API
And user "Carol" accepts share "/randomfile.txt" offered by user "Brian" using the sharing API
Then the HTTP status code of responses on all endpoints should be "200"
And the OCS status code of responses on all endpoints should be "100"
# local shares are taking priority at the moment
Then as "Carol" folder "/Shares/zzzfolder/remote" should exist
And as "Carol" folder "/Shares/zzzfolder/remote" should exist
And as "Carol" folder "/Shares/zzzfolder (2)/local" should exist
And the content of file "/Shares/randomfile.txt" for user "Carol" on server "LOCAL" should be "remote content"
And the content of file "/Shares/randomfile (2).txt" for user "Carol" on server "LOCAL" should be "local content"
Expand All @@ -568,15 +570,17 @@ Feature: federated
And user "Brian" has created folder "/zzzfolder"
And user "Brian" has created folder "zzzfolder/local"
And user "Brian" has uploaded file with content "local content" to "/randomfile.txt"
When user "Brian" shares folder "zzzfolder" with user "Carol" using the sharing API
And user "Carol" accepts share "/zzzfolder" offered by user "Brian" using the sharing API
And user "Brian" shares folder "randomfile.txt" with user "Carol" using the sharing API
And user "Brian" has shared folder "zzzfolder" with user "Carol"
And user "Brian" has shared folder "randomfile.txt" with user "Carol"
And user "Alice" from server "REMOTE" has shared "zzzfolder" with user "Carol" from server "LOCAL"
And user "Alice" from server "REMOTE" has shared "randomfile.txt" with user "Carol" from server "LOCAL"
When user "Carol" accepts share "/zzzfolder" offered by user "Brian" using the sharing API
And user "Carol" accepts share "/randomfile.txt" offered by user "Brian" using the sharing API
And user "Alice" from server "REMOTE" shares "zzzfolder" with user "Carol" from server "LOCAL" using the sharing API
And user "Carol" from server "LOCAL" accepts the last pending share using the sharing API
And user "Alice" from server "REMOTE" shares "randomfile.txt" with user "Carol" from server "LOCAL" using the sharing API
And user "Carol" from server "LOCAL" accepts the last pending share using the sharing API
Then as "Carol" folder "Shares/zzzfolder/local" should exist
Then the HTTP status code of responses on all endpoints should be "200"
And the OCS status code of responses on all endpoints should be "100"
And as "Carol" folder "Shares/zzzfolder/local" should exist
And as "Carol" folder "Shares/zzzfolder (2)/remote" should exist
And the content of file "/Shares/randomfile.txt" for user "Carol" on server "LOCAL" should be "local content"
And the content of file "/Shares/randomfile (2).txt" for user "Carol" on server "LOCAL" should be "remote content"
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Feature: Save public shares created by oC users
And user "Brian" has added the public share created from server "LOCAL" using the sharing API
When user "Alice" deletes public link share named "sharedlink" in file "/PARENT" using the sharing API
Then the HTTP status code should be "200"
And the OCS status code should be "100"
And as "Brian" folder "/Shares/PARENT" should not exist


Expand Down Expand Up @@ -104,7 +105,9 @@ Feature: Save public shares created by oC users
And user "Alice" has added the public share created from server "REMOTE" using the sharing API
And using server "REMOTE"
When user "RemoteAlice" deletes public link share named "sharedlink" in file "/PARENT" using the sharing API
And using server "LOCAL"
Then the HTTP status code should be "200"
And the OCS status code should be "100"
When using server "LOCAL"
kiranparajuli589 marked this conversation as resolved.
Show resolved Hide resolved
Then as "Alice" folder "/Shares/PARENT" should not exist


Expand All @@ -125,4 +128,4 @@ Feature: Save public shares created by oC users
Examples:
| ocs_api_version | http_status_code |
| 1 | 200 |
| 2 | 404 |
| 2 | 404 |
7 changes: 5 additions & 2 deletions tests/acceptance/features/bootstrap/Sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,7 @@ public function userHasCreatedAPublicLinkShareWithSettings(string $user, ?TableN
$this->userCreatesAPublicLinkShareWithSettings($user, $body);
$this->ocsContext->theOCSStatusCodeShouldBe("100,200");
$this->theHTTPStatusCodeShouldBe(200);
$this->emptyLastHTTPStatusCodesArray();
$this->emptyLastOCSStatusCodesArray();
$this->clearStatusCodeArrays();
}

/**
Expand Down Expand Up @@ -1439,6 +1438,7 @@ public function userSharesTheFollowingFilesWithUserUsingTheSharingApi(
* @param string|int|string[]|int[] $permissions
*
* @return void
* @throws Exception
*/
public function userHasSharedFileWithUserUsingTheSharingApi(
string $user1,
Expand All @@ -1455,6 +1455,9 @@ public function userHasSharedFileWithUserUsingTheSharingApi(
$permissions,
true
);
$this->ocsContext->assertOCSResponseIndicatesSuccess(
'The ocs share response does not indicate success.',
);
// this is expected to fail if a file is shared with create and delete permissions, which is not possible
Assert::assertTrue(
$this->isUserOrGroupInSharedData($user2, "user", $permissions),
Expand Down