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

Accept incoming shares in integration tests #18031

Merged
merged 3 commits into from
Nov 20, 2019
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
33 changes: 33 additions & 0 deletions build/integration/features/bootstrap/Sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,39 @@ public function creatingShare($body) {
$this->asCreatingAShareWith($this->currentUser, $body);
}

/**
* @When /^accepting last share$/
*/
public function acceptingLastShare() {
$share_id = $this->lastShareData->data[0]->id;
$url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/pending/$share_id";
$this->sendingToWith("POST", $url, null);

$this->theHTTPStatusCodeShouldBe('200');
}

/**
* @When /^user "([^"]*)" accepts last share$/
*
* @param string $user
*/
public function userAcceptsLastShare(string $user) {
// "As userXXX" and "user userXXX accepts last share" steps are not
// expected to be used in the same scenario, but restore the user just
// in case.
$previousUser = $this->currentUser;

$this->currentUser = $user;

$share_id = $this->lastShareData->data[0]->id;
$url = "/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/pending/$share_id";
$this->sendingToWith("POST", $url, null);

$this->currentUser = $previousUser;

$this->theHTTPStatusCodeShouldBe('200');
}

/**
* @Then /^Public shared file "([^"]*)" can be downloaded$/
*/
Expand Down
15 changes: 10 additions & 5 deletions build/integration/features/comments-search.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ Feature: comments-search
Given user "user0" exists
And user "user1" exists
And User "user1" uploads file "data/textfile.txt" to "/sharedFileToComment.txt"
And As "user1" sending "POST" to "/apps/files_sharing/api/v1/shares" with
And as "user1" creating a share with
| path | sharedFileToComment.txt |
| shareWith | user0 |
| shareType | 0 |
And user "user0" accepts last share
And "user0" posts a comment with content "My first comment" on the file named "/sharedFileToComment.txt" it should return "201"
When Logging in using web as "user0"
And searching for "first" in app "files"
Expand All @@ -41,10 +42,11 @@ Feature: comments-search
Given user "user0" exists
And user "user1" exists
And User "user0" uploads file "data/textfile.txt" to "/mySharedFileToComment.txt"
And As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
And as "user0" creating a share with
| path | mySharedFileToComment.txt |
| shareWith | user1 |
| shareType | 0 |
And user "user1" accepts last share
And "user1" posts a comment with content "Other's first comment" on the file named "/mySharedFileToComment.txt" it should return "201"
When Logging in using web as "user0"
And searching for "first" in app "files"
Expand All @@ -62,10 +64,11 @@ Feature: comments-search
Given user "user0" exists
And user "user1" exists
And User "user1" uploads file "data/textfile.txt" to "/sharedFileToComment.txt"
And As "user1" sending "POST" to "/apps/files_sharing/api/v1/shares" with
And as "user1" creating a share with
| path | sharedFileToComment.txt |
| shareWith | user0 |
| shareType | 0 |
And user "user0" accepts last share
And "user1" posts a comment with content "Other's first comment" on the file named "/sharedFileToComment.txt" it should return "201"
When Logging in using web as "user0"
And searching for "first" in app "files"
Expand Down Expand Up @@ -175,15 +178,17 @@ Feature: comments-search
And user "user1" exists
And User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
And User "user0" uploads file "data/textfile.txt" to "/mySharedFileToComment.txt"
And As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
And as "user0" creating a share with
| path | mySharedFileToComment.txt |
| shareWith | user1 |
| shareType | 0 |
And user "user1" accepts last share
And User "user1" uploads file "data/textfile.txt" to "/sharedFileToComment.txt"
And As "user1" sending "POST" to "/apps/files_sharing/api/v1/shares" with
And as "user1" creating a share with
| path | sharedFileToComment.txt |
| shareWith | user0 |
| shareType | 0 |
And user "user0" accepts last share
And "user0" posts a comment with content "My first comment to be found" on the file named "/myFileToComment.txt" it should return "201"
And "user0" posts a comment with content "The second comment should not be found" on the file named "/myFileToComment.txt" it should return "201"
And "user0" posts a comment with content "My first comment to be found" on the file named "/mySharedFileToComment.txt" it should return "201"
Expand Down
18 changes: 12 additions & 6 deletions build/integration/features/comments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ Feature: comments
Given user "user0" exists
Given user "12345" exists
Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
Given as "user0" creating a share with
| path | myFileToComment.txt |
| shareWith | 12345 |
| shareType | 0 |
Given user "12345" accepts last share
When "12345" posts a comment with content "A comment from another user" on the file named "/myFileToComment.txt" it should return "201"
Then As "12345" load all the comments of the file named "/myFileToComment.txt" it should return "207"
And the response should contain a property "oc:parentId" with value "0"
Expand Down Expand Up @@ -68,10 +69,11 @@ Feature: comments
Given user "user1" exists
Given As an "user0"
Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
Given as "user0" creating a share with
| path | myFileToComment.txt |
| shareWith | user1 |
| shareType | 0 |
And user "user1" accepts last share
Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
When As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
Then the response should contain a property "oc:parentId" with value "0"
Expand All @@ -90,10 +92,11 @@ Feature: comments
Given user "user0" exists
Given user "user1" exists
Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
Given as "user0" creating a share with
| path | myFileToComment.txt |
| shareWith | user1 |
| shareType | 0 |
And user "user1" accepts last share
Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
When As "user1" load all the comments of the file named "/myFileToComment.txt" it should return "207"
Then the response should contain a property "oc:parentId" with value "0"
Expand Down Expand Up @@ -135,10 +138,11 @@ Feature: comments
Given user "user0" exists
Given user "user1" exists
Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
Given as "user0" creating a share with
| path | myFileToComment.txt |
| shareWith | user1 |
| shareType | 0 |
And user "user1" accepts last share
Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
Then the response should contain a property "oc:parentId" with value "0"
Expand All @@ -163,10 +167,11 @@ Feature: comments
Given user "user0" exists
Given user "user1" exists
Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
Given as "user0" creating a share with
| path | myFileToComment.txt |
| shareWith | user1 |
| shareType | 0 |
And user "user1" accepts last share
When "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
Then As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
And the response should contain a property "oc:parentId" with value "0"
Expand All @@ -192,10 +197,11 @@ Feature: comments
Given user "user0" exists
Given user "user1" exists
Given User "user0" uploads file "data/textfile.txt" to "/myFileToComment.txt"
Given As "user0" sending "POST" to "/apps/files_sharing/api/v1/shares" with
Given as "user0" creating a share with
| path | myFileToComment.txt |
| shareWith | user1 |
| shareType | 0 |
And user "user1" accepts last share
Given "user1" posts a comment with content "My first comment" on the file named "/myFileToComment.txt" it should return "201"
When As "user0" load all the comments of the file named "/myFileToComment.txt" it should return "207"
Then the response should contain a property "oc:parentId" with value "0"
Expand Down
1 change: 1 addition & 0 deletions build/integration/features/dav-v2.feature
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Feature: dav-v2
| shareType | 0 |
| permissions | 31 |
| shareWith | user0 |
And user "user0" accepts last share
And As an "user0"
When User "user0" uploads file "data/textfile.txt" to "/testquota/asdf.txt"
Then the HTTP status code should be "201"
1 change: 1 addition & 0 deletions build/integration/features/external-storage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Feature: external-storage
And User "user0" moved file "/textfile0.txt" to "/local_storage/foo/textfile0.txt"
And folder "/local_storage/foo" of user "user0" is shared with user "user1"
And As an "user1"
And accepting last share
When creating a share with
| path | foo |
| shareType | 3 |
Expand Down
1 change: 1 addition & 0 deletions build/integration/features/favorites.feature
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ Feature: favorite
And user "user0" created a folder "/shared"
And User "user0" moved file "/textfile0.txt" to "/shared/shared_file.txt"
And folder "/shared" of user "user0" is shared with user "user1"
And user "user1" accepts last share
And user "user1" favorites element "/shared/shared_file.txt"
When User "user1" moved file "/shared/shared_file.txt" to "/taken_out.txt"
Then user "user1" in folder "/" should have favorited the following elements
Expand Down
Loading