test: fix COPY to mountpoint tests

test: adjust COPY file test
This commit is contained in:
Saw-jan
2024-08-12 14:30:16 +05:45
parent a381a3a0e8
commit 05e6a435a2
4 changed files with 98 additions and 51 deletions
@@ -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);
}
}
@@ -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 |