test: fix COPY to mountpoint tests

test: adjust COPY file test
This commit is contained in:
Saw-jan
2024-08-07 16:34:44 +05:45
parent a381a3a0e8
commit 05e6a435a2
4 changed files with 98 additions and 51 deletions

View File

@@ -953,7 +953,7 @@ class GraphHelper {
array $body = [],
array $headers = []
): ResponseInterface {
$url = self::getFullUrl($baseUrl, 'me/drives/' . $urlArguments);
$url = self::getFullUrl($baseUrl, 'me/drives' . $urlArguments);
return HttpRequestHelper::get($url, $xRequestId, $user, $password, $headers, $body);
}

View File

@@ -6,16 +6,6 @@ The expected failures in this file are from features in the owncloud/ocis repo.
Basic file management like up and download, move, copy, properties, trash, versions and chunking.
#### [COPY a folder to received share file/folder seems to work but no change in shares](https://github.com/owncloud/ocis/issues/6999)
- [coreApiWebdavProperties/copyFile.feature:286](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L286)
- [coreApiWebdavProperties/copyFile.feature:287](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L287)
- [coreApiWebdavProperties/copyFile.feature:310](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L310)
- [coreApiWebdavProperties/copyFile.feature:311](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L311)
- [coreApiWebdavProperties/copyFile.feature:484](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L484)
- [coreApiWebdavProperties/copyFile.feature:485](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L485)
- [coreApiWebdavProperties/copyFile.feature:486](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L486)
#### [Custom dav properties with namespaces are rendered incorrectly](https://github.com/owncloud/ocis/issues/2140)
_ocdav: double-check the webdav property parsing when custom namespaces are used_
@@ -172,14 +162,6 @@ And other missing implementation of favorites
- [coreApiWebdavUploadTUS/optionsRequest.feature:40](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/optionsRequest.feature#L40)
- [coreApiWebdavUploadTUS/optionsRequest.feature:55](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUploadTUS/optionsRequest.feature#L55)
#### [copying the file inside Shares folder returns 412](https://github.com/owncloud/ocis/issues/3874)
- [coreApiWebdavProperties/copyFile.feature:240](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L240)
- [coreApiWebdavProperties/copyFile.feature:241](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L241)
- [coreApiWebdavProperties/copyFile.feature:457](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L457)
- [coreApiWebdavProperties/copyFile.feature:458](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L458)
- [coreApiWebdavProperties/copyFile.feature:459](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L459)
### Won't fix
Not everything needs to be implemented for ocis. While the oc10 testsuite covers these things we are not looking at them right now.
@@ -233,9 +215,9 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers
### [COPY file/folder to same name is possible (but 500 code error for folder with spaces path)](https://github.com/owncloud/ocis/issues/8711)
- [coreApiSharePublicLink2/copyFromPublicLink.feature:198](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature#L198)
- [coreApiWebdavProperties/copyFile.feature:1064](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1064)
- [coreApiWebdavProperties/copyFile.feature:1065](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1065)
- [coreApiWebdavProperties/copyFile.feature:1066](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1066)
- [coreApiWebdavProperties/copyFile.feature:1071](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1071)
- [coreApiWebdavProperties/copyFile.feature:1072](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1072)
- [coreApiWebdavProperties/copyFile.feature:1073](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1073)
Note: always have an empty line at the end of this file.
The bash script that processes this file requires that the last line has a newline on the end.

View File

@@ -1666,4 +1666,62 @@ class SharingNgContext implements Context {
public function userRemovesTheLastLinkShareOfSpaceUsingPermissionsEndpointOfGraphApi(string $user, string $space):void {
$this->featureContext->setResponse($this->removeAccessToSpaceItem($user, 'link', $space, ''));
}
/**
* @param string $share
* @param string $sharee
* @param string $sharer
*
* @return void
* @throws GuzzleException
* @throws JsonException
* @throws Exception
*/
public function checkIfShareExists(string $share, string $sharee, string $sharer): void {
// check share mountpoint
$response = GraphHelper::getMySpaces(
$this->featureContext->getBaseUrl(),
$sharee,
$this->featureContext->getPasswordForUser($sharee),
"",
$this->featureContext->getStepLineRef()
);
$driveList = HttpRequestHelper::getJsonDecodedResponseBodyContent($response)->value;
$foundShareMountpoint = false;
foreach ($driveList as $drive) {
if ($drive->driveType === "mountpoint" && $drive->name === $share && $drive->root->remoteItem->driveAlias === "personal/" . \strtolower($sharer)) {
$foundShareMountpoint = true;
}
}
Assert::assertTrue($foundShareMountpoint, "Share mountpoint '$share' was not found in the drives list.");
// check share in shared-with-me list
$response = GraphHelper::getSharesSharedWithMe(
$this->featureContext->getBaseUrl(),
$this->featureContext->getStepLineRef(),
$sharee,
$this->featureContext->getPasswordForUser($sharee)
);
$sharedWithMeList = HttpRequestHelper::getJsonDecodedResponseBodyContent($response)->value;
$foundShareInSharedWithMe = false;
foreach ($sharedWithMeList as $item) {
if ($item->name === $share && $item->createdBy->user->displayName === $this->featureContext->getDisplayNameForUser($sharer)) {
$foundShareInSharedWithMe = true;
}
}
Assert::assertTrue($foundShareInSharedWithMe, "Share '$share' was not found in the shared-with-me list");
}
/**
* @Then user :sharee should have a share :share shared by user :sharer
*
* @param string $sharee
* @param string $share
* @param string $sharer
*
* @return void
*/
public function userShouldHaveShare(string $sharee, string $share, string $sharer): void {
$this->checkIfShareExists($share, $sharee, $sharer);
}
}

View File

@@ -216,7 +216,7 @@ Feature: copy file
| new |
| spaces |
@issue-1239 @issue-3874 @skipOnReva
@issue-1239 @issue-3874 @issue-9753 @skipOnReva
Scenario Outline: copy a file over the top of an existing folder received as a user share
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
@@ -230,17 +230,18 @@ Feature: copy file
| permissionsRole | Editor |
And user "Alice" has a share "BRIAN-Folder" synced
When user "Alice" copies file "/textfile1.txt" to "/Shares/BRIAN-Folder" using the WebDAV API
Then the HTTP status code should be "204"
And the content of file "/Shares/BRIAN-Folder" for user "Alice" should be "ownCloud test text file 1"
And as "Alice" folder "/Shares/BRIAN-Folder/sample-folder" should not exist
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 "Alice" file "/Shares/BRIAN-Folder" should not exist
And user "Alice" should have a share "BRIAN-Folder" shared by user "Brian"
And as "Brian" folder "BRIAN-Folder" should exist
Examples:
| dav-path-version |
| old |
| new |
| spaces |
@skipOnReva
@skipOnReva @issue-9753
Scenario Outline: copy a file over the top of an existing file received as a share
Given using <dav-path-version> DAV path
And user "Alice" has uploaded file with content "file to copy" to "copy.txt"
@@ -256,14 +257,15 @@ Feature: copy file
When user "Alice" copies file "copy.txt" to "Shares/lorem.txt" using the WebDAV API
Then the HTTP status code should be "204"
And the content of file "Shares/lorem.txt" for user "Alice" should be "file to copy"
And user "Alice" should have a share "lorem.txt" shared by user "Brian"
And the content of file "lorem.txt" for user "Brian" should be "file to copy"
And as "Brian" file "lorem.txt" should exist
Examples:
| dav-path-version |
| old |
| new |
| spaces |
@issue-1239 @issue-6999 @skipOnReva
@issue-1239 @issue-6999 @issue-9753 @skipOnReva
Scenario Outline: copy a folder over the top of an existing file received as a user share
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
@@ -277,16 +279,18 @@ Feature: copy file
And user "Alice" has a share "sharedfile1.txt" synced
And user "Alice" has created folder "FOLDER/sample-folder"
When user "Alice" copies folder "/FOLDER" to "/Shares/sharedfile1.txt" using the WebDAV API
Then the HTTP status code should be "204"
And as "Alice" folder "/FOLDER/sample-folder" should exist
And as "Alice" folder "/Shares/sharedfile1.txt/sample-folder" should exist
And user "Alice" should not have any received shares
Then the HTTP status code should be "400"
And the content of file "Shares/sharedfile1.txt" for user "Alice" should be "file to share"
And as "Alice" folder "/Shares/sharedfile1.txt" should not exist
And user "Alice" should have a share "sharedfile1.txt" shared by user "Brian"
And the content of file "sharedfile1.txt" for user "Brian" should be "file to share"
Examples:
| dav-path-version |
| old |
| new |
| spaces |
@issue-6999 @skipOnReva
@issue-6999 @issue-9753 @skipOnReva
Scenario Outline: copy a folder over the top of an existing folder received as a share
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
@@ -301,14 +305,16 @@ Feature: copy file
And user "Alice" has a share "BRIAN-Folder" synced
And user "Alice" has created folder "FOLDER/alice-folder"
When user "Alice" copies folder "FOLDER" to "Shares/BRIAN-Folder" using the WebDAV API
Then the HTTP status code should be "204"
And as "Alice" folder "FOLDER/alice-folder" should exist
And as "Alice" folder "Shares/BRIAN-Folder/alice-folder" should exist
And as "Alice" folder "Shares/BRIAN-Folder/brian-folder" should not exist
Then the HTTP status code should be "400"
And as "Alice" folder "Shares/BRIAN-Folder/brian-folder" should exist
And as "Alice" folder "Shares/BRIAN-Folder/alice-folder" should not exist
And user "Alice" should have a share "BRIAN-Folder" shared by user "Brian"
And as "Brian" folder "BRIAN-Folder" should exist
Examples:
| dav-path-version |
| old |
| new |
| spaces |
@issue-1239 @skipOnReva
Scenario Outline: copy a folder into another folder at different level which is received as a user share
@@ -430,7 +436,7 @@ Feature: copy file
| old |
| new |
@issue-1239 @skipOnReva
@issue-1239 @issue-9753 @skipOnReva
Scenario Outline: copy a file over the top of an existing folder received as a group share
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
@@ -447,18 +453,18 @@ Feature: copy file
| permissionsRole | Editor |
And user "Alice" has a share "BRIAN-Folder" synced
When user "Alice" copies file "/textfile1.txt" to "/Shares/BRIAN-Folder" using the WebDAV API
Then the HTTP status code should be "204"
And the content of file "/Shares/BRIAN-Folder" for user "Alice" should be "ownCloud test text file 1"
And as "Alice" folder "/Shares/BRIAN-Folder/sample-folder" should not exist
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 "Alice" file "/Shares/BRIAN-Folder" should not exist
And user "Alice" should have a share "BRIAN-Folder" shared by user "Brian"
And as "Brian" folder "BRIAN-Folder/sample-folder" should exist
Examples:
| dav-path-version |
| old |
| new |
| spaces |
@issue-1239 @skipOnReva
@issue-1239 @issue-6999 @issue-9753 @skipOnReva
Scenario Outline: copy a folder over the top of an existing file received as a group share
Given using <dav-path-version> DAV path
And user "Brian" has been created with default attributes and without skeleton files
@@ -475,10 +481,11 @@ Feature: copy file
And user "Alice" has a share "sharedfile1.txt" synced
And user "Alice" has created folder "FOLDER/sample-folder"
When user "Alice" copies folder "/FOLDER" to "/Shares/sharedfile1.txt" using the WebDAV API
Then the HTTP status code should be "204"
And as "Alice" folder "/FOLDER/sample-folder" should exist
And as "Alice" folder "/Shares/sharedfile1.txt/sample-folder" should exist
And user "Alice" should not have any received shares
Then the HTTP status code should be "400"
And as "Alice" file "/Shares/sharedfile1.txt" should exist
And as "Alice" folder "/Shares/sharedfile1.txt" should not exist
And user "Alice" should have a share "sharedfile1.txt" shared by user "Brian"
And as "Brian" file "sharedfile1.txt" should exist
Examples:
| dav-path-version |
| old |