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

[tests-only] [full-ci] Added Then steps to improve checks in tests for apiWebdavProperties suites #39819

Merged
merged 2 commits into from
Feb 23, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ Feature: copy file
And user "Alice" has accepted share "/testshare" offered by user "Brian"
When user "Alice" copies file "/textfile0.txt" to "/Shares/testshare/textfile0.txt" using the WebDAV API
Then the HTTP status code should be "403"
And user "Alice" downloads file "/Shares/testshare/textfile0.txt" using the WebDAV API
And the HTTP status code should be "404"
And user "Alice" should not be able to download file "/Shares/testshare/textfile0.txt"
Examples:
| dav_version |
| old |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Feature: create folder
Scenario Outline: create a folder
Given using <dav_version> DAV path
When user "Alice" creates folder "<folder_name>" using the WebDAV API
Then as "Alice" folder "<folder_name>" should exist
Then the HTTP status code should be "201"
And as "Alice" folder "<folder_name>" should exist
Examples:
| dav_version | folder_name |
| old | /upload |
Expand Down Expand Up @@ -48,7 +49,8 @@ Feature: create folder
When user "Alice" gets the following properties of folder "/test_folder" using the WebDAV API
| propertyName |
| d:resourcetype |
Then the single response should contain a property "d:resourcetype" with a child property "d:collection"
Then the HTTP status code should be "201"
And the single response should contain a property "d:resourcetype" with a child property "d:collection"
Examples:
| dav_version |
| old |
Expand All @@ -66,7 +68,8 @@ Feature: create folder
When user "Alice" gets the following properties of folder "/test_folder:5" using the WebDAV API
| propertyName |
| d:resourcetype |
Then the single response should contain a property "d:resourcetype" with a child property "d:collection"
Then the HTTP status code should be "201"
And the single response should contain a property "d:resourcetype" with a child property "d:collection"
Examples:
| dav_version |
| old |
Expand Down
15 changes: 10 additions & 5 deletions tests/acceptance/features/apiWebdavProperties1/getQuota.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Feature: get quota
Scenario Outline: Retrieving folder quota when no quota is set
Given using <dav_version> DAV path
When the administrator gives unlimited quota to user "Alice" using the provisioning API
Then as user "Alice" folder "/" should contain a property "d:quota-available-bytes" with value "-3"
Then the HTTP status code should be "200"
And as user "Alice" folder "/" should contain a property "d:quota-available-bytes" with value "-3"
Examples:
| dav_version |
| old |
Expand All @@ -26,7 +27,8 @@ Feature: get quota
Scenario Outline: Retrieving folder quota when quota is set
Given using <dav_version> DAV path
When the administrator sets the quota of user "Alice" to "10 MB" using the provisioning API
Then as user "Alice" folder "/" should contain a property "d:quota-available-bytes" with value "10485406"
Then the HTTP status code should be "200"
And as user "Alice" folder "/" should contain a property "d:quota-available-bytes" with value "10485406"
Examples:
| dav_version |
| old |
Expand All @@ -52,7 +54,8 @@ Feature: get quota
When user "Alice" gets the following properties of folder "/testquota" using the WebDAV API
| propertyName |
| d:quota-available-bytes |
Then the single response should contain a property "d:quota-available-bytes" with value "10485406"
Then the HTTP status code should be "200"
And the single response should contain a property "d:quota-available-bytes" with value "10485406"
Examples:
| dav_version |
| old |
Expand All @@ -71,7 +74,8 @@ Feature: get quota
When user "Alice" gets the following properties of folder "/" using the WebDAV API
| propertyName |
| d:quota-available-bytes |
Then the single response should contain a property "d:quota-available-bytes" with value "577"
Then the HTTP status code should be "201"
And the single response should contain a property "d:quota-available-bytes" with value "577"
Examples:
| dav_version |
| old |
Expand All @@ -92,7 +96,8 @@ Feature: get quota
When user "Brian" gets the following properties of folder "/" using the WebDAV API
| propertyName |
| d:quota-available-bytes |
Then the single response should contain a property "d:quota-available-bytes" with value "670"
Then the HTTP status code should be "200"
And the single response should contain a property "d:quota-available-bytes" with value "670"
Examples:
| dav_version |
| old |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ Feature: get file properties
Given using <dav_version> DAV path
And user "Alice" has uploaded file with content "uploaded content" to "<file_name>"
When user "Alice" gets the properties of file "<file_name>" using the WebDAV API
Then the properties response should contain an etag
Then the HTTP status code should be "201"
And the properties response should contain an etag
Examples:
| dav_version | file_name |
| old | /upload.txt |
Expand All @@ -38,7 +39,8 @@ Feature: get file properties
Given using <dav_version> DAV path
And user "Alice" has uploaded file with content "uploaded content" to "<file_name>"
When user "Alice" gets the properties of file "<file_name>" using the WebDAV API
Then the properties response should contain an etag
Then the HTTP status code should be "201"
And the properties response should contain an etag
And the value of the item "//d:response/d:href" in the response to user "Alice" should match "/<expected_href>/"
Examples:
| dav_version | file_name | expected_href |
Expand Down Expand Up @@ -66,7 +68,8 @@ Feature: get file properties
And user "Alice" has uploaded file with content "uploaded content" to "<folder_name>/file1.txt"
And user "Alice" has uploaded file with content "uploaded content" to "<folder_name>/file2.txt"
When user "Alice" gets the properties of folder "<folder_name>" with depth 1 using the WebDAV API
Then there should be an entry with href matching "/<expected_href>\//" in the response to user "Alice"
Then the HTTP status code should be "201"
And there should be an entry with href matching "/<expected_href>\//" in the response to user "Alice"
And there should be an entry with href matching "/<expected_href>\/file1.txt/" in the response to user "Alice"
And there should be an entry with href matching "/<expected_href>\/file2.txt/" in the response to user "Alice"
Examples:
Expand Down Expand Up @@ -103,7 +106,8 @@ Feature: get file properties
And user "Alice" has created folder "<folder_name>"
And user "Alice" has uploaded file with content "uploaded content" to "<folder_name>/<file_name>"
When user "Alice" gets the properties of file "<folder_name>/<file_name>" using the WebDAV API
Then the properties response should contain an etag
Then the HTTP status code should be "201"
And the properties response should contain an etag
Examples:
| dav_version | folder_name | file_name |
| old | /upload | abc.txt |
Expand Down Expand Up @@ -133,7 +137,8 @@ Feature: get file properties
And user "Alice" has created folder "<folder_name>"
And user "Alice" has uploaded file with content "uploaded content" to "<folder_name>/<file_name>"
When user "Alice" gets the properties of file "<folder_name>/<file_name>" using the WebDAV API
Then the properties response should contain an etag
Then the HTTP status code should be "201"
And the properties response should contain an etag
Examples:
| dav_version | folder_name | file_name |
| old | /folder ?2.txt | file ?2.txt |
Expand All @@ -151,7 +156,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "/test" using the WebDAV API
| propertyName |
| oc:share-types |
Then the response should contain an empty property "oc:share-types"
Then the HTTP status code should be "201"
And the response should contain an empty property "oc:share-types"
Examples:
| dav_version |
| old |
Expand All @@ -175,7 +181,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "/test" using the WebDAV API
| propertyName |
| oc:share-types |
Then the response should contain a share-types property with
Then the HTTP status code should be "200"
And the response should contain a share-types property with
| 0 |
Examples:
| dav_version |
Expand All @@ -200,7 +207,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "/test" using the WebDAV API
| propertyName |
| oc:share-types |
Then the response should contain a share-types property with
Then the HTTP status code should be "200"
And the response should contain a share-types property with
| 1 |
Examples:
| dav_version |
Expand All @@ -222,7 +230,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "/test" using the WebDAV API
| propertyName |
| oc:share-types |
Then the response should contain a share-types property with
Then the HTTP status code should be "200"
And the response should contain a share-types property with
| 3 |
Examples:
| dav_version |
Expand Down Expand Up @@ -256,7 +265,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "/test" using the WebDAV API
| propertyName |
| oc:share-types |
Then the response should contain a share-types property with
Then the HTTP status code should be "200"
And the response should contain a share-types property with
| 0 |
| 1 |
| 3 |
Expand Down Expand Up @@ -289,7 +299,8 @@ Feature: get file properties
When user "Alice" gets the following properties of file "/somefile.txt" using the WebDAV API
| propertyName |
| oc:privatelink |
Then the single response should contain a property "oc:privatelink" with value like "%(/(index.php/)?f/[0-9]*)%"
Then the HTTP status code should be "201"
And the single response should contain a property "oc:privatelink" with value like "%(/(index.php/)?f/[0-9]*)%"
Examples:
| dav_version |
| old |
Expand All @@ -303,7 +314,8 @@ Feature: get file properties

Scenario Outline: Do a PROPFIND to a nonexistent URL
When user "Alice" requests "<url>" with "PROPFIND" using basic auth
Then the value of the item "/d:error/s:message" in the response about user "Alice" should be "<message1>" or "<message2>"
Then the HTTP status code should be "404"
And the value of the item "/d:error/s:message" in the response about user "Alice" should be "<message1>" or "<message2>"
And the value of the item "/d:error/s:exception" in the response about user "Alice" should be "Sabre\DAV\Exception\NotFound"

@skipOnOcV10
Expand Down Expand Up @@ -405,7 +417,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "/test" using the WebDAV API
| propertyName |
| d:getlastmodified |
Then the single response should contain a property "d:getlastmodified" with value like "/^[MTWFS][uedhfriatno]{2},\s(\d){2}\s[JFMAJSOND][anebrpyulgctov]{2}\s\d{4}\s\d{2}:\d{2}:\d{2} GMT$/"
Then the HTTP status code should be "201"
And the single response should contain a property "d:getlastmodified" with value like "/^[MTWFS][uedhfriatno]{2},\s(\d){2}\s[JFMAJSOND][anebrpyulgctov]{2}\s\d{4}\s\d{2}:\d{2}:\d{2} GMT$/"
Examples:
| dav_version |
| old |
Expand All @@ -423,7 +436,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "/test" using the WebDAV API
| propertyName |
| d:getcontenttype |
Then the single response should contain a property "d:getcontenttype" with value ""
Then the HTTP status code should be "201"
And the single response should contain a property "d:getcontenttype" with value ""
Examples:
| dav_version |
| old |
Expand All @@ -441,7 +455,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "file.txt" using the WebDAV API
| propertyName |
| d:getcontenttype |
Then the single response should contain a property "d:getcontenttype" with value "text/plain.*"
Then the HTTP status code should be "201"
And the single response should contain a property "d:getcontenttype" with value "text/plain.*"
Examples:
| dav_version |
| old |
Expand All @@ -459,7 +474,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "file.txt" using the WebDAV API
| propertyName |
| d:getetag |
Then the single response should contain a property "d:getetag" with value like '%\"[a-z0-9:]{1,32}\"%'
Then the HTTP status code should be "201"
And the single response should contain a property "d:getetag" with value like '%\"[a-z0-9:]{1,32}\"%'
Examples:
| dav_version |
| old |
Expand All @@ -477,7 +493,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "file.txt" using the WebDAV API
| propertyName |
| d:resourcetype |
Then the single response should contain a property "d:resourcetype" with value ""
Then the HTTP status code should be "201"
And the single response should contain a property "d:resourcetype" with value ""
Examples:
| dav_version |
| old |
Expand All @@ -495,7 +512,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "file.txt" using the WebDAV API
| propertyName |
| oc:size |
Then the single response should contain a property "oc:size" with value "16"
Then the HTTP status code should be "201"
And the single response should contain a property "oc:size" with value "16"
Examples:
| dav_version |
| old |
Expand All @@ -513,7 +531,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "/test" using the WebDAV API
| propertyName |
| oc:size |
Then the single response should contain a property "oc:size" with value "0"
Then the HTTP status code should be "201"
And the single response should contain a property "oc:size" with value "0"
Examples:
| dav_version |
| old |
Expand All @@ -531,7 +550,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "file.txt" using the WebDAV API
| propertyName |
| oc:fileid |
Then the single response should contain a property "oc:fileid" with value like '/[a-zA-Z0-9]+/'
Then the HTTP status code should be "201"
And the single response should contain a property "oc:fileid" with value like '/[a-zA-Z0-9]+/'
Examples:
| dav_version |
| old |
Expand All @@ -549,7 +569,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "/test" using the WebDAV API
| propertyName |
| oc:fileid |
Then the single response should contain a property "oc:fileid" with value like '/[a-zA-Z0-9]+/'
Then the HTTP status code should be "201"
And the single response should contain a property "oc:fileid" with value like '/[a-zA-Z0-9]+/'
Examples:
| dav_version |
| old |
Expand All @@ -567,7 +588,8 @@ Feature: get file properties
When user "Alice" gets the following properties of file "file.txt" using the WebDAV API
| propertyName |
| oc:owner-display-name |
Then the single response about the file owned by "Alice" should contain a property "oc:owner-display-name" with value "%displayname%"
Then the HTTP status code should be "201"
And the single response about the file owned by "Alice" should contain a property "oc:owner-display-name" with value "%displayname%"
Examples:
| dav_version |
| old |
Expand All @@ -585,7 +607,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "/test" using the WebDAV API
| propertyName |
| oc:owner-display-name |
Then the single response about the file owned by "Alice" should contain a property "oc:owner-display-name" with value "%displayname%"
Then the HTTP status code should be "201"
And the single response about the file owned by "Alice" should contain a property "oc:owner-display-name" with value "%displayname%"
Examples:
| dav_version |
| old |
Expand All @@ -603,7 +626,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "file.txt" using the WebDAV API
| propertyName |
| oc:permissions |
Then the single response should contain a property "oc:permissions" with value like '/RM{0,1}DNVW/'
Then the HTTP status code should be "201"
And the single response should contain a property "oc:permissions" with value like '/RM{0,1}DNVW/'
Examples:
| dav_version |
| old |
Expand All @@ -621,7 +645,8 @@ Feature: get file properties
When user "Alice" gets the following properties of folder "/test" using the WebDAV API
| propertyName |
| oc:permissions |
Then the single response should contain a property "oc:permissions" with value like '/RM{0,1}DNVCK/'
Then the HTTP status code should be "201"
And the single response should contain a property "oc:permissions" with value like '/RM{0,1}DNVCK/'
Examples:
| dav_version |
| old |
Expand Down
31 changes: 31 additions & 0 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,37 @@ public function userUsingPasswordShouldNotBeAbleToDownloadFile(
);
}

/**
* @Then /^user "([^"]*)" should not be able to download file "([^"]*)"$/
*
* @param string $user
* @param string $fileName
*
* @return void
* @throws JsonException
*/
public function userShouldNotBeAbleToDownloadFile(
string $user,
string $fileName
):void {
$user = $this->getActualUsername($user);
$password = $this->getPasswordForUser($user);
$this->downloadFileAsUserUsingPassword($user, $fileName, $password);
Assert::assertGreaterThanOrEqual(
400,
$this->getResponse()->getStatusCode(),
__METHOD__
. ' download must fail'
);
Assert::assertLessThanOrEqual(
499,
$this->getResponse()->getStatusCode(),
__METHOD__
. ' 4xx error expected but got status code "'
. $this->getResponse()->getStatusCode() . '"'
);
}

/**
* @Then /^user "([^"]*)" should be able to access a skeleton file$/
*
Expand Down