core
core copied to clipboard
Refactor `/apiAuth/cors.feature` tests for OCIS
The tests in apiAuth/cors.feature
needs to be refactored so that they run in OCIS too. right now we have step
And user "Alice" has added "https://aphno.badal" to the list of personal CORS domains
which runs some occ comands
which is not relevant in OCIS
. So the tests there need some kind of refactoring so that they support both backends.
https://github.com/owncloud/core/blob/1252e5ddab6532c3d77d870e133fee4cafc74c70/tests/acceptance/features/apiAuth/cors.feature#L8-L49
the tests in this file are currently in expected to fail https://github.com/owncloud/ocis/blob/66f2cf35624de7171f1b7b6362e573ca2b9f6e60/tests/acceptance/expected-failures-API-on-OCIS-storage.md?plain=1#L1128
Right now if I run tests from this file on OCIS it fails as so
@api @issue-ocis-reva-26 @issue-ocis-reva-27
Feature: CORS headers
Background: # /home/swikriti/www/core/tests/acceptance/features/apiAuth/cors.feature:4
Given user "Alice" has been created with default attributes and without skeleton files # FeatureContext::userHasBeenCreatedWithDefaultAttributesAndWithoutSkeletonFiles()
@skipOnOcV10.8 @skipOnOcV10.9.0 @skipOnOcV10.9.1
Scenario Outline: CORS headers should be returned when setting CORS domain sending Origin header # /home/swikriti/www/core/tests/acceptance/features/apiAuth/cors.feature:8
Given using OCS API version "<ocs_api_version>" # FeatureContext::usingOcsApiVersion()
And user "Alice" has added "https://aphno.badal" to the list of personal CORS domains # CorsContext::addDomainToPrivateCORSLists()
When user "Alice" sends HTTP method "GET" to OCS API endpoint "<endpoint>" with headers # OCSContext::userSendsToOcsApiEndpointWithHeaders()
| header | value |
| Origin | https://aphno.badal |
Then the OCS status code should be "<ocs-code>" # OCSContext::theOCSStatusCodeShouldBe()
And the HTTP status code should be "<http-code>" # FeatureContext::thenTheHTTPStatusCodeShouldBe()
And the following headers should be set # FeatureContext::theFollowingHeadersShouldBeSet()
| header | value |
| Access-Control-Allow-Headers | OC-Checksum,OC-Total-Length,OCS-APIREQUEST,X-OC-Mtime,OC-RequestAppPassword,Accept,Authorization,Brief,Content-Length,Content-Range,Content-Type,Date,Depth,Destination,Host,If,If-Match,If-Modified-Since,If-None-Match,If-Range,If-Unmodified-Since,Location,Lock-Token,Overwrite,Prefer,Range,Schedule-Reply,Timeout,User-Agent,X-Expected-Entity-Length,Accept-Language,Access-Control-Request-Method,Access-Control-Allow-Origin,Cache-Control,ETag,OC-Autorename,OC-CalDav-Import,OC-Chunked,OC-Etag,OC-FileId,OC-LazyOps,OC-Total-File-Length,Origin,X-Request-ID,X-Requested-With |
| Access-Control-Expose-Headers | Content-Location,DAV,ETag,Link,Lock-Token,OC-ETag,OC-Checksum,OC-FileId,OC-JobStatus-Location,OC-RequestAppPassword,Vary,Webdav-Location,X-Sabre-Status |
| Access-Control-Allow-Origin | https://aphno.badal |
| Access-Control-Allow-Methods | GET,OPTIONS,POST,PUT,DELETE,MKCOL,PROPFIND,PATCH,PROPPATCH,REPORT |
Examples:
| ocs_api_version | endpoint | ocs-code | http-code |
| 1 | /config | 100 | 200 |
CorsContext::addDomainToPrivateCORSLists The output of 'occ user:setting Alice core domains' was not valid JSON
Failed asserting that null is of type "array".
│
│ WARNING: reva data root folder (/var/tmp/ocis/owncloud/) does not exist
│
│
└─ @AfterScenario # FeatureContext::afterScenario()
--- Failed scenarios:
/home/swikriti/www/core/tests/acceptance/features/apiAuth/cors.feature:32