diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index fa9aab70e1c..27e95f8b7f2 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -186,23 +186,6 @@ _ocdav: api compatibility, return correct status code_ - [coreApiAuth/webDavPUTAuth.feature:46](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavPUTAuth.feature#L46) - [coreApiAuth/webDavPUTAuth.feature:58](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavPUTAuth.feature#L58) -#### [Using double slash in URL to access a folder gives 501 and other status codes](https://github.com/owncloud/ocis/issues/1667) - -- [coreApiAuth/webDavSpecialURLs.feature:15](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L15) -- [coreApiAuth/webDavSpecialURLs.feature:26](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L26) -- [coreApiAuth/webDavSpecialURLs.feature:78](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L78) -- [coreApiAuth/webDavSpecialURLs.feature:90](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L90) -- [coreApiAuth/webDavSpecialURLs.feature:102](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L102) -- [coreApiAuth/webDavSpecialURLs.feature:113](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L113) -- [coreApiAuth/webDavSpecialURLs.feature:123](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L123) -- [coreApiAuth/webDavSpecialURLs.feature:134](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L134) -- [coreApiAuth/webDavSpecialURLs.feature:144](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L144) -- [coreApiAuth/webDavSpecialURLs.feature:155](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L155) -- [coreApiAuth/webDavSpecialURLs.feature:165](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L165) -- [coreApiAuth/webDavSpecialURLs.feature:176](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L176) -- [coreApiAuth/webDavSpecialURLs.feature:186](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L186) -- [coreApiAuth/webDavSpecialURLs.feature:197](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature#L197) - #### [Difference in response content of status.php and default capabilities](https://github.com/owncloud/ocis/issues/1286) - [coreApiCapabilities/capabilitiesWithNormalUser.feature:13](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiCapabilities/capabilitiesWithNormalUser.feature#L13) diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 81e37b7aba5..1165edfdc11 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -2619,31 +2619,35 @@ public function theHTTPStatusCodeOfResponsesOnAllEndpointsShouldBe(int $statusCo } /** - * @Then the HTTP status code of responses on each endpoint should be :statusCode respectively + * @Then the HTTP status code of responses on each endpoint should be :statusCodes respectively * - * @param string $statusCodes + * @param string $statusCodes a comma-separated string of expected HTTP status codes * * @return void * @throws Exception */ public function theHTTPStatusCodeOfResponsesOnEachEndpointShouldBe(string $statusCodes):void { - $statusCodes = \explode(',', $statusCodes); - $count = \count($statusCodes); - if ($count === \count($this->lastHttpStatusCodesArray)) { + $expectedStatusCodes = \explode(',', $statusCodes); + $actualStatusCodes = $this->lastHttpStatusCodesArray; + $count = \count($expectedStatusCodes); + $statusCodesAreAllOk = true; + if ($count === \count($actualStatusCodes)) { for ($i = 0; $i < $count; $i++) { - Assert::assertSame( - (int)\trim($statusCodes[$i]), - (int)$this->lastHttpStatusCodesArray[$i], - 'Responses did not return expected HTTP status code' - ); + $expectedCode = (int)\trim($expectedStatusCodes[$i]); + $actualCode = (int)$actualStatusCodes[$i]; + if ($expectedCode !== $actualCode) { + $statusCodesAreAllOk = false; + } } - $this->emptyLastHTTPStatusCodesArray(); } else { - throw new Exception( - 'Expected HTTP status codes: "' . \implode(',', $statusCodes) . - '". Found HTTP status codes: "' . \implode(',', $this->lastHttpStatusCodesArray) . '"' - ); + $statusCodesAreAllOk = false; } + $this->emptyLastHTTPStatusCodesArray(); + Assert::assertTrue( + $statusCodesAreAllOk, + 'Expected HTTP status codes: "' . $statusCodes . + '". Found HTTP status codes: "' . \implode(',', $actualStatusCodes) . '"' + ); } /** diff --git a/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature b/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature index 056e946b9ea..c35e7192fab 100644 --- a/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature +++ b/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature @@ -20,7 +20,7 @@ Feature: make webdav request with special urls | /remote.php//dav/files/%username%/PARENT/parent.txt | | /remote.php//webdav/PARENT | | //remote.php/dav//files/%username%//FOLDER | - Then the HTTP status code of responses on all endpoints should be "204" + Then the HTTP status code of responses on each endpoint should be "200,200,204,204,200" respectively @skipOnRevaMaster Scenario: send DELETE requests to webDav endpoints with 2 slashes using the spaces WebDAV API @@ -30,7 +30,7 @@ Feature: make webdav request with special urls | //remote.php//dav/spaces/%spaceid%/PARENT/parent.txt | | /remote.php//dav/spaces/%spaceid%/PARENT | | //remote.php/dav//spaces/%spaceid%//FOLDER | - Then the HTTP status code of responses on all endpoints should be "204" + Then the HTTP status code of responses on each endpoint should be "200,200,204,200" respectively Scenario: send GET requests to webDav endpoints with 2 slashes @@ -84,7 +84,7 @@ Feature: make webdav request with special urls | //remote.php/dav//files/%username%/PARENT4 | | /remote.php/dav/files/%username%//PARENT5 | | /remote.php/dav//files/%username%/PARENT6 | - Then the HTTP status code of responses on all endpoints should be "201" + Then the HTTP status code of responses on each endpoint should be "200,201,200,200,201,201" respectively @skipOnRevaMaster Scenario: send MKCOL requests to webDav endpoints with 2 slashes using the spaces WebDAV API @@ -96,7 +96,7 @@ Feature: make webdav request with special urls | //remote.php/dav//spaces/%spaceid%/PARENT4 | | /remote.php/dav/spaces/%spaceid%//PARENT5 | | /remote.php/dav//spaces/%spaceid%/PARENT6 | - Then the HTTP status code of responses on all endpoints should be "201" + Then the HTTP status code of responses on each endpoint should be "200,201,200,200,201,201" respectively Scenario: send MOVE requests to webDav endpoints with 2 slashes @@ -107,7 +107,7 @@ Feature: make webdav request with special urls | /remote.php/webdav//PARENT | /remote.php/webdav/PARENT1 | | //remote.php/dav/files/%username%//PARENT1 | /remote.php/dav/files/%username%/PARENT2 | | /remote.php/dav//files/%username%/PARENT2/parent.txt | /remote.php/dav/files/%username%/PARENT2/parent1.txt | - Then the HTTP status code of responses on all endpoints should be "201" + Then the HTTP status code of responses on each endpoint should be "200,201,201,200,404" respectively @skipOnRevaMaster Scenario: send MOVE requests to webDav endpoints with 2 slashes using the spaces WebDAV API @@ -117,7 +117,7 @@ Feature: make webdav request with special urls | /remote.php/dav//spaces/%spaceid%/PARENT | /remote.php/dav/spaces/%spaceid%/PARENT1 | | //remote.php/dav/spaces/%spaceid%//PARENT1 | /remote.php/dav/spaces/%spaceid%/PARENT2 | | //remote.php/dav/spaces/%spaceid%/PARENT2/parent.txt | /remote.php/dav/spaces/%spaceid%/PARENT2/parent1.txt | - Then the HTTP status code of responses on all endpoints should be "201" + Then the HTTP status code of responses on each endpoint should be "201,201,200,200" respectively Scenario: send POST requests to webDav endpoints with 2 slashes @@ -128,7 +128,7 @@ Feature: make webdav request with special urls | /remote.php//dav/files/%username%/PARENT/parent.txt | | /remote.php//webdav/PARENT | | //remote.php/dav//files/%username%//FOLDER | - Then the HTTP status code of responses on all endpoints should be "500" or "501" + Then the HTTP status code of responses on each endpoint should be "200,200,412,412,200" respectively @skipOnRevaMaster Scenario: send POST requests to webDav endpoints with 2 slashes using the spaces WebDAV API @@ -138,7 +138,7 @@ Feature: make webdav request with special urls | /remote.php//dav/spaces/%spaceid%/PARENT/parent.txt | | /remote.php//dav/spaces/%spaceid%/PARENT | | //remote.php/dav//spaces/%spaceid%//FOLDER | - Then the HTTP status code of responses on all endpoints should be "500" or "501" + Then the HTTP status code of responses on each endpoint should be "200,412,412,200" respectively Scenario: send PROPFIND requests to webDav endpoints with 2 slashes @@ -149,7 +149,7 @@ Feature: make webdav request with special urls | /remote.php//dav/files/%username%/PARENT/parent.txt | | /remote.php//webdav/PARENT | | //remote.php/dav//files/%username%//FOLDER | - Then the HTTP status code of responses on all endpoints should be "207" + Then the HTTP status code of responses on each endpoint should be "200,200,207,207,200" respectively @skipOnRevaMaster Scenario: send PROPFIND requests to webDav endpoints with 2 slashes using the spaces WebDAV API @@ -159,7 +159,7 @@ Feature: make webdav request with special urls | /remote.php//dav/spaces/%spaceid%/PARENT/parent.txt | | /remote.php//dav/spaces/%spaceid%/PARENT | | //remote.php/dav//spaces/%spaceid%//FOLDER | - Then the HTTP status code of responses on all endpoints should be "207" + Then the HTTP status code of responses on each endpoint should be "200,207,207,200" respectively Scenario: send PROPPATCH requests to webDav endpoints with 2 slashes @@ -170,7 +170,7 @@ Feature: make webdav request with special urls | /remote.php//dav/files/%username%/PARENT/parent.txt | | /remote.php//webdav/PARENT | | //remote.php/dav//files/%username%//FOLDER | - Then the HTTP status code of responses on all endpoints should be "207" + Then the HTTP status code of responses on each endpoint should be "200,200,400,400,200" respectively @skipOnRevaMaster Scenario: send PROPPATCH requests to webDav endpoints with 2 slashes using the spaces WebDAV API @@ -180,7 +180,7 @@ Feature: make webdav request with special urls | /remote.php//dav/spaces/%spaceid%/PARENT/parent.txt | | /remote.php//dav/spaces/%spaceid%/PARENT | | //remote.php/dav//spaces/%spaceid%//FOLDER | - Then the HTTP status code of responses on all endpoints should be "207" + Then the HTTP status code of responses on each endpoint should be "200,400,400,200" respectively Scenario: send PUT requests to webDav endpoints with 2 slashes @@ -191,7 +191,7 @@ Feature: make webdav request with special urls | //remote.php//dav/files/%username%/textfile1.txt | | /remote.php/dav/files/%username%/textfile7.txt | | //remote.php/dav/files/%username%/PARENT//parent.txt | - Then the HTTP status code of responses on all endpoints should be "204" or "201" + Then the HTTP status code of responses on each endpoint should be "200,204,200,201,200" respectively @skipOnRevaMaster Scenario: send PUT requests to webDav endpoints with 2 slashes using the spaces WebDAV API @@ -202,4 +202,4 @@ Feature: make webdav request with special urls | //remote.php//dav/spaces/%spaceid%/textfile1.txt | | /remote.php/dav/spaces/%spaceid%/textfile7.txt | | //remote.php/dav/spaces/%spaceid%/PARENT//parent.txt | - Then the HTTP status code of responses on all endpoints should be "204" or "201" + Then the HTTP status code of responses on each endpoint should be "200,204,200,201,200" respectively