Skip to content

Commit

Permalink
Improve then steps for suite 'apiFederationToShares1'
Browse files Browse the repository at this point in the history
Signed-off-by: Parajuli Kiran <[email protected]>
  • Loading branch information
kiranparajuli589 committed Apr 27, 2022
1 parent fa29cd9 commit ef69c33
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 17 deletions.
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
26 changes: 15 additions & 11 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 "zzzfolder" with user "Carol" 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
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
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 "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
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,8 @@ 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"
When using server "LOCAL"
Then as "Alice" folder "/Shares/PARENT" should not exist


Expand All @@ -125,4 +127,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
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -3603,7 +3603,7 @@ public function userHasCreatedFolder(string $user, string $destination):void {
["201", "204"],
"HTTP status code was not 201 or 204 while trying to create folder '$destination' for user '$user'"
);
$this->emptyLastHTTPStatusCodesArray();
$this->clearStatusCodeArrays();
}

/**
Expand Down

0 comments on commit ef69c33

Please sign in to comment.