Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests-Only] Refactor apiShareCreateSpecial1 to use Shares folder #37938

Merged
merged 3 commits into from
Sep 28, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ config = {
'apiProvisioning-v2',
'apiProvisioningGroups-v1',
'apiProvisioningGroups-v2',
'apiShareCreateSpecial1',
'apiShareCreateSpecialRoot1',
'apiShareCreateSpecialShares1',
'apiShareCreateSpecialRoot2',
'apiShareCreateSpecialShares2',
'apiSharees',
Expand Down
15 changes: 13 additions & 2 deletions tests/acceptance/config/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,20 @@ default:
- OccContext:
- OccUsersGroupsContext:

apiShareCreateSpecial1:
apiShareCreateSpecialRoot1:
paths:
- '%paths.base%/../features/apiShareCreateSpecial1'
- '%paths.base%/../features/apiShareCreateSpecialRoot1'
context: *common_ldap_suite_context
contexts:
- FeatureContext: *common_feature_context_params
- OccContext:
- TrashbinContext:
- WebDavPropertiesContext:
- AppConfigurationContext:

apiShareCreateSpecialShares1:
paths:
- '%paths.base%/../features/apiShareCreateSpecialShares1'
context: *common_ldap_suite_context
contexts:
- FeatureContext: *common_feature_context_params
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api @files_sharing-app-required @toImplementOnOCIS @issue-ocis-reva-41 @issue-ocis-reva-243 @issue-ocis-reva-333
@api @files_sharing-app-required @notToImplementOnOCIS
Feature: a default expiration date can be specified for shares with users or groups

Background:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api @files_sharing-app-required @toImplementOnOCIS @issue-ocis-reva-34
@api @files_sharing-app-required @notToImplementOnOCIS
Feature: share resources where the sharee receives the share in multiple ways

Background:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api @files_sharing-app-required @toImplementOnOCIS @issue-ocis-reva-11 @issue-ocis-reva-243
@api @files_sharing-app-required @notToImplementOnOCIS
Feature: resources shared with the same name are received with unique names

Background:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@api @files_sharing-app-required @toImplementOnOCIS @issue-ocis-reva-41
@api @files_sharing-app-required @notToImplementOnOCIS
Feature: cannot share resources when in a group that is excluded from sharing

Background:
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
@api @files_sharing-app-required @toImplementOnOCIS @issue-ocis-reva-34
Feature: share resources where the sharee receives the share in multiple ways

Background:
Given the administrator has set the default folder for received shares to "Shares"
And auto-accept shares has been disabled
And user "Alice" has been created with default attributes and skeleton files

Scenario Outline: Creating a new share with user who already received a share through their group
Given using OCS API version "<ocs_api_version>"
And user "Brian" has been created with default attributes and without skeleton files
And group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has shared file "welcome.txt" with group "grp1"
And user "Brian" has accepted share "/welcome.txt" offered by user "Alice"
When user "Alice" shares file "/welcome.txt" with user "Brian" using the sharing API
Then the OCS status code should be "<ocs_status_code>"
And the HTTP status code should be "200"
Comment on lines +17 to +18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step is supposed to check the status code of sharing step but here it checks the status of accepting the share.

When user "Brian" accepts share "/welcome.txt" offered by user "Alice" using the sharing API
Then the fields of the last response to user "Alice" sharing with user "Brian" should include
| share_with | %username% |
| share_with_displayname | %displayname% |
| file_target | /Shares/welcome (2).txt |
| path | /Shares/welcome (2).txt |
| permissions | share,read,update |
| uid_owner | %username% |
| displayname_owner | %displayname% |
| item_type | file |
| mimetype | text/plain |
| storage_id | ANY_VALUE |
| share_type | user |
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |
| 2 | 200 |

@issue-ocis-reva-243
Scenario Outline: Share of folder and sub-folder to same user - core#20645
Given using OCS API version "<ocs_api_version>"
And user "Brian" has been created with default attributes and skeleton files
And group "grp4" has been created
And user "Brian" has been added to group "grp4"
When user "Alice" shares folder "/PARENT" with user "Brian" using the sharing API
And user "Alice" shares folder "/PARENT/CHILD" with group "grp4" using the sharing API
Then the OCS status code should be "<ocs_status_code>"
And the HTTP status code should be "200"
When user "Brian" accepts share "/PARENT" offered by user "Alice" using the sharing API
And user "Brian" accepts share "/PARENT/CHILD" offered by user "Alice" using the sharing API
Then user "Brian" should see the following elements
| /FOLDER/ |
| /Shares/PARENT/ |
| /Shares/PARENT/parent.txt |
| /PARENT/ |
| /PARENT/parent.txt |
| /Shares/CHILD/ |
| /Shares/CHILD/child.txt |
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |
| 2 | 200 |

@issue-ocis-reva-243
Scenario Outline: sharing subfolder when parent already shared
Given using OCS API version "<ocs_api_version>"
And user "Brian" has been created with default attributes and without skeleton files
And group "grp1" has been created
And user "Alice" has created folder "/test"
And user "Alice" has created folder "/test/sub"
And user "Alice" has shared folder "/test" with group "grp1"
When user "Alice" shares folder "/test/sub" with user "Brian" using the sharing API
Then the OCS status code should be "<ocs_status_code>"
And the HTTP status code should be "200"
Comment on lines +71 to +72
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This step is supposed to check the status code of sharing step but here it checks the status of accepting the share.

When user "Brian" accepts share "/test/sub" offered by user "Alice" using the sharing API
Then as "Brian" folder "/Shares/sub" should exist
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |
| 2 | 200 |

@issue-ocis-reva-243
Scenario Outline: sharing subfolder when parent already shared with group of sharer
Given using OCS API version "<ocs_api_version>"
And user "Brian" has been created with default attributes and without skeleton files
And group "grp0" has been created
And user "Alice" has been added to group "grp0"
And user "Alice" has created folder "/test"
And user "Alice" has created folder "/test/sub"
And user "Alice" has shared folder "/test" with group "grp0"
When user "Alice" shares folder "/test/sub" with user "Brian" using the sharing API
Then the OCS status code should be "<ocs_status_code>"
And the HTTP status code should be "200"
When user "Brian" accepts share "/test/sub" offered by user "Alice" using the sharing API
Then as "Brian" folder "/Shares/sub" should exist
Examples:
| ocs_api_version | ocs_status_code |
| 1 | 100 |
| 2 | 200 |

@issue-ocis-reva-243
Scenario Outline: multiple users share a file with the same name but different permissions to a user
Given using OCS API version "<ocs_api_version>"
And these users have been created with default attributes and without skeleton files:
| username |
| Brian |
| Carol |
And user "Brian" has uploaded file with content "First data" to "/randomfile.txt"
And user "Carol" has uploaded file with content "Second data" to "/randomfile.txt"
When user "Brian" shares file "randomfile.txt" with user "Alice" with permissions "read" using the sharing API
And user "Alice" accepts share "/randomfile.txt" offered by user "Brian" using the sharing API
And user "Alice" gets the info of the last share using the sharing API
Then the fields of the last response about user "Brian" sharing with user "Alice" should include
| uid_owner | %username% |
| share_with | %username% |
| file_target | /Shares/randomfile.txt |
| item_type | file |
| permissions | read |
When user "Carol" shares file "randomfile.txt" with user "Alice" with permissions "read,update" using the sharing API
And user "Alice" accepts share "/randomfile.txt" offered by user "Carol" using the sharing API
And user "Alice" gets the info of the last share using the sharing API
Then the fields of the last response about user "Carol" sharing with user "Alice" should include
| uid_owner | %username% |
| share_with | %username% |
| file_target | /Shares/randomfile (2).txt |
| item_type | file |
| permissions | read,update |
And the content of file "/Shares/randomfile.txt" for user "Alice" should be "First data"
And the content of file "/Shares/randomfile (2).txt" for user "Alice" should be "Second data"
Examples:
| ocs_api_version |
| 1 |
| 2 |

@issue-ocis-reva-243
Scenario Outline: multiple users share a folder with the same name to a user
Given using OCS API version "<ocs_api_version>"
And these users have been created with default attributes and without skeleton files:
| username |
| Brian |
| Carol |
And user "Brian" has created folder "/zzzfolder"
And user "Brian" has created folder "zzzfolder/Brian"
And user "Carol" has created folder "/zzzfolder"
And user "Carol" has created folder "zzzfolder/Carol"
When user "Brian" shares folder "zzzfolder" with user "Alice" with permissions "read,delete" using the sharing API
And user "Alice" accepts share "/zzzfolder" offered by user "Brian" using the sharing API
And user "Alice" gets the info of the last share using the sharing API
Then the fields of the last response about user "Brian" sharing with user "Alice" should include
| uid_owner | %username% |
| share_with | %username% |
| file_target | /Shares/zzzfolder |
| item_type | folder |
| permissions | read,delete |
When user "Carol" shares folder "zzzfolder" with user "Alice" with permissions "read,share" using the sharing API
And user "Alice" accepts share "/zzzfolder" offered by user "Carol" using the sharing API
And user "Alice" gets the info of the last share using the sharing API
Then the fields of the last response about user "Carol" sharing with user "Alice" should include
| uid_owner | %username% |
| share_with | %username% |
| file_target | /Shares/zzzfolder (2) |
| item_type | folder |
| permissions | read,share |
And as "Alice" folder "/Shares/zzzfolder/Brian" should exist
And as "Alice" folder "/Shares/zzzfolder (2)/Carol" should exist
Examples:
| ocs_api_version |
| 1 |
| 2 |

@skipOnEncryptionType:user-keys @encryption-issue-132 @skipOnLDAP
Scenario Outline: share with a group and then add a user to that group that already has a file with the shared name
Given using OCS API version "<ocs_api_version>"
And these users have been created with default attributes and without skeleton files:
| username |
| Brian |
| Carol |
And these groups have been created:
| groupname |
| grp1 |
And user "Brian" has been added to group "grp1"
And user "Alice" has uploaded file with content "Shared content" to "lorem.txt"
And user "Carol" has uploaded file with content "My content" to "lorem.txt"
When user "Alice" shares file "lorem.txt" with group "grp1" using the sharing API
And user "Brian" accepts share "/lorem.txt" offered by user "Alice" using the sharing API
And the administrator adds user "Carol" to group "grp1" using the provisioning API
And user "Carol" accepts share "/lorem.txt" offered by user "Alice" using the sharing API
Then the content of file "Shares/lorem.txt" for user "Brian" should be "Shared content"
And the content of file "lorem.txt" for user "Carol" should be "My content"
And the content of file "Shares/lorem.txt" for user "Carol" should be "Shared content"
Examples:
| ocs_api_version |
| 1 |
| 2 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
@api @files_sharing-app-required @toImplementOnOCIS @issue-ocis-reva-11 @issue-ocis-reva-243
Feature: resources shared with the same name are received with unique names

Background:
Given the administrator has set the default folder for received shares to "Shares"
And auto-accept shares has been disabled
And using OCS API version "1"
And these users have been created with default attributes and without skeleton files:
| username |
| Alice |
| Brian |
| Carol |

@smokeTest
Scenario: unique target names for incoming shares
Given user "Alice" has created folder "/foo"
And user "Brian" has created folder "/foo"
When user "Alice" shares folder "/foo" with user "Carol" using the sharing API
And user "Carol" accepts share "/foo" offered by user "Alice" using the sharing API
And user "Brian" shares folder "/foo" with user "Carol" using the sharing API
And user "Carol" accepts share "/foo" offered by user "Brian" using the sharing API
Then user "Carol" should see the following elements
| /Shares/foo/ |
| /Shares/foo%20(2)/ |
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
@api @files_sharing-app-required @toImplementOnOCIS @issue-ocis-reva-41
Feature: cannot share resources when in a group that is excluded from sharing

Background:
Given the administrator has set the default folder for received shares to "Shares"
And auto-accept shares has been disabled
And user "Alice" has been created with default attributes and skeleton files

Scenario Outline: user who is excluded from sharing tries to share a file with another user
Given using OCS API version "<ocs_api_version>"
And user "Brian" has been created with default attributes and skeleton files
And group "grp1" has been created
And user "Brian" has been added to group "grp1"
And parameter "shareapi_exclude_groups" of app "core" has been set to "yes"
And parameter "shareapi_exclude_groups_list" of app "core" has been set to '["grp1"]'
And user "Brian" has moved file "welcome.txt" to "fileToShare.txt"
When user "Brian" shares file "fileToShare.txt" with user "Alice" using the sharing API
Then the OCS status code should be "403"
And the HTTP status code should be "<http_status_code>"
And the sharing API should report to user "Alice" that no shares are in the pending state
And as "Alice" file "Shares/fileToShare.txt" should not exist
And as "Alice" file "fileToShare.txt" should not exist
phil-davis marked this conversation as resolved.
Show resolved Hide resolved
Examples:
| ocs_api_version | http_status_code |
| 1 | 200 |
| 2 | 403 |

Scenario Outline: user who is excluded from sharing tries to share a file with a group
Given using OCS API version "<ocs_api_version>"
And user "Brian" has been created with default attributes and skeleton files
And user "Carol" has been created with default attributes and without skeleton files
And group "grp1" has been created
And group "grp2" has been created
And user "Brian" has been added to group "grp1"
And user "Carol" has been added to group "grp2"
And parameter "shareapi_exclude_groups" of app "core" has been set to "yes"
And parameter "shareapi_exclude_groups_list" of app "core" has been set to '["grp1"]'
And user "Brian" has moved file "welcome.txt" to "fileToShare.txt"
When user "Brian" shares file "fileToShare.txt" with group "grp2" using the sharing API
Then the OCS status code should be "403"
And the HTTP status code should be "<http_status_code>"
And the sharing API should report to user "Carol" that no shares are in the pending state
And as "Carol" file "Shares/fileToShare.txt" should not exist
And as "Carol" file "fileToShare.txt" should not exist
phil-davis marked this conversation as resolved.
Show resolved Hide resolved
Examples:
| ocs_api_version | http_status_code |
| 1 | 200 |
| 2 | 403 |

Scenario Outline: user who is excluded from sharing tries to share a folder with another user
Given using OCS API version "<ocs_api_version>"
And user "Brian" has been created with default attributes and without skeleton files
And group "grp1" has been created
And user "Brian" has been added to group "grp1"
And parameter "shareapi_exclude_groups" of app "core" has been set to "yes"
And parameter "shareapi_exclude_groups_list" of app "core" has been set to '["grp1"]'
And user "Brian" has created folder "folderToShare"
When user "Brian" shares folder "folderToShare" with user "Alice" using the sharing API
Then the OCS status code should be "403"
And the HTTP status code should be "<http_status_code>"
And the sharing API should report to user "Alice" that no shares are in the pending state
And as "Alice" folder "Shares/folderToShare" should not exist
And as "Alice" folder "folderToShare" should not exist
phil-davis marked this conversation as resolved.
Show resolved Hide resolved
Examples:
| ocs_api_version | http_status_code |
| 1 | 200 |
| 2 | 403 |

Scenario Outline: user who is excluded from sharing tries to share a folder with a group
Given using OCS API version "<ocs_api_version>"
And user "Brian" has been created with default attributes and without skeleton files
And group "grp0" has been created
And group "grp1" has been created
And user "Alice" has been added to group "grp0"
And user "Brian" has been added to group "grp1"
And parameter "shareapi_exclude_groups" of app "core" has been set to "yes"
And parameter "shareapi_exclude_groups_list" of app "core" has been set to '["grp0"]'
And user "Alice" has created folder "folderToShare"
When user "Alice" shares folder "folderToShare" with group "grp1" using the sharing API
Then the OCS status code should be "403"
And the HTTP status code should be "<http_status_code>"
And the sharing API should report to user "Brian" that no shares are in the pending state
And as "Brian" folder "Shares/folderToShare" should not exist
And as "Brian" folder "folderToShare" should not exist
phil-davis marked this conversation as resolved.
Show resolved Hide resolved
Examples:
| ocs_api_version | http_status_code |
| 1 | 200 |
| 2 | 403 |