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

[test-only][full-ci] ApiTest. creating a shared resource with an expiration date #5424

Merged
merged 1 commit into from
Feb 1, 2023
Merged
Changes from all 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
77 changes: 0 additions & 77 deletions tests/acceptance/expected-failures-API-on-OCIS-storage.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ The expected failures in this file are from features in the owncloud/ocis repo.
### [Copy or move on an existing resource doesn't create a new version but deletes instead](https://github.com/owncloud/ocis/issues/4797)
- [apiSpacesShares/moveSpaces.feature:306](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/moveSpaces.feature#L306)
- [apiSpacesShares/copySpaces.feature:710](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L710)
- [apiSpacesShares/copySpaces.feature:748](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L748)
- [apiSpacesShares/copySpaces.feature:751](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/copySpaces.feature#L751)

### [Creating group with empty name returns status code 200](https://github.com/owncloud/ocis/issues/5050)
- [apiGraph/createGroup.feature:40](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiGraph/createGroup.feature#L40)
@@ -99,5 +99,8 @@ The expected failures in this file are from features in the owncloud/ocis repo.
- [apiAsyncUpload/delayPostprocessing.feature:15](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiAsyncUpload/delayPostprocessing.feature#L15)
- [apiAsyncUpload/delayPostprocessing.feature:16](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiAsyncUpload/delayPostprocessing.feature#L16)

#### [Sharing to a group with an expiration date does not work #5442](https://github.com/owncloud/ocis/issues/5442)
- [apiSpacesShares/shareSubItemOfSpace.feature:99](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpace.feature#L99)

Note: always have an empty line at the end of this file.
The bash script that processes this file requires that the last line has a newline on the end.
10 changes: 8 additions & 2 deletions tests/acceptance/features/apiContract/spacesReport.feature
Original file line number Diff line number Diff line change
@@ -19,7 +19,10 @@ Feature: Report test


Scenario: check the response of the found folder
Given user "Alice" shares the following entity "folderMain" inside of space "find data" with user "Brian" with role "viewer"
Given user "Alice" has created a share inside of space "find data" with settings:
| path | folderMain |
| shareWith | Brian |
| role | viewer |
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
When user "Brian" searches for "SubFolder1" using the WebDAV API
Then the HTTP status code should be "207"
@@ -35,7 +38,10 @@ Feature: Report test


Scenario: check the response of the found file
Given user "Alice" shares the following entity "folderMain" inside of space "find data" with user "Brian" with role "editor"
Given user "Alice" has created a share inside of space "find data" with settings:
| path | folderMain |
| shareWith | Brian |
| role | editor |
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
When user "Brian" searches for "insideTheFolder.txt" using the WebDAV API
Then the HTTP status code should be "207"
Original file line number Diff line number Diff line change
@@ -31,7 +31,6 @@ Feature: A manager of the space can edit public link
| permissions | <permissions> |
| password | <password> |
| name | <linkName> |
| expireDate | <expireDate> |
Then the HTTP status code should be "200"
And the OCS status code should be "200"
And the OCS status message should be "OK"
@@ -44,13 +43,12 @@ Feature: A manager of the space can edit public link
| share_type | public_link |
| displayname_owner | %displayname% |
| name | <linkName> |
| expiration | <expireDate> |
And the public should be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "<password>"
And the downloaded content should be "some content"
Examples:
| permissions | expectedPermissions | password | linkName | expireDate |
| 5 | read,create | newPass | | |
| 15 | read,update,create,delete | | newName | 2042-03-25T23:59:59+0100 |
| permissions | expectedPermissions | password | linkName |
| 5 | read,create | newPass | |
| 15 | read,update,create,delete | | newName |


Scenario Outline: All members can see a created public link
15 changes: 12 additions & 3 deletions tests/acceptance/features/apiSpaces/search.feature
Original file line number Diff line number Diff line change
@@ -42,7 +42,10 @@ Feature: Search


Scenario: Brian can find data from the Shares
Given user "Alice" shares the following entity "folderMain" inside of space "find data" with user "Brian" with role "viewer"
Given user "Alice" has created a share inside of space "find data" with settings:
| path | folderMain |
| shareWith | Brian |
| role | viewer |
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
When user "Brian" searches for "folder" using the WebDAV API
Then the HTTP status code should be "207"
@@ -64,7 +67,10 @@ Feature: Search


Scenario: User cannot find pending folder
Given user "Alice" shares the following entity "folderMain" inside of space "find data" with user "Brian" with role "viewer"
Given user "Alice" has created a share inside of space "find data" with settings:
| path | folderMain |
| shareWith | Brian |
| role | viewer |
When user "Brian" searches for "folder" using the WebDAV API
Then the HTTP status code should be "207"
And the search result should contain "0" entries
@@ -75,7 +81,10 @@ Feature: Search


Scenario: User cannot find declined folder
Given user "Alice" shares the following entity "folderMain" inside of space "find data" with user "Brian" with role "viewer"
Given user "Alice" has created a share inside of space "find data" with settings:
| path | folderMain |
| shareWith | Brian |
| role | viewer |
And user "Brian" has declined share "/folderMain" offered by user "Alice"
When user "Brian" searches for "folder" using the WebDAV API
Then the HTTP status code should be "207"
15 changes: 12 additions & 3 deletions tests/acceptance/features/apiSpaces/tag.feature
Original file line number Diff line number Diff line change
@@ -102,7 +102,10 @@ Feature: Tag
Given user "Alice" has created the following tags for folder "folderMain" of the space "use-tag":
| folderTag |
| marketing |
And user "Alice" has shared the following entity "folderMain" inside of space "use-tag" with user "Brian" with role "viewer"
And user "Alice" has created a share inside of space "use-tag" with settings:
| path | folderMain |
| shareWith | Brian |
| role | viewer |
When user "Brian" lists all available tags via the GraphApi
Then the HTTP status code should be "200"
And the response should not contain following tags:
@@ -117,7 +120,10 @@ Feature: Tag


Scenario Outline: The recipient of the shared resource tries to create a tag
Given user "Alice" has shared the following entity "folderMain" inside of space "use-tag" with user "Brian" with role "<role>"
Given user "Alice" has created a share inside of space "use-tag" with settings:
| path | folderMain |
| shareWith | Brian |
| role | <role> |
And user "Brian" has accepted share "/folderMain" offered by user "Alice"
When user "Brian" creates the following tags for <resource> "<resourceName>" of space "Shares":
| tag in a shared resource |
@@ -139,7 +145,10 @@ Feature: Tag


Scenario Outline: The recipient of the shared resource tries to remove a tag
Given user "Alice" has shared the following entity "folderMain" inside of space "use-tag" with user "Brian" with role "<role>"
Given user "Alice" has created a share inside of space "use-tag" with settings:
| path | folderMain |
| shareWith | Brian |
| role | <role> |
And user "Alice" has created the following tags for <resource> "<resourceName>" of the space "use-tag":
| tag in a shared resource |
| second tag |
12 changes: 9 additions & 3 deletions tests/acceptance/features/apiSpacesShares/copySpaces.feature
Original file line number Diff line number Diff line change
@@ -731,7 +731,10 @@ Feature: copy file
And user "Alice" has created a space "Project" with the default quota using the GraphApi
And user "Alice" has created a folder "/newfolder" in space "Project"
And user "Alice" has uploaded a file inside space "Project" with content "some content" to "/newfolder/personal.txt"
And user "Alice" shares the following entity "newfolder" inside of space "Project" with user "Brian" with role "editor"
And user "Alice" creates a share inside of space "Project" with settings:
| path | newfolder |
| shareWith | Brian |
| role | editor |
And user "Brian" has accepted share "/newfolder" offered by user "Alice"
And user "Brian" has uploaded file with content "new content" to "/personal.txt"
When user "Brian" copies file "/personal.txt" from space "Personal" to "/newfolder/personal (1).txt" inside space "Shares" using the WebDAV API
@@ -751,13 +754,16 @@ Feature: copy file
And user "Alice" has created a folder "/newfolder" in space "Project"
And user "Alice" has uploaded a file inside space "Project" with content "old content version 1" to "/newfolder/personal.txt"
And user "Alice" has uploaded a file inside space "Project" with content "old content version 2" to "/newfolder/personal.txt"
And user "Alice" shares the following entity "newfolder" inside of space "Project" with user "Brian" with role "editor"
And user "Alice" creates a share inside of space "Project" with settings:
| path | newfolder |
| shareWith | Brian |
| role | editor |
And user "Brian" has accepted share "/newfolder" offered by user "Alice"
And user "Brian" has uploaded file with content "new content" to "/personal.txt"
When user "Brian" overwrites file "/personal.txt" from space "Personal" to "/newfolder/personal.txt" inside space "Shares" while copying using the WebDAV API
Then the HTTP status code should be "204"
And for user "Alice" the space "Project" should contain these entries:
| newfolder/personal.txt |
| newfolder/personal.txt |
And for user "Alice" the content of the file "/newfolder/personal.txt" of the space "Project" should be "new content"
When user "Alice" downloads version of the file "/newfolder/personal.txt" with the index "1" of the space "Project" using the WebDAV API
Then the HTTP status code should be "200"
Original file line number Diff line number Diff line change
@@ -18,43 +18,58 @@ Feature: Share a file or folder that is inside a space
And user "Alice" has created a space "share sub-item" with the default quota using the GraphApi
And user "Alice" has created a folder "folder" in space "share sub-item"
And user "Alice" has uploaded a file inside space "share sub-item" with content "some content" to "file.txt"
And using new DAV path
And using new DAV path



Scenario Outline: A manager of the space can share an entity inside project space to another user with role
When user "Alice" shares the following entity "<entity>" inside of space "share sub-item" with user "Brian" with role "<role>"
And user "Alice" creates a share inside of space "share sub-item" with settings:
| path | <entity> |
| shareWith | Brian |
| role | <role> |
| expireDate | <expireDate> |
Then the HTTP status code should be "200"
And the OCS status code should be "200"
And the OCS status message should be "OK"
When user "Brian" accepts share "/<entity>" offered by user "Alice" using the sharing API
And as "Brian" <type> "Shares/<entity>" should exist
Then as "Brian" <type> "Shares/<entity>" should exist
And the information about the last share for user "Brian" should include
| expiration | <expiration> |
Examples:
| entity | type | role |
| folder | folder | viewer |
| folder | folder | editor |
| file.txt | file | viewer |
| file.txt | file | editor |
| entity | type | role | expireDate | expiration |
| folder | folder | viewer | | |
| folder | folder | editor | 2042-03-25T23:59:59+0100 | 2042-03-25 |
| file.txt | file | viewer | | |
| file.txt | file | editor | 2042-03-25T23:59:59+0100 | 2042-03-25 |


Scenario Outline: An user participant of the project space with manager role can share an entity to another user
Scenario Outline: A user participant of the project space with manager role can share an entity to another user
Given user "Alice" has shared a space "share sub-item" to user "Brian" with role "manager"
When user "Brian" shares the following entity "<entity>" inside of space "share sub-item" with user "Bob" with role "<role>"
When user "Brian" creates a share inside of space "share sub-item" with settings:
| path | <entity> |
| shareWith | Bob |
| role | <role> |
| expireDate | <expireDate> |
Then the HTTP status code should be "200"
And the OCS status code should be "200"
And the OCS status message should be "OK"
When user "Bob" accepts share "/<entity>" offered by user "Brian" using the sharing API
And as "Bob" <type> "Shares/<entity>" should exist
Then as "Bob" <type> "Shares/<entity>" should exist
And the information about the last share for user "Brian" should include
| expiration | <expiration> |
Examples:
| entity | type | role |
| folder | folder | viewer |
| folder | folder | editor |
| file.txt | file | viewer |
| file.txt | file | editor |
| entity | type | role | expireDate | expiration |
| folder | folder | viewer | 2042-03-25T23:59:59+0100 | 2042-03-25 |
| folder | folder | editor | | |
| file.txt | file | viewer | 2042-03-25T23:59:59+0100 | 2042-03-25 |
| file.txt | file | editor | | |


Scenario Outline: An user participant of the project space without space manager role cannot share an entity to another user
Scenario Outline: A user participant of the project space without space manager role cannot share an entity to another user
Given user "Alice" has shared a space "share sub-item" to user "Brian" with role "<spaceRole>"
When user "Brian" shares the following entity "<entity>" inside of space "share sub-item" with user "Bob" with role "editor"
When user "Brian" creates a share inside of space "share sub-item" with settings:
| path | <entity> |
| shareWith | Bob |
| role | editor |
Then the HTTP status code should be "<statusCode>"
And the OCS status code should be "<statusCode>"
And the OCS status message should be "<statusMessage>"
@@ -66,13 +81,48 @@ Feature: Share a file or folder that is inside a space
| folder | viewer | 404 | No share permission |


Scenario Outline: An user participant of the project space can see the created resources share
Scenario Outline: A user participant of the project space can see the created resources share
Given user "Alice" has shared a space "share sub-item" to user "Brian" with role "<spaceRole>"
When user "Alice" shares the following entity "file.txt" inside of space "share sub-item" with user "Bob" with role "editor"
When user "Alice" creates a share inside of space "share sub-item" with settings:
| path | file.txt |
| shareWith | Bob |
| role | editor |
Then for user "Alice" the space "share sub-item" should contain the last created share of the file "file.txt"
And for user "Brian" the space "share sub-item" should contain the last created share of the file "file.txt"
Examples:
| spaceRole |
| editor |
| viewer |
| manager |


Scenario: A user shares the folder to the group
Given group "sales" has been created
And the administrator has added a user "Brian" to the group "sales" using GraphApi
When user "Alice" creates a share inside of space "share sub-item" with settings:
| path | folder |
| shareWith | sales |
| shareType | 1 |
| role | viewer |
| expireDate | 2042-01-01T23:59:59+0100 |
Then the HTTP status code should be "200"
And the OCS status code should be "200"
And the OCS status message should be "OK"
When user "Brian" accepts share "/folder" offered by user "Alice" using the sharing API
Then as "Brian" folder "Shares/folder" should exist
And the information about the last share for user "Brian" should include
| expiration | 2042-01-01 |


Scenario: A user changes the expiration date
Given user "Alice" has created a share inside of space "share sub-item" with settings:
| path | folder |
| shareWith | Brian |
| role | viewer |
| expireDate | 2042-01-01T23:59:59+0100 |
And user "Brian" has accepted share "/folder" offered by user "Alice"
When user "Alice" changes the last share with settings:
| expireDate | 2044-01-01T23:59:59.999+01:00 |
Then the HTTP status code should be "200"
And the information about the last share for user "Brian" should include
| expiration | 2044-01-01 |
30 changes: 21 additions & 9 deletions tests/acceptance/features/bootstrap/Sharing.php
Original file line number Diff line number Diff line change
@@ -1030,14 +1030,7 @@ public function updateLastShareWithSettings(
$this->shareFields
);
$bodyRows = $body->getRowsHash();
if (\array_key_exists('expireDate', $bodyRows)) {
$dateModification = $bodyRows['expireDate'];
if (!empty($bodyRows['expireDate'])) {
$bodyRows['expireDate'] = \date('Y-m-d', \strtotime($dateModification));
} else {
$bodyRows['expireDate'] = '';
}
}

if (\array_key_exists('password', $bodyRows)) {
$bodyRows['password'] = $this->getActualPassword($bodyRows['password']);
}
@@ -1283,7 +1276,7 @@ public function isFieldInResponse(string $field, ?string $contentExpected, bool
}
Assert::assertIsObject($data, __METHOD__ . " data not found in response XML");

$dateFieldsArrayToConvert = ['expiration', 'original_date', 'new_date'];
$dateFieldsArrayToConvert = ['original_date', 'new_date'];
//do not try to convert empty date
if ((string) \in_array($field, \array_merge($dateFieldsArrayToConvert)) && !empty($contentExpected)) {
$timestamp = \strtotime($contentExpected, $this->getServerShareTimeFromLastResponse());
@@ -1305,6 +1298,10 @@ public function isFieldInResponse(string $field, ?string $contentExpected, bool
if (isset($element->$field)) {
$fieldIsSet = true;
$value = (string) $element->$field;
// convert expiration to Y-m-d format. bug #5424
if ($field === "expiration") {
$value = (preg_split("/[\sT]+/", $value))[0];
}
if ($this->doesFieldValueMatchExpectedContent(
$field,
$value,
@@ -2386,6 +2383,21 @@ public function userGetsAllTheSharesSharedWithHimUsingTheSharingApi(string $user
);
}

/**
* @When the information about the last share for user :user should include
*
* @param string $user
* @param TableNode $table
*
* @return void
*/
public function userGetsTheLastShareSharedWithHimUsingTheSharingApi(string $user, $table):void {
$user = $this->getActualUsername($user);
$shareId = $this->getLastPublicLinkShareId();
$this->getShareData($user, $shareId);
$this->checkFields($user, $table);
}

/**
* @When /^user "([^"]*)" gets the (|pending)\s?(user|group|user and group|public link) shares shared with him using the sharing API$/
*
Loading