From c00d82951adcd5bdbba654fac865506ab20aed47 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Fri, 7 Jun 2024 15:10:59 +0545 Subject: [PATCH] test: check for status codes that are different on oCIS and reva --- .../acceptance/features/bootstrap/WebDav.php | 35 +++++++++++++++++-- .../coreApiAuth/webDavSpecialURLs.feature | 20 +++++------ 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 1165edfdc1..a44834abcd 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -26,6 +26,7 @@ use GuzzleHttp\Exception\GuzzleException; use PHPUnit\Framework\Assert; use Psr\Http\Message\ResponseInterface; use GuzzleHttp\Stream\StreamInterface; +use TestHelpers\OcisHelper; use TestHelpers\UploadHelper; use TestHelpers\WebDavHelper; use TestHelpers\HttpRequestHelper; @@ -2619,14 +2620,12 @@ trait WebDav { } /** - * @Then the HTTP status code of responses on each endpoint should be :statusCodes respectively - * * @param string $statusCodes a comma-separated string of expected HTTP status codes * * @return void * @throws Exception */ - public function theHTTPStatusCodeOfResponsesOnEachEndpointShouldBe(string $statusCodes):void { + public function checkTheHTTPStatusCodeOfResponsesOnEachEndpoint(string $statusCodes):void { $expectedStatusCodes = \explode(',', $statusCodes); $actualStatusCodes = $this->lastHttpStatusCodesArray; $count = \count($expectedStatusCodes); @@ -2650,6 +2649,36 @@ trait WebDav { ); } + /** + * @Then the HTTP status code of responses on each endpoint should be :statusCodes respectively + * + * @param string $statusCodes a comma-separated string of expected HTTP status codes + * + * @return void + * @throws Exception + */ + public function theHTTPStatusCodeOfResponsesOnEachEndpointShouldBe(string $statusCodes):void { + $this->checkTheHTTPStatusCodeOfResponsesOnEachEndpoint($statusCodes); + } + + /** + * @Then the HTTP status code of responses on each endpoint should be :ocisStatusCodes on oCIS or :revaStatusCodes on reva + * + * @param string $ocisStatusCodes a comma-separated string of expected HTTP status codes when running on oCIS + * @param string $revaStatusCodes a comma-separated string of expected HTTP status codes when running on reva + * + * @return void + * @throws Exception + */ + public function theHTTPStatusCodeOfResponsesOnEachEndpointShouldBeOcisReva(string $ocisStatusCodes, string $revaStatusCodes):void { + if (OcisHelper::isTestingOnReva()) { + $expectedStatusCodes = $revaStatusCodes; + } else { + $expectedStatusCodes = $ocisStatusCodes; + } + $this->checkTheHTTPStatusCodeOfResponsesOnEachEndpoint($expectedStatusCodes); + } + /** * @Then the OCS status code of responses on each endpoint should be :statusCode respectively * diff --git a/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature b/tests/acceptance/features/coreApiAuth/webDavSpecialURLs.feature index c35e7192fa..b5004c5e30 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 each endpoint should be "200,200,204,204,200" respectively + Then the HTTP status code of responses on each endpoint should be "200,200,204,204,200" on oCIS or "204,204,204,204,204" on reva @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 each endpoint should be "200,200,204,200" respectively + Then the HTTP status code of responses on each endpoint should be "200,200,204,200" on oCIS or "204,204,204,204" on reva 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 each endpoint should be "200,201,200,200,201,201" respectively + Then the HTTP status code of responses on each endpoint should be "200,201,200,200,201,201" on oCIS or "201,201,201,201,201,201" on reva @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 each endpoint should be "200,201,200,200,201,201" respectively + Then the HTTP status code of responses on each endpoint should be "200,201,200,200,201,201" on oCIS or "201,201,201,201,201,201" on reva 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 each endpoint should be "200,201,201,200,404" respectively + Then the HTTP status code of responses on each endpoint should be "200,201,201,200,404" on oCIS or "201,201,201,201,201" on reva @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 each endpoint should be "201,201,200,200" respectively + Then the HTTP status code of responses on each endpoint should be "201,201,200,200" on oCIS or "201,201,201,201" on reva Scenario: send POST 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 each endpoint should be "200,200,207,207,200" respectively + Then the HTTP status code of responses on each endpoint should be "200,200,207,207,200" on oCIS or "207,207,207,207,207" on reva @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 each endpoint should be "200,207,207,200" respectively + Then the HTTP status code of responses on each endpoint should be "200,207,207,200" on oCIS or "207,207,207,207" on reva Scenario: send PROPPATCH 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 each endpoint should be "200,204,200,201,200" respectively + Then the HTTP status code of responses on each endpoint should be "200,204,200,201,200" on oCIS or "204,204,204,201,204" on reva @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 each endpoint should be "200,204,200,201,200" respectively + Then the HTTP status code of responses on each endpoint should be "200,204,200,201,200" on oCIS or "204,204,204,201,204" on reva