test: merge similar steps

This commit is contained in:
Saw-jan
2024-11-27 11:59:10 +05:45
parent 5bbe356d36
commit bc63c2cbd7
5 changed files with 41 additions and 58 deletions

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

@@ -100,7 +100,7 @@ trait WebDav {
* @return void
*/
public function setFilePreviewContent(string $user, string $previewContent): void {
$filePreviews[$user] = $previewContent;
$this->filePreviews[$user] = $previewContent;
}
/**

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

@@ -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 |