test: fix COPY to mountpoint tests

This commit is contained in:
Saw-jan
2024-08-20 18:12:41 +05:45
parent d45efeacca
commit 29b9f9b07d
4 changed files with 19 additions and 21 deletions

View File

@@ -13,11 +13,6 @@ The expected failures in this file are from features in the owncloud/ocis repo.
- [apiArchiver/downloadByPath.feature:171](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiArchiver/downloadByPath.feature#L171)
- [apiArchiver/downloadByPath.feature:172](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiArchiver/downloadByPath.feature#L172)
#### [Shared mount folder gets deleted when overwritten by a file from personal space](https://github.com/owncloud/ocis/issues/7208)
- [apiSpacesShares/copySpaces.feature:696](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L696)
- [apiSpacesShares/copySpaces.feature:715](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L715)
#### [PATCH request for TUS upload with wrong checksum gives incorrect response](https://github.com/owncloud/ocis/issues/1755)
- [apiSpacesShares/shareUploadTUS.feature:283](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareUploadTUS.feature#L283)

View File

@@ -13,7 +13,7 @@ Feature: download multiple resources bundled into an archive
@issue-4637
Scenario Outline: download a single file
Given user "Alice" has uploaded file with content "some data" to "/textfile0.txt"
When user "Alice" downloads the archive of "/home/textfile0.txt" using the resource path and setting these headers
When user "Alice" downloads the <archive-type> archive of "/home/textfile0.txt" using the resource path and setting these headers:
| header | value |
| User-Agent | <user-agent> |
Then the HTTP status code should be "200"
@@ -30,7 +30,7 @@ Feature: download multiple resources bundled into an archive
Given user "Alice" has created folder "my_data"
And user "Alice" has uploaded file with content "some data" to "/my_data/textfile0.txt"
And user "Alice" has uploaded file with content "more data" to "/my_data/an_other_file.txt"
When user "Alice" downloads the archive of "/home/my_data" using the resource path and setting these headers
When user "Alice" downloads the <archive-type> archive of "/home/my_data" using the resource path and setting these headers:
| header | value |
| User-Agent | <user-agent> |
Then the HTTP status code should be "200"
@@ -156,7 +156,7 @@ Feature: download multiple resources bundled into an archive
| shareType | user |
| permissionsRole | Viewer |
And user "Brian" has a share "more_data" synced
When user "Brian" downloads the archive of "/home/Shares" using the resource path and setting these headers
When user "Brian" downloads the <archive-type> archive of "/home/Shares" using the resource path and setting these headers:
| header | value |
| User-Agent | <user-agent> |
Then the HTTP status code should be "200"

View File

@@ -706,10 +706,12 @@ Feature: copy file
| permissionsRole | Editor |
And user "Alice" has a share "BRIAN-Folder" synced
When user "Alice" copies file "/textfile1.txt" from space "Personal" to "/BRIAN-Folder" inside space "Shares" using the WebDAV API
Then the HTTP status code should be "204"
And for user "Alice" the content of the file "/BRIAN-Folder" of the space "Shares" should be "ownCloud test text file 1"
And as "Alice" file "/textfile1.txt" should exist
And user "Alice" should not have any received shares
Then the HTTP status code should be "400"
And as "Alice" folder "Shares/BRIAN-Folder/sample-folder" should exist
And as "Brian" folder "BRIAN-Folder/sample-folder" should exist
But as "Alice" file "Shares/BRIAN-Folder" should not exist
And as "Alice" file "Shares/textfile1.txt" should not exist
And user "Alice" should have a share "BRIAN-Folder" shared by user "Brian"
@issue-7208
Scenario: copy a folder over the top of an existing file received as a user share
@@ -725,11 +727,11 @@ Feature: copy file
| permissionsRole | File Editor |
And user "Alice" has a share "sharedfile1.txt" synced
When user "Alice" copies folder "/FOLDER" from space "Personal" to "/sharedfile1.txt" inside space "Shares" using the WebDAV API
Then the HTTP status code should be "204"
And as "Alice" folder "/FOLDER/sample-folder" should exist
And for user "Alice" folder "/sharedfile1.txt" of the space "Shares" should contain these files:
| /sample-folder |
And user "Alice" should not have any received shares
Then the HTTP status code should be "400"
And for user "Alice" the content of the file "sharedfile1.txt" of the space "Shares" should be "file to share"
And for user "Brian" the content of the file "sharedfile1.txt" of the space "Personal" should be "file to share"
But as "Alice" folder "Shares/FOLDER/sample-folder" should not exist
And user "Alice" should have a share "sharedfile1.txt" shared by user "Brian"
Scenario: copy a folder into another folder at different level which is received as a user share

View File

@@ -86,12 +86,13 @@ class ArchiverContext implements Context {
* @return void
*/
public function removeDir(string $dir): void {
$items = \glob("$dir/*");
$items = array_diff(scandir($dir), ['.', '..']);
foreach ($items as $item) {
if (\is_dir($item)) {
$this->removeDir($item);
$itemPath = $dir . DIRECTORY_SEPARATOR . $item;
if (\is_dir($itemPath)) {
$this->removeDir($itemPath);
} else {
\unlink($item);
\unlink($itemPath);
}
}
\rmdir($dir);