From 2714c4c83e4109cd831473a6a16ba1ff9c43ba2c Mon Sep 17 00:00:00 2001 From: Artur Neumann Date: Wed, 22 May 2019 12:24:48 +0545 Subject: [PATCH 1/2] revert saving response data in lastShareData when updating share this was added in #35204 but causes problems when an invalid request is done but the original `lastShareData` need to be accessed e.g `\Sharing::getMimeTypeOfLastSharedFile` --- tests/acceptance/features/bootstrap/Sharing.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index f43824244254..1c167a2e070f 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -590,7 +590,6 @@ public function userUpdatesTheLastShareWith($user, $body) { $this->response = HttpRequestHelper::put( $fullUrl, $user, $this->getPasswordForUser($user), null, $fd ); - $this->lastShareData = $this->getResponseXml(); } /** From 95a758cc7b6c1667258dc5d5c0e32f0257a03a5c Mon Sep 17 00:00:00 2001 From: Artur Neumann Date: Wed, 22 May 2019 12:28:45 +0545 Subject: [PATCH 2/2] replace checking last share response with just checking last response --- .../features/apiFederation/federated.feature | 6 ++-- .../features/apiMain/external-storage.feature | 2 +- .../createShare.feature | 18 +++++----- .../updateShare.feature | 14 ++++---- .../apiShareOperations/gettingShares.feature | 2 +- .../acceptance/features/bootstrap/Sharing.php | 33 ------------------- 6 files changed, 22 insertions(+), 53 deletions(-) diff --git a/tests/acceptance/features/apiFederation/federated.feature b/tests/acceptance/features/apiFederation/federated.feature index c8b92b4091e8..68d24edb93c0 100644 --- a/tests/acceptance/features/apiFederation/federated.feature +++ b/tests/acceptance/features/apiFederation/federated.feature @@ -12,7 +12,7 @@ Feature: federated When user "user1" from server "LOCAL" shares "/textfile0.txt" with user "user0" from server "REMOTE" using the sharing API Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | id | A_NUMBER | | item_type | file | | item_source | A_NUMBER | @@ -38,7 +38,7 @@ Feature: federated When user "user0" from server "REMOTE" shares "/textfile0.txt" with user "user1" from server "LOCAL" using the sharing API Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | id | A_NUMBER | | item_type | file | | item_source | A_NUMBER | @@ -172,7 +172,7 @@ Feature: federated | permissions | 19 | Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | id | A_NUMBER | | item_type | file | | item_source | A_NUMBER | diff --git a/tests/acceptance/features/apiMain/external-storage.feature b/tests/acceptance/features/apiMain/external-storage.feature index ef9921c91b20..99ce0d8818d3 100644 --- a/tests/acceptance/features/apiMain/external-storage.feature +++ b/tests/acceptance/features/apiMain/external-storage.feature @@ -16,7 +16,7 @@ Feature: external-storage | path | foo | Then the OCS status code should be "100" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | id | A_NUMBER | | url | AN_URL | | token | A_TOKEN | diff --git a/tests/acceptance/features/apiShareManagementBasic/createShare.feature b/tests/acceptance/features/apiShareManagementBasic/createShare.feature index 95a7f7f34651..5d1ed2bbf5b1 100644 --- a/tests/acceptance/features/apiShareManagementBasic/createShare.feature +++ b/tests/acceptance/features/apiShareManagementBasic/createShare.feature @@ -13,7 +13,7 @@ Feature: sharing When user "user0" shares file "welcome.txt" with user "user1" using the sharing API Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | share_with | user1 | | file_target | /welcome.txt | | path | /welcome.txt | @@ -30,7 +30,7 @@ Feature: sharing When user "user0" shares file "/welcome.txt" with group "grp1" using the sharing API Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | share_with | grp1 | | file_target | /welcome.txt | | path | /welcome.txt | @@ -50,7 +50,7 @@ Feature: sharing When user "user0" shares file "/welcome.txt" with user "user1" using the sharing API Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | share_with | user1 | | file_target | /welcome.txt | | path | /welcome.txt | @@ -96,7 +96,7 @@ Feature: sharing | permissions | 31 | Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | file_target | /welcome.txt | | path | /welcome.txt | | item_type | file | @@ -130,7 +130,7 @@ Feature: sharing | path | welcome.txt | Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | file_target | /welcome.txt | | path | /welcome.txt | | item_type | file | @@ -173,7 +173,7 @@ Feature: sharing | path | /afolder | Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | id | A_NUMBER | | share_type | 3 | | permissions | 1 | @@ -191,7 +191,7 @@ Feature: sharing | path | /afolder | Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | id | A_NUMBER | | share_type | 3 | | permissions | 1 | @@ -209,7 +209,7 @@ Feature: sharing | permissions | 15 | Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | id | A_NUMBER | | share_type | 3 | | permissions | 15 | @@ -227,7 +227,7 @@ Feature: sharing | permissions | 5 | Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | id | A_NUMBER | | share_type | 3 | | permissions | 5 | diff --git a/tests/acceptance/features/apiShareManagementBasic/updateShare.feature b/tests/acceptance/features/apiShareManagementBasic/updateShare.feature index cb633d1c0192..c37597cf0ea7 100644 --- a/tests/acceptance/features/apiShareManagementBasic/updateShare.feature +++ b/tests/acceptance/features/apiShareManagementBasic/updateShare.feature @@ -315,7 +315,8 @@ Feature: sharing And user "user0" has shared folder "/folder1" with user "user1" with permissions 31 And user "user1" has shared folder "/folder1/folder2" with user "user2" with permissions 31 When user "user1" moves folder "/folder1/folder2" to "/moved-out/folder2" using the WebDAV API - Then the share fields of the last share should include + And user "user1" gets the info of the last share using the sharing API + Then the fields of the last response should include | id | A_NUMBER | | item_type | folder | | item_source | A_NUMBER | @@ -342,7 +343,8 @@ Feature: sharing And user "user0" has shared folder "/user0-folder" with user "user1" with permissions 31 And user "user2" has shared folder "/user2-folder" with user "user1" with permissions 31 When user "user1" moves folder "/user0-folder/folder2" to "/user2-folder/folder2" using the WebDAV API - Then the share fields of the last share should include + And user "user2" gets the info of the last share using the sharing API + Then the fields of the last response should include | id | A_NUMBER | | item_type | folder | | item_source | A_NUMBER | @@ -451,8 +453,8 @@ Feature: sharing | permissions | 7 | Then the OCS status code should be "" And the HTTP status code should be "200" - When the user gets the info of the last share using the sharing API - Then the share fields of the last share should include + When user "user0" gets the info of the last share using the sharing API + Then the fields of the last response should include | permissions | 7 | When the public deletes file "CHILD/child.txt" from the last public share using the public WebDAV API Then the HTTP status code should be "403" @@ -471,8 +473,8 @@ Feature: sharing | permissions | 15 | Then the OCS status code should be "" And the HTTP status code should be "200" - When the user gets the info of the last share using the sharing API - Then the share fields of the last share should include + When user "user0" gets the info of the last share using the sharing API + Then the fields of the last response should include | permissions | 15 | When the public deletes file "CHILD/child.txt" from the last public share using the public WebDAV API Then the HTTP status code should be "204" diff --git a/tests/acceptance/features/apiShareOperations/gettingShares.feature b/tests/acceptance/features/apiShareOperations/gettingShares.feature index cdf77e7dfac5..897220e1162d 100644 --- a/tests/acceptance/features/apiShareOperations/gettingShares.feature +++ b/tests/acceptance/features/apiShareOperations/gettingShares.feature @@ -95,7 +95,7 @@ Feature: sharing When user "user0" gets the info of the last share using the sharing API Then the OCS status code should be "" And the HTTP status code should be "200" - And the share fields of the last share should include + And the fields of the last response should include | id | A_NUMBER | | item_type | file | | item_source | A_NUMBER | diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index 1c167a2e070f..f481783cd70e 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -689,17 +689,6 @@ public function isFieldInResponse($field, $contentExpected, $data = null) { } } - /** - * @param string $field - * @param string $contentExpected - * - * @return bool - */ - public function isFieldInShareResponse($field, $contentExpected) { - $data = $this->lastShareData->data[0]; - return $this->isFieldInResponse($field, $contentExpected, $data); - } - /** * @Then /^file "([^"]*)" should be included in the response$/ * @@ -1307,28 +1296,6 @@ public function checkingTheResponseEntriesCount($count) { PHPUnit\Framework\Assert::assertEquals($count, $actualCount); } - /** - * @Then /^the share fields of the last share should include$/ - * - * @param TableNode|null $body - * - * @return void - */ - public function checkShareFields($body) { - if ($body instanceof TableNode) { - $fd = $body->getRowsHash(); - - foreach ($fd as $field => $value) { - $value = $this->replaceValuesFromTable($field, $value); - if (!$this->isFieldInShareResponse($field, $value)) { - PHPUnit\Framework\Assert::fail( - "$field doesn't have value $value" - ); - } - } - } - } - /** * @Then the fields of the last response should include *