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] Add api tests for listing files with propfind #38995

Merged
merged 5 commits into from
Jul 19, 2021
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
7 changes: 7 additions & 0 deletions tests/TestHelpers/WebDavHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,13 @@ public static function makeDavRequest(
$user = null;
$password = null;
}
if ($type === "public-files-new") {
if ($password === null || $password === "") {
$user = null;
} else {
$user = "public";
}
}
$config = null;
if ($sourceIpAddress !== null) {
$config = [ 'curl' => [ CURLOPT_INTERFACE => $sourceIpAddress ]];
Expand Down
1 change: 1 addition & 0 deletions tests/acceptance/config/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ default:
- PublicWebDavContext:
- WebDavPropertiesContext:
- TagsContext:
- TrashbinContext:

apiWebdavPreviews:
paths:
Expand Down
10 changes: 5 additions & 5 deletions tests/acceptance/features/apiMain/checksums.feature
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Feature: checksums
Then as user "Alice" the webdav checksum of "/myChecksumFile.txt" via propfind should match "SHA1:ce5582148c6f0c1282335b87df5ed4be4b781399 MD5:56e57920c3c8c727bfe7a5288cdf61c4 ADLER32:1048035a"

@issue-ocis-reva-56
Scenario: Upload new dav chunked file where checksum matches
Scenario: Upload new DAV chunked file where checksum matches
Given using new DAV path
When user "Alice" creates a new chunking upload with id "chunking-42" using the WebDAV API
And user "Alice" uploads new chunk file "2" with "BBBBB" to id "chunking-42" using the WebDAV API
Expand All @@ -150,7 +150,7 @@ Feature: checksums
Then the HTTP status code should be "201"

@issue-ocis-reva-56
Scenario: Upload new dav chunked file where checksum does not match
Scenario: Upload new DAV chunked file where checksum does not match
Given using new DAV path
When user "Alice" creates a new chunking upload with id "chunking-42" using the WebDAV API
And user "Alice" uploads new chunk file "2" with "BBBBB" to id "chunking-42" using the WebDAV API
Expand All @@ -161,7 +161,7 @@ Feature: checksums
| /myChunkedFile.txt |

@issue-ocis-reva-56 @notToImplementOnOCIS
Scenario: Upload new dav chunked file using async MOVE where checksum matches
Scenario: Upload new DAV chunked file using async MOVE where checksum matches
Given using new DAV path
And the administrator has enabled async operations
When user "Alice" creates a new chunking upload with id "chunking-42" using the WebDAV API
Expand All @@ -177,7 +177,7 @@ Feature: checksums
And the content of file "/myChunkedFile.txt" for user "Alice" should be "BBBBBCCCCC"

@issue-ocis-reva-56 @notToImplementOnOCIS
Scenario: Upload new dav chunked file using async MOVE where checksum does not match
Scenario: Upload new DAV chunked file using async MOVE where checksum does not match
Given using new DAV path
And the administrator has enabled async operations
When user "Alice" creates a new chunking upload with id "chunking-42" using the WebDAV API
Expand All @@ -195,7 +195,7 @@ Feature: checksums
| /myChunkedFile.txt |

@issue-ocis-reva-56 @notToImplementOnOCIS
Scenario: Upload new dav chunked file using async MOVE where checksum does not match - retry with correct checksum
Scenario: Upload new DAV chunked file using async MOVE where checksum does not match - retry with correct checksum
Given using new DAV path
And the administrator has enabled async operations
When user "Alice" creates a new chunking upload with id "chunking-42" using the WebDAV API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ Feature: Sharing resources with different case names with the sharee and checkin
Scenario: sharing file with group members that has existing folders with different case names
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
Given user "Alice" has uploaded the following files with content "some data"
And user "Alice" has uploaded the following files with content "some data"
| path |
| casesensitive.txt |
| case_sensitive.txt |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Feature: Sharing resources with different case names with the sharee and checkin
Scenario: sharing folders with different case names with group members
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
Given user "Alice" has created the following folders
And user "Alice" has created the following folders
| path |
| /FO |
| /F_O |
Expand Down Expand Up @@ -238,7 +238,7 @@ Feature: Sharing resources with different case names with the sharee and checkin
Scenario: sharing files and folders with different case names with group members
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
Given user "Alice" has uploaded the following files with content "some data"
And user "Alice" has uploaded the following files with content "some data"
| path |
| casesensitive.txt |
| case_sensitive.txt |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ Feature: move (rename) file
#so we timout the request and chech the job-status
Given user "Alice" has uploaded file "filesForUpload/textfile.txt" to "fileToMove.txt"
And the HTTP-Request-timeout is set to 5 seconds
And the MOVE dav requests are slowed down by 10 seconds
And the MOVE DAV requests are slowed down by 10 seconds
When user "Alice" moves file "/fileToMove.txt" asynchronously to "/textfile0.txt" using the WebDAV API
Then the HTTP status code should be "202"
And the following headers should match these regular expressions for user "Alice"
Expand Down
224 changes: 224 additions & 0 deletions tests/acceptance/features/apiWebdavOperations/listFiles.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
@api
Feature: list files
As a user
I want to be able to list my files and folders (resources)
So that I can understand my file structure in owncloud

Background:
Given user "Alice" has been created with default attributes and without skeleton files
And user "Alice" has created the following folders
| path |
| simple-folder |
| simple-folder/simple-folder1 |
| simple-folder/simple-empty-folder |
| simple-folder/simple-folder1/simple-folder2 |
And user "Alice" has uploaded the following files with content "simple-test-content"
| path |
| textfile0.txt |
| welcome.txt |
| simple-folder/textfile0.txt |
| simple-folder/welcome.txt |
| simple-folder/simple-folder1/textfile0.txt |
| simple-folder/simple-folder1/welcome.txt |
| simple-folder/simple-folder1/simple-folder2/textfile0.txt |
| simple-folder/simple-folder1/simple-folder2/welcome.txt |


Scenario Outline: Get the list of resources in the root folder
Given using <dav_version> DAV path
When user "Alice" lists the resources in "/" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the last DAV response for user "Alice" should not contain these nodes
| name |
| textfile0.txt |
| welcome.txt |
| simple-folder/ |
| simple-folder/welcome.txt |
| simple-folder/textfile0.txt |
| simple-folder/simple-empty-folder |
| simple-folder/simple-folder1 |
When user "Alice" lists the resources in "/" with depth 1 using the WebDAV API
Then the HTTP status code should be "207"
And the last DAV response for user "Alice" should contain these nodes
| name |
| textfile0.txt |
| welcome.txt |
| simple-folder/ |
And the last DAV response for user "Alice" should not contain these nodes
| name |
| simple-folder/welcome.txt |
| simple-folder/textfile0.txt |
| simple-folder/simple-empty-folder |
| simple-folder/simple-folder1 |
When user "Alice" lists the resources in "/" with depth "infinity" using the WebDAV API
Then the HTTP status code should be "207"
And the last DAV response for user "Alice" should contain these nodes
| name |
| textfile0.txt |
| welcome.txt |
| simple-folder/ |
| simple-folder/textfile0.txt |
| simple-folder/welcome.txt |
| simple-folder/simple-folder1/ |
| simple-folder/simple-folder1/simple-folder2 |
| simple-folder/simple-folder1/textfile0.txt |
| simple-folder/simple-folder1/welcome.txt |
| simple-folder/simple-folder1/simple-folder2/textfile0.txt |
| simple-folder/simple-folder1/simple-folder2/welcome.txt |
Examples:
| dav_version |
| old |
| new |


Scenario Outline: Get the list of resources in a folder
Given using <dav_version> DAV path
When user "Alice" lists the resources in "/simple-folder" with depth "0" using the WebDAV API
Then the HTTP status code should be "207"
And the last DAV response for user "Alice" should contain these nodes
| name |
| simple-folder/ |
And the last DAV response for user "Alice" should not contain these nodes
| name |
| simple-folder/welcome.txt |
| simple-folder/textfile0.txt |
| simple-folder/simple-empty-folder |
| simple-folder/simple-folder1 |
When user "Alice" lists the resources in "/simple-folder" with depth 1 using the WebDAV API
Then the HTTP status code should be "207"
And the last DAV response for user "Alice" should contain these nodes
| name |
| simple-folder/welcome.txt |
| simple-folder/textfile0.txt |
| simple-folder/simple-empty-folder |
| simple-folder/simple-folder1 |
And the last DAV response for user "Alice" should not contain these nodes
| name |
| simple-folder/simple-folder1/simple-folder2 |
| simple-folder/simple-folder1/textfile0.txt |
| simple-folder/simple-folder1/welcome.txt |
| simple-folder/simple-folder1/simple-folder2/textfile0.txt |
| simple-folder/simple-folder1/simple-folder2/welcome.txt |
When user "Alice" lists the resources in "/simple-folder" with depth "infinity" using the WebDAV API
Then the HTTP status code should be "207"
And the last DAV response for user "Alice" should contain these nodes
| name |
| /simple-folder/textfile0.txt |
| /simple-folder/welcome.txt |
| /simple-folder/simple-folder1/ |
| simple-folder/simple-folder1/simple-folder2 |
| simple-folder/simple-folder1/textfile0.txt |
| simple-folder/simple-folder1/welcome.txt |
| simple-folder/simple-folder1/simple-folder2/textfile0.txt |
| simple-folder/simple-folder1/simple-folder2/welcome.txt |
Examples:
| dav_version |
| old |
| new |


Scenario Outline: Get the list of resources in a folder shared through public link
Given using <dav_version> DAV path
And user "Alice" has created the following folders
| path |
| /simple-folder/simple-folder1/simple-folder2/simple-folder3 |
| /simple-folder/simple-folder1/simple-folder2/simple-folder3/simple-folder4 |
And user "Alice" has created a public link share of folder "simple-folder"
When the public lists the resources in the last created public link with depth 0 using the WebDAV API
Then the HTTP status code should be "207"
And the last public link DAV response should not contain these nodes
| name |
| /textfile0.txt |
| /welcome.txt |
| /simple-folder1/ |
| /simple-folder1/welcome.txt |
| /simple-folder1/simple-folder2 |
| /simple-folder1/textfile0.txt |
| /simple-folder1/simple-folder2/textfile0.txt |
| /simple-folder1/simple-folder2/welcome.txt |
| /simple-folder1/simple-folder2/simple-folder3 |
| /simple-folder1/simple-folder2/simple-folder3/simple-folder4 |
When the public lists the resources in the last created public link with depth 1 using the WebDAV API
Then the HTTP status code should be "207"
And the last public link DAV response should contain these nodes
| name |
| /textfile0.txt |
| /welcome.txt |
| /simple-folder1/ |
And the last public link DAV response should not contain these nodes
| name |
| /simple-folder1/simple-folder2/textfile0.txt |
| /simple-folder1/simple-folder2/welcome.txt |
| /simple-folder1/simple-folder2/simple-folder3 |
| /simple-folder1/welcome.txt |
| /simple-folder1/simple-folder2 |
| /simple-folder1/textfile0.txt |
| /simple-folder1/simple-folder2/simple-folder3/simple-folder4 |
When the public lists the resources in the last created public link with depth infinity using the WebDAV API
Then the HTTP status code should be "207"
And the last public link DAV response should contain these nodes
| name |
| /textfile0.txt |
| /welcome.txt |
| /simple-folder1/ |
| /simple-folder1/welcome.txt |
| /simple-folder1/simple-folder2 |
| /simple-folder1/textfile0.txt |
| /simple-folder1/simple-folder2/textfile0.txt |
| /simple-folder1/simple-folder2/welcome.txt |
| /simple-folder1/simple-folder2/simple-folder3 |
| /simple-folder1/simple-folder2/simple-folder3/simple-folder4 |
Examples:
| dav_version |
| old |
| new |


Scenario: Get the list of files in a folder in the trashbin
Given using new DAV path
And user "Alice" has deleted the following resources
| path |
| textfile0.txt |
| welcome.txt |
| simple-folder/ |
When user "Alice" lists the resources in the trashbin path "/" with depth 0 using the WebDAV API
Then the HTTP status code should be "207"
And the trashbin DAV response should not contain these nodes
| name |
| textfile0.txt |
| welcome.txt |
| simple-folder/ |
| simple-folder/textfile0.txt |
| simple-folder/welcome.txt |
| simple-folder/simple-folder1/textfile0.txt |
| simple-folder/simple-folder1/welcome.txt |
| simple-folder/simple-folder1/simple-folder2/textfile0.txt |
| simple-folder/simple-folder1/simple-folder2/welcome.txt |
When user "Alice" lists the resources in the trashbin path "/" with depth 1 using the WebDAV API
Then the HTTP status code should be "207"
And the trashbin DAV response should contain these nodes
| name |
| textfile0.txt |
| welcome.txt |
| simple-folder/ |
And the trashbin DAV response should not contain these nodes
| name |
| simple-folder/textfile0.txt |
| simple-folder/welcome.txt |
| simple-folder/simple-folder1/textfile0.txt |
| simple-folder/simple-folder1/welcome.txt |
| simple-folder/simple-folder1/simple-folder2/textfile0.txt |
| simple-folder/simple-folder1/simple-folder2/welcome.txt |
When user "Alice" lists the resources in the trashbin path "/" with depth infinity using the WebDAV API
Then the HTTP status code should be "207"
And the trashbin DAV response should contain these nodes
| name |
| textfile0.txt |
| welcome.txt |
| simple-folder/ |
| simple-folder/textfile0.txt |
| simple-folder/welcome.txt |
| simple-folder/simple-folder1/textfile0.txt |
| simple-folder/simple-folder1/welcome.txt |
| simple-folder/simple-folder1/simple-folder2/textfile0.txt |
| simple-folder/simple-folder1/simple-folder2/welcome.txt |
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature: refuse access
@smokeTest
Scenario Outline: Unauthenticated call
Given using <dav_version> DAV path
When an unauthenticated client connects to the dav endpoint using the WebDAV API
When an unauthenticated client connects to the DAV endpoint using the WebDAV API
Then the HTTP status code should be "401"
And there should be no duplicate headers
And the following headers should be set
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Feature: upload file using new chunking
Then the HTTP status code should be "404"


Scenario: Upload to new dav path using old way should fail
Scenario: Upload to new DAV path using old way should fail
When user "Alice" uploads chunk file "1" of "3" with "AAAAA" to "/myChunkedFile.txt" using the WebDAV API
Then the HTTP status code should be "503"

Expand Down
14 changes: 13 additions & 1 deletion tests/acceptance/features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -2786,6 +2786,14 @@ public function substituteInLineCodes(
"getLastShareId"
],
"parameter" => []
],
[
"code" => "%last_share_token%",
"function" => [
$this,
"getLastSharetoken"
],
"parameter" => []
]
];
if ($user !== null) {
Expand Down Expand Up @@ -2831,6 +2839,10 @@ public function substituteInLineCodes(
}

foreach ($substitutions as $substitution) {
if (strpos($value, $substitution['code']) === false) {
continue;
}

$replacement = \call_user_func_array(
$substitution["function"],
$substitution["parameter"]
Expand Down Expand Up @@ -3663,7 +3675,7 @@ function ($a, $b) {
$davPath = \rtrim($this->getFullDavFilesPath($targetUser), '/');

$foundPath = \end($foundPaths)['path'];
// strip dav path
// strip DAV path
return \substr($foundPath, \strlen($davPath) + 1);
}

Expand Down
Loading