[tests-only] [full-ci] Use sharing ng in api spaces (#9082)

* update given step using sharingNg in changeSpaces.feature

* update given step using sharingNg in disableAndDeleteSpaces.feature

* update given step using sharingNg in editPublicLinkOfSpace.feature

* update given step using sharingNg in filePreviews.feature

* update given step using sharingNg in listSpaces.feature

* update given step using sharingNg in publicLink.feature

* update given step using sharingNg in removeSpaceObjects.feature
This commit is contained in:
Salipa Gurung
2024-05-09 14:07:56 +05:45
committed by GitHub
parent 2c115e2418
commit 971f34ac0a
11 changed files with 101 additions and 59 deletions
+1
View File
@@ -47,6 +47,7 @@ default:
- GraphContext:
- OcisConfigContext:
- WebDavLockingContext:
- SharingNgContext:
apiSpacesShares:
paths:
@@ -14,12 +14,16 @@ Feature: Change data of space
| Bob |
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "Project Jupiter" of type "project" with quota "20"
And user "Alice" has shared a space "Project Jupiter" with settings:
| shareWith | Brian |
| role | editor |
And user "Alice" has shared a space "Project Jupiter" with settings:
| shareWith | Bob |
| role | viewer |
And user "Alice" has sent the following space share invitation:
| space | Project Jupiter |
| sharee | Brian |
| shareType | user |
| permissionsRole | Space Editor |
And user "Alice" has sent the following space share invitation:
| space | Project Jupiter |
| sharee | Bob |
| shareType | user |
| permissionsRole | Space Viewer |
And using spaces DAV path
@@ -15,12 +15,16 @@ Feature: Disabling and deleting space
| Carol |
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "Project Moon" with the default quota using the Graph API
And user "Alice" has shared a space "Project Moon" with settings:
| shareWith | Brian |
| role | editor |
And user "Alice" has shared a space "Project Moon" with settings:
| shareWith | Bob |
| role | viewer |
And user "Alice" has sent the following space share invitation:
| space | Project Moon |
| sharee | Brian |
| shareType | user |
| permissionsRole | Space Editor |
And user "Alice" has sent the following space share invitation:
| space | Project Moon |
| sharee | Bob |
| shareType | user |
| permissionsRole | Space Viewer |
Scenario Outline: user can disable their own space via the Graph API
@@ -16,12 +16,14 @@ Feature: A manager of the space can edit public link
And using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "edit space" with the default quota using the Graph API
And user "Alice" has created a public link share of the space "edit space" with settings:
| permissions | 1 |
| password | %public% |
| expireDate | 2040-01-01T23:59:59+0100 |
| name | someName |
And user "Alice" has created the following space link share:
| space | edit space |
| permissionsRole | view |
| password | %public% |
| expirationDateTime | 2040-01-01T23:59:59.000Z |
| displayName | someName |
And user "Alice" has uploaded a file inside space "edit space" with content "some content" to "test.txt"
And using SharingNG
Scenario Outline: manager of the space can edit public link.
@@ -69,15 +71,17 @@ Feature: A manager of the space can edit public link
Scenario Outline: members of the space try to edit a public link
Given using OCS API version "2"
And user "Alice" has shared a space "edit space" with settings:
| shareWith | Brian |
| role | <space-role> |
And user "Alice" has sent the following space share invitation:
| space | edit space |
| sharee | Brian |
| shareType | user |
| permissionsRole | <space-role> |
When user "Brian" updates the last public link share using the sharing API with
| permissions | 15 |
Then the HTTP status code should be "<http-status-code>"
And the OCS status code should be "<ocs-status-code>"
Examples:
| space-role | http-status-code | ocs-status-code |
| manager | 200 | 200 |
| editor | 401 | 997 |
| viewer | 401 | 997 |
| space-role | http-status-code | ocs-status-code |
| Manager | 200 | 200 |
| Space Editor | 401 | 997 |
| Space Viewer | 401 | 997 |
@@ -46,7 +46,12 @@ Feature: Preview file in project space
Scenario Outline: download preview of shared file inside project space
Given user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has uploaded a file from "<source>" to "<destination>" via TUS inside of the space "previews of the files" using the WebDAV API
And user "Alice" has shared resource "<destination>" inside space "previews of the files" with user "Brian"
And user "Alice" has sent the following resource share invitation:
| resource | <destination> |
| space | previews of the files |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
When user "Brian" downloads the preview of shared resource "/Shares/<destination>" with width "32" and height "32" using the WebDAV API
Then the HTTP status code should be "200"
And the downloaded image should be "32" pixels wide and "32" pixels high
@@ -60,7 +65,12 @@ Feature: Preview file in project space
Given user "Brian" has been created with default attributes and without skeleton files
And user "Alice" has created a folder "folder" in space "previews of the files"
And user "Alice" has uploaded a file inside space "previews of the files" with content "test" to "/folder/lorem.txt"
And user "Alice" has shared resource "/folder" inside space "previews of the files" with user "Brian"
And user "Alice" has sent the following resource share invitation:
| resource | /folder |
| space | previews of the files |
| sharee | Brian |
| shareType | user |
| permissionsRole | Viewer |
When user "Brian" downloads the preview of shared resource "Shares/folder/lorem.txt" with width "32" and height "32" using the WebDAV API
Then the HTTP status code should be "200"
And the downloaded image should be "32" pixels wide and "32" pixels high
@@ -80,7 +80,12 @@ Feature: List and create spaces
Scenario: ordinary user can request information about their Space via the Graph API using a filter
Given user "Brian" has been created with default attributes and without skeleton files
And user "Brian" has created folder "folder"
And user "Brian" has shared folder "folder" with user "Alice" with permissions "15"
And user "Brian" has sent the following resource share invitation:
| resource | folder |
| space | Personal |
| sharee | Alice |
| shareType | user |
| permissionsRole | Viewer |
When user "Alice" lists all available spaces via the Graph API with query "$filter=driveType eq 'personal'"
Then the HTTP status code should be "200"
And the JSON response should contain space called "Alice Hansen" and match
@@ -441,7 +446,12 @@ Feature: List and create spaces
And user "Alice" has disabled auto-accepting
And user "Brian" has uploaded file with content "this is a test file." to "test.txt"
And the administrator has assigned the role "<user-role>" to user "Alice" using the Graph API
And user "Brian" has shared file "/test.txt" with user "Alice"
And user "Brian" has sent the following resource share invitation:
| resource | test.txt |
| space | Personal |
| sharee | Alice |
| shareType | user |
| permissionsRole | Viewer |
When user "Alice" lists all available spaces via the Graph API
Then the HTTP status code should be "200"
And the JSON response should contain space called "Shares" owned by "Alice" and match
@@ -9,8 +9,10 @@ Feature: public link for a space
And using spaces DAV path
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
And user "Alice" has created a space "public space" with the default quota using the Graph API
And user "Alice" has created a public link share of the space "public space" with settings:
| permissions | 1 |
And user "Alice" has created the following space link share:
| space | public space |
| permissionsRole | view |
And using SharingNG
Scenario: public tries to upload a file in the public space
@@ -19,26 +19,30 @@ Feature: Remove files, folder
Scenario Outline: user deletes a folder with some subfolders in a space via the webDav API
Given user "Alice" has shared a space "delete objects" with settings:
| shareWith | Brian |
| role | <space-role> |
Given user "Alice" has sent the following space share invitation:
| space | delete objects |
| sharee | Brian |
| shareType | user |
| permissionsRole | <space-role> |
When user "<user>" removes the folder "folderForDeleting" from space "delete objects"
Then the HTTP status code should be "<http-status-code>"
And for user "<user>" the space "delete objects" <should-or-not-be-in-space> contain these entries:
| folderForDeleting |
And as "<user>" folder "folderForDeleting" <should-or-not-be-in-trash> exist in the trashbin of the space "delete objects"
Examples:
| user | space-role | http-status-code | should-or-not-be-in-space | should-or-not-be-in-trash |
| Alice | manager | 204 | should not | should |
| Brian | manager | 204 | should not | should |
| Brian | editor | 204 | should not | should |
| Brian | viewer | 403 | should | should not |
| user | space-role | http-status-code | should-or-not-be-in-space | should-or-not-be-in-trash |
| Alice | Manager | 204 | should not | should |
| Brian | Manager | 204 | should not | should |
| Brian | Space Editor | 204 | should not | should |
| Brian | Space Viewer | 403 | should | should not |
Scenario Outline: user deletes a subfolder in a space via the webDav API
Given user "Alice" has shared a space "delete objects" with settings:
| shareWith | Brian |
| role | <space-role> |
Given user "Alice" has sent the following space share invitation:
| space | delete objects |
| sharee | Brian |
| shareType | user |
| permissionsRole | <space-role> |
When user "<user>" removes the folder "folderForDeleting/sub1" from space "delete objects"
Then the HTTP status code should be "<http-status-code>"
And for user "<user>" the space "delete objects" should contain these entries:
@@ -47,28 +51,30 @@ Feature: Remove files, folder
| sub1 |
And as "<user>" folder "sub1" <should-or-not-be-in-trash> exist in the trashbin of the space "delete objects"
Examples:
| user | space-role | http-status-code | should-or-not-be-in-space | should-or-not-be-in-trash |
| Alice | manager | 204 | should not | should |
| Brian | manager | 204 | should not | should |
| Brian | editor | 204 | should not | should |
| Brian | viewer | 403 | should | should not |
| user | space-role | http-status-code | should-or-not-be-in-space | should-or-not-be-in-trash |
| Alice | Manager | 204 | should not | should |
| Brian | Manager | 204 | should not | should |
| Brian | Space Editor | 204 | should not | should |
| Brian | Space Viewer | 403 | should | should not |
Scenario Outline: user deletes a file in a space via the webDav API
Given user "Alice" has shared a space "delete objects" with settings:
| shareWith | Brian |
| role | <space-role> |
Given user "Alice" has sent the following space share invitation:
| space | delete objects |
| sharee | Brian |
| shareType | user |
| permissionsRole | <space-role> |
When user "<user>" removes the file "text.txt" from space "delete objects"
Then the HTTP status code should be "<http-status-code>"
And for user "<user>" the space "delete objects" <should-or-not-be-in-space> contain these entries:
| text.txt |
And as "<user>" file "text.txt" <should-or-not-be-in-trash> exist in the trashbin of the space "delete objects"
Examples:
| user | space-role | http-status-code | should-or-not-be-in-space | should-or-not-be-in-trash |
| Alice | manager | 204 | should not | should |
| Brian | manager | 204 | should not | should |
| Brian | editor | 204 | should not | should |
| Brian | viewer | 403 | should | should not |
| user | space-role | http-status-code | should-or-not-be-in-space | should-or-not-be-in-trash |
| Alice | Manager | 204 | should not | should |
| Brian | Manager | 204 | should not | should |
| Brian | Space Editor | 204 | should not | should |
| Brian | Space Viewer | 403 | should | should not |
Scenario: try to delete an empty string folder from a space
@@ -153,7 +153,7 @@ class PublicWebDavContext implements Context {
* @return ResponseInterface
*/
public function deleteFileFromPublicShare(string $fileName, string $publicWebDAVAPIVersion, string $password = ""):ResponseInterface {
$token = $this->featureContext->getLastCreatedPublicShareToken();
$token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken();
$davPath = WebDavHelper::getDavPath(
$token,
0,
@@ -304,7 +304,8 @@ class PublicWebDavContext implements Context {
$path,
$password,
"",
$publicWebDAVAPIVersion
$publicWebDAVAPIVersion,
$this->featureContext->isUsingSharingNG()
);
$this->featureContext->setResponse($response);
}
@@ -1609,7 +1610,7 @@ class PublicWebDavContext implements Context {
string $destination,
string $password
):ResponseInterface {
$token = $this->featureContext->getLastCreatedPublicShareToken();
$token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken();
$davPath = WebDavHelper::getDavPath(
$token,
0,
@@ -577,7 +577,7 @@ class SharingNgContext implements Context {
*/
public function userHasCreatedTheFollowingLinkShare(string $user, TableNode $body): void {
$rows = $body->getRowsHash();
Assert::assertArrayHasKey("resource", $rows, "'resource' should not be provided in the data-table while sharing a space");
Assert::assertArrayNotHasKey("resource", $rows, "'resource' should not be provided in the data-table while sharing a space");
$response = $this->createDriveLinkShare($user, $body);
$this->featureContext->theHTTPStatusCodeShouldBe(200, "Failed while creating public share link!", $response);
$this->featureContext->shareNgAddToCreatedLinkShares($response);
@@ -3449,7 +3449,7 @@ class SpacesContext implements Context {
if ($should) {
Assert::assertNotEmpty($responseArray, __METHOD__ . ' Response should contain a link, but it is empty');
foreach ($responseArray as $element) {
$expectedLinkId = (string) $this->featureContext->getLastCreatedPublicShare()->id;
$expectedLinkId = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareID() : (string) $this->featureContext->getLastCreatedPublicShare()->id;
Assert::assertEquals($element["id"], $expectedLinkId, "link IDs are different");
}
} else {