Merge pull request #10652 from owncloud/tests/cleanup-n-fixes

[tests-only][full-ci] test code fixes and cleanup
This commit is contained in:
Sawjan Gurung
2024-11-27 16:57:00 +05:45
committed by GitHub
12 changed files with 86 additions and 81 deletions

View File

@@ -800,7 +800,7 @@ class GraphContext implements Context {
* @return void
*/
public function theUserTriesToAddAnotherUserToGroupUsingTheGraphAPI(string $byUser, string $user, string $group): void {
$this->featureContext->setResponse($this->addUserToGroup($group, $byUser, $user));
$this->featureContext->setResponse($this->addUserToGroup($group, $user, $byUser));
}
/**

View File

@@ -1858,7 +1858,7 @@ trait Sharing {
}
/**
* @Then the information about the last share for user :user should include
* @Then as user :user the last share should include the following properties:
*
* @param string $user
* @param TableNode $table
@@ -1868,8 +1868,24 @@ trait Sharing {
*/
public function userGetsTheLastShareSharedWithHimUsingTheSharingApi(string $user, TableNode $table):void {
$user = $this->getActualUsername($user);
$shareId = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId();
$response = $this->getShareData($user, $shareId);
$this->verifyTableNodeRows($table, [], $this->shareResponseFields);
$share_id = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId();
$response = $this->getShareData($user, $share_id);
$this->theHTTPStatusCodeShouldBe(
200,
"Error getting info of last share for user $user",
$response
);
$this->ocsContext->assertOCSResponseIndicatesSuccess(
__METHOD__ .
' Error getting info of last share for user $user\n' .
$this->ocsContext->getOCSResponseStatusMessage(
$response
) . '"',
$response
);
$this->checkTheFields($user, $table, $response);
}
@@ -2031,39 +2047,6 @@ trait Sharing {
$this->setResponse($this->getAllShares($user, "?path=$path&subfiles=true"));
}
/**
* @Then /^the response when user "([^"]*)" gets the info of the last share should include$/
*
* @param string $user
* @param TableNode|null $body
*
* @return void
* @throws Exception
*/
public function theResponseWhenUserGetsInfoOfLastShareShouldInclude(
string $user,
?TableNode $body
):void {
$user = $this->getActualUsername($user);
$this->verifyTableNodeRows($body, [], $this->shareResponseFields);
$share_id = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedUserGroupShareID() : $this->getLastCreatedUserGroupShareId();
$response = $this->getShareData($user, $share_id);
$this->theHTTPStatusCodeShouldBe(
200,
"Error getting info of last share for user $user",
$response
);
$this->ocsContext->assertOCSResponseIndicatesSuccess(
__METHOD__ .
' Error getting info of last share for user $user\n' .
$this->ocsContext->getOCSResponseStatusMessage(
$response
) . '"',
$response
);
$this->checkTheFields($user, $body, $response);
}
/**
* @Then /^the response when user "([^"]*)" gets the info of the last public link share should include$/
*

View File

@@ -872,7 +872,7 @@ class TrashbinContext implements Context {
* @return ResponseInterface
* @throws Exception
*/
public function restoreFileWithoutDestination(string $user, string $originalPath):ResponseInterface {
public function userRestoresResourceWithOriginalPathWithoutSpecifyingDestinationUsingTrashbinApi(string $user, string $originalPath):ResponseInterface {
$asUser = $asUser ?? $user;
$listing = $this->listTrashbinFolder($user);
$originalPath = \trim($originalPath, '/');

View File

@@ -82,6 +82,27 @@ trait WebDav {
*/
private bool $davPropfindDepthInfinityEnabled = false;
private array $filePreviews = [];
/**
* @param string $user
*
* @return string
*/
public function getFilePreviewContent(string $user): string {
return $this->filePreviews[$user];
}
/**
* @param string $user
* @param string $previewContent
*
* @return void
*/
public function setFilePreviewContent(string $user, string $previewContent): void {
$this->filePreviews[$user] = $previewContent;
}
/**
* @return void
*/
@@ -3767,7 +3788,7 @@ trait WebDav {
$this->checkImageDimensions($width, $height);
$response->getBody()->rewind();
// save response to user response dictionary for further comparisons
$this->userResponseBodyContents[$user] = $response->getBody()->getContents();
$this->setFilePreviewContent($user, $response->getBody()->getContents());
}
/**
@@ -3793,11 +3814,11 @@ trait WebDav {
$newResponseBodyContents,
// different users can download files before and after an update is made to a file
// previous response content is fetched from the user response body content array entry for that user
$this->userResponseBodyContents[$user],
$this->getFilePreviewContent($user),
__METHOD__ . " previous and current previews content is same but expected to be different",
);
// update the saved content for the next comparison
$this->userResponseBodyContents[$user] = $newResponseBodyContents;
$this->setFilePreviewContent($user, $newResponseBodyContents);
}
/**
@@ -3979,7 +4000,7 @@ trait WebDav {
$this->checkImageDimensions($width, $height, $response);
$response->getBody()->rewind();
// save response to user response dictionary for further comparisons
$this->userResponseBodyContents[$user] = $response->getBody()->getContents();
$this->setFilePreviewContent($user, $response->getBody()->getContents());
}
/**
@@ -4006,11 +4027,11 @@ trait WebDav {
$newResponseBodyContents,
// different users can download files before and after an update is made to a file
// previous response content is fetched from the user response body content array entry for that user
$this->userResponseBodyContents[$user],
$this->getFilePreviewContent($user),
__METHOD__ . " previous and current previews content is same but expected to be different",
);
// update the saved content for the next comparison
$this->userResponseBodyContents[$user] = $newResponseBodyContents;
$this->setFilePreviewContent($user, $newResponseBodyContents);
}
/**

View File

@@ -692,6 +692,7 @@ default:
- FeatureContext: *common_feature_context_params
- SharingNgContext:
- WebDavPropertiesContext:
- OcisConfigContext:
coreApiWebdavProperties:
paths:

View File

@@ -373,8 +373,8 @@
#### [Public cannot download file preview of unprotected (without password) link share without remote.php](https://github.com/owncloud/ocis/issues/10341)
- [coreApiSharePublicLink1/accessToPublicLinkShare.feature:25](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink1/accessToPublicLinkShare.feature#L25)
- [coreApiSharePublicLink1/accessToPublicLinkShare.feature:54](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink1/accessToPublicLinkShare.feature#L54)
- [coreApiWebdavPreviews/linkSharePreviews.feature:25](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavPreviews/linkSharePreviews.feature#L25)
- [coreApiWebdavPreviews/linkSharePreviews.feature:54](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavPreviews/linkSharePreviews.feature#L54)
#### [Trying to create .. resource with /webdav root (old dav path) without remote.php returns html](https://github.com/owncloud/ocis/issues/10339)

View File

@@ -697,7 +697,7 @@ Feature: an user shares resources using ScienceMesh application
}
"""
@issue-10285 @issue-10536
@issue-10285 @issue-10536 @issue-10305
Scenario: federation user uploads file to a federated shared folder via TUS
Given using spaces DAV path
And using server "LOCAL"

View File

@@ -760,7 +760,7 @@ Feature: copy file
| sample-folder-c |
And for user "Brian" folder "BRIAN-FOLDER/second-level-folder/third-level-folder" of the space "Personal" should contain these entries:
| sample-folder-c |
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
@@ -789,7 +789,7 @@ Feature: copy file
| /second-level-folder |
And for user "Alice" the content of the file "/BRIAN-FOLDER/second-level-folder" of the space "Shares" should be "sample file-c"
And for user "Brian" the content of the file "/BRIAN-FOLDER/second-level-folder" of the space "Personal" should be "sample file-c"
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
@@ -817,7 +817,7 @@ Feature: copy file
| /textfile-c.txt |
And for user "Alice" the content of the file "/BRIAN-FOLDER/second-level-file.txt" of the space "Shares" should be "sample file-c"
And for user "Brian" the content of the file "/BRIAN-FOLDER/second-level-file.txt" of the space "Personal" should be "sample file-c"
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
@@ -843,7 +843,7 @@ Feature: copy file
| third-level-folder |
But for user "Alice" folder "BRIAN-FOLDER/second-level-folder" of the space "Shares" should not contain these entries:
| second-level-folder |
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
@@ -871,7 +871,7 @@ Feature: copy file
And as "Alice" folder "/Sample-Folder-A/sample-folder-b/sample-folder-c" should exist
And for user "Alice" folder "BRIAN-FOLDER/second-level-folder/third-level-folder" of the space "Shares" should contain these entries:
| sample-folder-c |
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
@@ -900,7 +900,7 @@ Feature: copy file
| third-level-folder |
And for user "Alice" the content of the file "/BRIAN-FOLDER/second-level-folder" of the space "Shares" should be "sample file-c"
And for user "Brian" the content of the file "/BRIAN-FOLDER/second-level-folder" of the space "Personal" should be "sample file-c"
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
@@ -930,7 +930,7 @@ Feature: copy file
And as "Alice" file "/Sample-Folder-A/sample-folder-b/textfile-c.txt" should exist
And for user "Alice" the content of the file "/BRIAN-FOLDER/second-level-file.txt" of the space "Shares" should be "sample file-c"
And for user "Brian" the content of the file "/BRIAN-FOLDER/second-level-file.txt" of the space "Personal" should be "sample file-c"
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
@@ -962,7 +962,7 @@ Feature: copy file
And as "Alice" folder "FOLDER/second-level-folder/third-level-folder" should exist
And for user "Alice" folder "BRIAN-FOLDER" of the space "Shares" should not contain these files:
| /second-level-folder/second-level-folder |
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |

View File

@@ -30,7 +30,7 @@ Feature: Share a file or folder that is inside a space
And the OCS status code should be "200"
And the OCS status message should be "OK"
And as "Brian" <resource-type> "Shares/<resource>" should exist
And the information about the last share for user "Brian" should include
And as user "Brian" the last share should include the following properties:
| expiration | <expiration> |
Examples:
| resource | resource-type | space-role | expire-date | expiration |
@@ -55,7 +55,7 @@ Feature: Share a file or folder that is inside a space
And the OCS status code should be "200"
And the OCS status message should be "OK"
And as "Bob" <resource-type> "Shares/<resource>" should exist
And the information about the last share for user "Brian" should include
And as user "Brian" the last share should include the following properties:
| expiration | <expiration> |
Examples:
| resource | resource-type | space-role | expire-date | expiration |
@@ -118,7 +118,7 @@ Feature: Share a file or folder that is inside a space
And the OCS status code should be "200"
And the OCS status message should be "OK"
And as "Brian" folder "Shares/folder" should exist
And the information about the last share for user "Brian" should include
And as user "Brian" the last share should include the following properties:
| expiration | 2042-01-01 |
@@ -135,7 +135,7 @@ Feature: Share a file or folder that is inside a space
| expireDate | 2044-01-01T23:59:59.999+01:00 |
| role | viewer |
Then the HTTP status code should be "200"
And the information about the last share for user "Brian" should include
And as user "Brian" the last share should include the following properties:
| expiration | 2044-01-01 |
@@ -152,7 +152,7 @@ Feature: Share a file or folder that is inside a space
| expireDate | |
| role | viewer |
Then the HTTP status code should be "200"
And the information about the last share for user "Brian" should include
And as user "Brian" the last share should include the following properties:
| expiration | |
@issue-8747

View File

@@ -242,3 +242,16 @@ Feature: changing a public link share
| 2 | change | edit | 400 |
| 1 | create | createOnly | 200 |
| 2 | create | createOnly | 400 |
@issue-web-10473
Scenario: user tries to download public link file using own basic auth
Given user "Alice" has created folder "FOLDER"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "FOLDER/textfile.txt"
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | FOLDER |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When user "Alice" tries to download file "textfile.txt" from the last public link using own basic auth and public WebDAV API
Then the HTTP status code should be "401"

View File

@@ -66,16 +66,3 @@ Feature: accessing a public link share
| testavatar.jpg |
| textfile0.txt |
Then the HTTP status code of responses on all endpoints should be "200"
@issue-web-10473
Scenario: user tries to download public link file using own basic auth
Given user "Alice" has created folder "FOLDER"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "FOLDER/textfile.txt"
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | FOLDER |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When user "Alice" tries to download file "textfile.txt" from the last public link using own basic auth and public WebDAV API
Then the HTTP status code should be "401"

View File

@@ -338,7 +338,7 @@ Feature: copy file
Then the HTTP status code should be "204"
And as "Alice" folder "/Sample-Folder-A/sample-folder-b/sample-folder-c" should exist
And as "Alice" folder "/Shares/BRIAN-FOLDER/second-level-folder/third-level-folder/sample-folder-c" should exist
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
Examples:
| dav-path-version |
@@ -370,7 +370,7 @@ Feature: copy file
And as "Alice" file "Sample-Folder-A/sample-folder-b/textfile-c.txt" should exist
And as "Alice" file "Shares/BRIAN-FOLDER/second-level-folder" should exist
And the content of file "Shares/BRIAN-FOLDER/second-level-folder" for user "Alice" should be "sample file-c"
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
Examples:
| dav-path-version |
@@ -401,7 +401,7 @@ Feature: copy file
And as "Alice" file "Shares/BRIAN-FOLDER/second-level-file.txt" should exist
And as "Alice" file "Shares/BRIAN-FOLDER/textfile-c.txt" should not exist
And the content of file "Shares/BRIAN-FOLDER/second-level-file.txt" for user "Alice" should be "sample file-c"
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
Examples:
| dav-path-version |
@@ -432,7 +432,7 @@ Feature: copy file
And as "Alice" folder "FOLDER/second-level-folder/third-level-folder" should exist
And as "Alice" folder "Shares/BRIAN-FOLDER/second-level-folder/third-level-file.txt/third-level-folder" should exist
And as "Alice" folder "Shares/BRIAN-FOLDER/second-level-folder/second-level-folder" should not exist
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
Examples:
| dav-path-version |
@@ -521,7 +521,7 @@ Feature: copy file
Then the HTTP status code should be "204"
And as "Alice" folder "/Sample-Folder-A/sample-folder-b/sample-folder-c" should exist
And as "Alice" folder "/Shares/BRIAN-FOLDER/second-level-folder/third-level-folder/sample-folder-c" should exist
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
Examples:
| dav-path-version |
@@ -556,7 +556,7 @@ Feature: copy file
And as "Alice" file "Sample-Folder-A/sample-folder-b/textfile-c.txt" should exist
And as "Alice" file "Shares/BRIAN-FOLDER/second-level-folder" should exist
And the content of file "Shares/BRIAN-FOLDER/second-level-folder" for user "Alice" should be "sample file-c"
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
Examples:
| dav-path-version |
@@ -590,7 +590,7 @@ Feature: copy file
And as "Alice" file "Shares/BRIAN-FOLDER/second-level-file.txt" should exist
And as "Alice" file "Shares/BRIAN-FOLDER/textfile-c.txt" should not exist
And the content of file "Shares/BRIAN-FOLDER/second-level-file.txt" for user "Alice" should be "sample file-c"
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
Examples:
| dav-path-version |
@@ -624,7 +624,7 @@ Feature: copy file
And as "Alice" folder "FOLDER/second-level-folder/third-level-folder" should exist
And as "Alice" folder "Shares/BRIAN-FOLDER/second-level-folder/third-level-file.txt/third-level-folder" should exist
And as "Alice" folder "Shares/BRIAN-FOLDER/second-level-folder/second-level-folder" should not exist
And the response when user "Alice" gets the info of the last share should include
And as user "Alice" the last share should include the following properties:
| file_target | /Shares/BRIAN-FOLDER |
Examples:
| dav-path-version |