Skip to content

Commit

Permalink
Merge pull request #37656 from owncloud/testUpdateShareResponse
Browse files Browse the repository at this point in the history
[tests-only] test the API response of a share-update response
  • Loading branch information
individual-it authored Jul 9, 2020
2 parents 3861d0a + 270157d commit 5574a5a
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,87 @@ Feature: update a public link share
Given using OCS API version "1"
And user "Alice" has been created with default attributes and skeleton files

@skipOnOcis @toFixOnOCIS @toFixOnOcV10 @issue-ocis-reva-243 @issue-ocis-reva-349 @issue-37653
#after fixing all the issues merge this scenario with the one below
Scenario Outline: API responds with a full set of parameters when owner changes the expireDate of a public share
Given using OCS API version "<ocs_api_version>"
When user "Alice" creates a public link share using the sharing API with settings
| path | FOLDER |
And user "Alice" updates the last share using the sharing API with
| expireDate | +3 days |
Then the OCS status code should be "<ocs_status_code>"
And the OCS status message should be ""
And the HTTP status code should be "200"
And the fields of the last response to user "Alice" should include
| id | A_STRING |
| share_type | public_link |
| uid_owner | %username% |
| displayname_owner | %displayname% |
| permissions | read |
| stime | A_NUMBER |
| parent | |
| expiration | A_STRING |
| token | A_STRING |
| uid_file_owner | %username% |
| displayname_file_owner | %displayname% |
| additional_info_owner | |
| additional_info_file_owner | |
| item_type | folder |
| item_source | A_STRING |
| path | /FOLDER |
| mimetype | httpd/unix-directory |
| storage_id | A_STRING |
| storage | A_NUMBER |
| file_source | A_STRING |
| file_target | /FOLDER |
| mail_send | 0 |
| name | |
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |
| 2 | 200 |

@skipOnOcV10 @toFixOnOCIS @toFixOnOcV10 @issue-ocis-reva-243 @issue-ocis-reva-349 @issue-37653
#after fixing all the issues merge this scenario with the one above
Scenario Outline: API responds with a full set of parameters when owner changes the expireDate of a public share
Given using OCS API version "<ocs_api_version>"
When user "Alice" creates a public link share using the sharing API with settings
| path | FOLDER |
And user "Alice" updates the last share using the sharing API with
| expireDate | +3 days |
Then the OCS status code should be "<ocs_status_code>"
And the OCS status message should be "OK"
And the HTTP status code should be "200"
And the fields of the last response to user "Alice" should include
| id | A_STRING |
| share_type | public_link |
| uid_owner | %username% |
| displayname_owner | %displayname% |
| permissions | read |
| stime | A_NUMBER |
| parent | |
| expiration | A_STRING |
| token | A_STRING |
| uid_file_owner | %username% |
| displayname_file_owner | %displayname% |
| additional_info_owner | |
| additional_info_file_owner | |
| state | 0 |
| item_type | folder |
| item_source | A_STRING |
| path | /FOLDER |
| mimetype | httpd/unix-directory |
| storage_id | A_STRING |
| storage | A_NUMBER |
| file_source | A_STRING |
| file_target | /FOLDER |
| mail_send | 0 |
| name | |
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |
| 2 | 200 |

@smokeTest @skipOnOcis @issue-ocis-reva-336
Scenario Outline: Creating a new public link share, updating its expiration date and getting its info
Given using OCS API version "<ocs_api_version>"
Expand Down
96 changes: 96 additions & 0 deletions tests/acceptance/features/apiShareUpdate/updateShare.feature
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,102 @@ Feature: sharing
And as "Alice" folder "/Alice-folder/folder2" should exist
And as "Carol" folder "/Carol-folder/folder2" should not exist

@skipOnOcis @toFixOnOCIS @toFixOnOcV10 @issue-ocis-reva-243 @issue-ocis-reva-349 @issue-ocis-reva-350 @issue-ocis-reva-352 @issue-37653
#after fixing all the issues merge this scenario with the one below
Scenario Outline: API responds with a full set of parameters when owner changes the permission of a share
Given using OCS API version "<ocs_api_version>"
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has created folder "/Alice-folder"
And user "Alice" has shared folder "/Alice-folder" with user "Brian" with permissions "read"
When user "Alice" updates the last share using the sharing API with
| permissions | all |
Then the OCS status code should be "<ocs_status_code>"
And the OCS status message should be ""
And the HTTP status code should be "200"
Then the fields of the last response to user "Alice" sharing with user "Brian" should include
| id | A_STRING |
| share_type | user |
| uid_owner | %username% |
| displayname_owner | %displayname% |
| permissions | all |
| stime | A_NUMBER |
| parent | |
| expiration | |
| token | |
| uid_file_owner | %username% |
| displayname_file_owner | %displayname% |
| additional_info_owner | |
| additional_info_file_owner | |
| item_type | folder |
| item_source | A_STRING |
| path | /Alice-folder |
| mimetype | httpd/unix-directory |
| storage_id | home::Alice |
| storage | A_STRING |
| file_source | A_STRING |
| file_target | /Alice-folder |
| share_with | %username% |
| share_with_displayname | %displayname% |
| share_with_additional_info | |
| mail_send | 0 |
| attributes | |
And the fields of the last response should not include
| name | |
# | token | |
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |
| 2 | 200 |

@skipOnOcV10 @toFixOnOCIS @toFixOnOcV10 @issue-ocis-reva-243 @issue-ocis-reva-349 @issue-ocis-reva-350 @issue-ocis-reva-352 @issue-37653
#after fixing all the issues merge this scenario with the one above
Scenario Outline: API responds with a full set of parameters when owner changes the permission of a share
Given using OCS API version "<ocs_api_version>"
And user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has created folder "/Alice-folder"
And user "Alice" has shared folder "/Alice-folder" with user "Brian" with permissions "read"
When user "Alice" updates the last share using the sharing API with
| permissions | all |
Then the OCS status code should be "<ocs_status_code>"
And the OCS status message should be "OK"
And the HTTP status code should be "200"
Then the fields of the last response to user "Alice" sharing with user "Brian" should include
| id | A_STRING |
| share_type | user |
| uid_owner | %username% |
| displayname_owner | %displayname% |
| permissions | all |
| stime | A_NUMBER |
| parent | |
| expiration | |
| token | |
| uid_file_owner | %username% |
| displayname_file_owner | %displayname% |
| additional_info_owner | |
| additional_info_file_owner | |
| state | 0 |
| item_source | |
| path | |
| item_type | |
| mimetype | |
| storage_id | |
| storage | 0 |
| file_source | |
| file_target | |
| share_with | %username% |
| share_with_displayname | %displayname% |
| share_with_additional_info | |
| mail_send | 0 |
| name | |
And the fields of the last response should not include
| attributes | |
# | token | |
# | name | |
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |
| 2 | 200 |

@skipOnOcis @issue-ocis-reva-194 @issue-ocis-reva-243
Scenario Outline: Increasing permissions is allowed for owner
Given using OCS API version "<ocs_api_version>"
Expand Down
14 changes: 10 additions & 4 deletions tests/acceptance/features/bootstrap/Sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -2003,11 +2003,17 @@ public function checkingTheResponseEntriesCount($count) {
public function checkFields($user, $body) {
$this->verifyTableNodeColumnsCount($body, 2);
$bodyRows = $body->getRowsHash();
$userRelatedFieldNames = [
"owner",
"user",
"uid_owner",
"uid_file_owner",
"share_with",
"displayname_file_owner",
"displayname_owner"
];
foreach ($bodyRows as $field => $value) {
if (\in_array($field, ["owner", "user", "uid_owner", "uid_file_owner", "share_with"])) {
$value = $this->getActualUsername($value);
}
if (\in_array($field, ["displayname_file_owner", "displayname_owner"])) {
if (\in_array($field, $userRelatedFieldNames)) {
$value = $this->substituteInLineCodes($value, $user);
}
$value = $this->replaceValuesFromTable($field, $value);
Expand Down

0 comments on commit 5574a5a

Please sign in to comment.