From 5f577409761914946122bd65b552b9892b71e2e6 Mon Sep 17 00:00:00 2001 From: Sabin Panta <64484313+S-Panta@users.noreply.github.com> Date: Fri, 9 Feb 2024 14:02:38 +0545 Subject: [PATCH] [tests-only][full-ci]resourcetype variable deleted from testcode (#8370) * resourcetype variable deleted from testcode * updated expected failures file * addressing review --- ...ected-failures-localAPI-on-OCIS-storage.md | 26 ++++---- .../apiSharingNg/deletePermissions.feature | 64 ++++++++----------- .../features/apiSharingNg/linkShare.feature | 16 ----- .../features/bootstrap/SharingNgContext.php | 32 ++-------- 4 files changed, 48 insertions(+), 90 deletions(-) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 6f729a599a..b8789d196a 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -249,19 +249,19 @@ The expected failures in this file are from features in the owncloud/ocis repo. ### [blocksDownload link type is not implemented yet (sharing-ng)](https://github.com/owncloud/ocis/issues/7879) -- [apiSharingNg/linkShare.feature:79](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L79) -- [apiSharingNg/linkShare.feature:149](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L149) -- [apiSharingNg/linkShare.feature:228](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L228) -- [apiSharingNg/linkShare.feature:305](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L305) -- [apiSharingNg/linkShare.feature:377](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L377) -- [apiSharingNg/linkShare.feature:451](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L451) -- [apiSharingNg/linkShare.feature:453](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L453) -- [apiSharingNg/linkShare.feature:455](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L455) -- [apiSharingNg/linkShare.feature:456](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L456) -- [apiSharingNg/deletePermissions.feature:130](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L130) -- [apiSharingNg/deletePermissions.feature:147](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L147) -- [apiSharingNg/deletePermissions.feature:168](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L168) -- [apiSharingNg/deletePermissions.feature:187](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L187) +- [apiSharingNg/linkShare.feature:78](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L78) +- [apiSharingNg/linkShare.feature:147](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L147) +- [apiSharingNg/linkShare.feature:225](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L225) +- [apiSharingNg/linkShare.feature:301](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L301) +- [apiSharingNg/linkShare.feature:372](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L372) +- [apiSharingNg/linkShare.feature:444](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L444) +- [apiSharingNg/linkShare.feature:446](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L446) +- [apiSharingNg/linkShare.feature:448](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L448) +- [apiSharingNg/linkShare.feature:449](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/linkShare.feature#L449) +- [apiSharingNg/deletePermissions.feature:125](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L125) +- [apiSharingNg/deletePermissions.feature:141](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L141) +- [apiSharingNg/deletePermissions.feature:161](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L161) +- [apiSharingNg/deletePermissions.feature:179](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg/deletePermissions.feature#L179) ### [sharee (editor role) MOVE a file by file-id into same shared folder returns 403](https://github.com/owncloud/ocis/issues/7617) diff --git a/tests/acceptance/features/apiSharingNg/deletePermissions.feature b/tests/acceptance/features/apiSharingNg/deletePermissions.feature index 222514e4c4..ffc90cb127 100644 --- a/tests/acceptance/features/apiSharingNg/deletePermissions.feature +++ b/tests/acceptance/features/apiSharingNg/deletePermissions.feature @@ -13,23 +13,22 @@ Feature: Remove access to a drive item Given user "Alice" has created folder "FolderToShare" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile.txt" And user "Alice" has sent the following share invitation: - | resourceType | | | resource | | | space | Personal | | sharee | Brian | | shareType | user | | permissionsRole | | - When user "Alice" removes the share permission of user "Brian" from "" of space "Personal" using the Graph API + When user "Alice" removes the share permission of user "Brian" from resource "" of space "Personal" using the Graph API Then the HTTP status code should be "204" And for user "Brian" the space "Shares" should not contain these entries: | | Examples: - | permissionsRole | resource-type | path | - | Viewer | file | textfile.txt | - | File Editor | file | textfile.txt | - | Viewer | folder | FolderToShare | - | Editor | folder | FolderToShare | - | Uploader | folder | FolderToShare | + | permissionsRole | path | + | Viewer | textfile.txt | + | File Editor | textfile.txt | + | Viewer | FolderToShare | + | Editor | FolderToShare | + | Uploader | FolderToShare | Scenario Outline: user removes access to resource inside of a project space in the user share @@ -38,23 +37,22 @@ Feature: Remove access to a drive item And user "Alice" has created a folder "FolderToShare" in space "NewSpace" And user "Alice" has uploaded a file inside space "NewSpace" with content "some content" to "textfile.txt" And user "Alice" has sent the following share invitation: - | resourceType | | | resource | | | space | NewSpace | | sharee | Brian | | shareType | user | | permissionsRole | | - When user "Alice" removes the share permission of user "Brian" from "" of space "NewSpace" using the Graph API + When user "Alice" removes the share permission of user "Brian" from resource "" of space "NewSpace" using the Graph API Then the HTTP status code should be "204" And for user "Brian" the space "Shares" should not contain these entries: | | Examples: - | permissionsRole | resource-type | path | - | Viewer | file | textfile.txt | - | File Editor | file | textfile.txt | - | Viewer | folder | FolderToShare | - | Editor | folder | FolderToShare | - | Uploader | folder | FolderToShare | + | permissionsRole | path | + | Viewer | textfile.txt | + | File Editor | textfile.txt | + | Viewer | FolderToShare | + | Editor | FolderToShare | + | Uploader | FolderToShare | Scenario Outline: user removes access to a resource in a group share @@ -64,23 +62,22 @@ Feature: Remove access to a drive item And user "Alice" has created folder "FolderToShare" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile.txt" And user "Alice" has sent the following share invitation: - | resourceType | | | resource | | | space | Personal | | sharee | group1 | | shareType | group | | permissionsRole | | - When user "Alice" removes the share permission of group "group1" from "" of space "Personal" using the Graph API + When user "Alice" removes the share permission of group "group1" from resource "" of space "Personal" using the Graph API Then the HTTP status code should be "204" And for user "Brian" the space "Shares" should not contain these entries: | | Examples: - | permissionsRole | resource-type | path | - | Viewer | file | textfile.txt | - | File Editor | file | textfile.txt | - | Viewer | folder | FolderToShare | - | Editor | folder | FolderToShare | - | Uploader | folder | FolderToShare | + | permissionsRole | path | + | Viewer | textfile.txt | + | File Editor | textfile.txt | + | Viewer | FolderToShare | + | Editor | FolderToShare | + | Uploader | FolderToShare | Scenario Outline: user removes access to a resource inside of a project space in group share @@ -92,29 +89,27 @@ Feature: Remove access to a drive item And user "Brian" has been added to group "group1" And user "Alice" has been added to group "group1" And user "Alice" has sent the following share invitation: - | resourceType | | | resource | | | space | NewSpace | | sharee | group1 | | shareType | group | | permissionsRole | | - When user "Alice" removes the share permission of group "group1" from "" of space "NewSpace" using the Graph API + When user "Alice" removes the share permission of group "group1" from resource "" of space "NewSpace" using the Graph API Then the HTTP status code should be "204" And for user "Brian" the space "Shares" should not contain these entries: | | Examples: - | permissionsRole | resource-type | path | - | Viewer | file | textfile.txt | - | File Editor | file | textfile.txt | - | Viewer | folder | FolderToShare | - | Editor | folder | FolderToShare | - | Uploader | folder | FolderToShare | + | permissionsRole | path | + | Viewer | textfile.txt | + | File Editor | textfile.txt | + | Viewer | FolderToShare | + | Editor | FolderToShare | + | Uploader | FolderToShare | Scenario Outline: user removes access to a folder in link share Given user "Alice" has created folder "FolderToShare" And user "Alice" has created the following link share: - | resourceType | folder | | resource | FolderToShare | | space | Personal | | permissionsRole | | @@ -133,7 +128,6 @@ Feature: Remove access to a drive item Scenario Outline: user removes access to a file in link share Given user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile.txt" And user "Alice" has created the following link share: - | resourceType | file | | resource | textfile.txt | | space | Personal | | permissionsRole | | @@ -152,7 +146,6 @@ Feature: Remove access to a drive item And user "Alice" has created a space "NewSpace" with the default quota using the Graph API And user "Alice" has created a folder "FolderToShare" in space "NewSpace" And user "Alice" has created the following link share: - | resourceType | folder | | resource | FolderToShare | | space | NewSpace | | permissionsRole | | @@ -173,7 +166,6 @@ Feature: Remove access to a drive item And user "Alice" has created a space "NewSpace" with the default quota using the Graph API And user "Alice" has uploaded a file inside space "NewSpace" with content "some content" to "textfile.txt" And user "Alice" has created the following link share: - | resourceType | file | | resource | textfile.txt | | space | NewSpace | | permissionsRole | | diff --git a/tests/acceptance/features/apiSharingNg/linkShare.feature b/tests/acceptance/features/apiSharingNg/linkShare.feature index b7259c17a9..23a419d97d 100644 --- a/tests/acceptance/features/apiSharingNg/linkShare.feature +++ b/tests/acceptance/features/apiSharingNg/linkShare.feature @@ -10,7 +10,6 @@ Feature: Create a share link for a resource Scenario Outline: create a link share of a folder Given user "Alice" has created folder "folder" When user "Alice" creates the following link share using the Graph API: - | resourceType | folder | | resource | folder | | space | Personal | | permissionsRole | | @@ -82,7 +81,6 @@ Feature: Create a share link for a resource Scenario Outline: create a link share of a file Given user "Alice" has uploaded file with content "other data" to "textfile1.txt" When user "Alice" creates the following link share using the Graph API: - | resourceType | file | | resource | textfile1.txt | | space | Personal | | permissionsRole | | @@ -152,7 +150,6 @@ Feature: Create a share link for a resource Scenario Outline: create a link share of a folder with display name and expiry date Given user "Alice" has created folder "folder" When user "Alice" creates the following link share using the Graph API: - | resourceType | folder | | resource | folder | | space | Personal | | permissionsRole | | @@ -231,7 +228,6 @@ Feature: Create a share link for a resource Scenario Outline: create a link share of a file with display name and expiry date Given user "Alice" has uploaded file with content "other data" to "textfile1.txt" When user "Alice" creates the following link share using the Graph API: - | resourceType | file | | resource | textfile1.txt | | space | Personal | | permissionsRole | | @@ -311,7 +307,6 @@ Feature: Create a share link for a resource | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false | And user "Alice" has uploaded file with content "other data" to "textfile1.txt" When user "Alice" creates the following link share using the Graph API: - | resourceType | file | | resource | textfile1.txt | | space | Personal | | permissionsRole | | @@ -380,13 +375,11 @@ Feature: Create a share link for a resource Scenario Outline: update role of a file's link share Given user "Alice" has uploaded file with content "other data" to "textfile1.txt" And user "Alice" has created the following link share: - | resourceType | file | | resource | textfile1.txt | | space | Personal | | permissionsRole | | | password | %public% | When user "Alice" updates the last public link share using the Graph API with - | resourceType | file | | resource | textfile1.txt | | space | Personal | | permissionsRole | | @@ -460,14 +453,12 @@ Feature: Create a share link for a resource Scenario: update expiration date of a file's link share Given user "Alice" has uploaded file with content "other data" to "textfile1.txt" And user "Alice" has created the following link share: - | resourceType | file | | resource | textfile1.txt | | space | Personal | | permissionsRole | view | | password | %public% | | expirationDateTime | 2200-07-15T14:00:00.000Z | When user "Alice" updates the last public link share using the Graph API with - | resourceType | file | | resource | textfile1.txt | | space | Personal | | expirationDateTime | 2201-07-15T14:00:00.000Z | @@ -534,12 +525,10 @@ Feature: Create a share link for a resource | OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD | false | And user "Alice" has uploaded file with content "other data" to "textfile1.txt" And user "Alice" has created the following link share: - | resourceType | file | | resource | textfile1.txt | | space | Personal | | permissionsRole | view | When user "Alice" sets the following password for the last link share using the Graph API: - | resourceType | file | | resource | textfile1.txt | | space | Personal | | password | %public% | @@ -564,13 +553,11 @@ Feature: Create a share link for a resource Scenario: update password of a file's link share Given user "Alice" has uploaded file with content "other data" to "textfile1.txt" And user "Alice" has created the following link share: - | resourceType | file | | resource | textfile1.txt | | space | Personal | | permissionsRole | view | | password | $heLlo*1234* | When user "Alice" sets the following password for the last link share using the Graph API: - | resourceType | file | | resource | textfile1.txt | | space | Personal | | password | %public% | @@ -598,7 +585,6 @@ Feature: Create a share link for a resource Given the config "OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" has been set to path "config/drone/banned-password-list.txt" And user "Alice" has uploaded file with content "other data" to "text.txt" When user "Alice" creates the following link share using the Graph API: - | resourceType | file | | resource | text.txt | | space | Personal | | permissionsRole | view | @@ -645,13 +631,11 @@ Feature: Create a share link for a resource Given the config "OCIS_PASSWORD_POLICY_BANNED_PASSWORDS_LIST" has been set to path "config/drone/banned-password-list.txt" And user "Alice" has uploaded file with content "other data" to "text.txt" And user "Alice" has created the following link share: - | resourceType | file | | resource | text.txt | | space | Personal | | permissionsRole | view | | password | %public% | When user "Alice" sets the following password for the last link share using the Graph API: - | resourceType | file | | resource | text.txt | | space | Personal | | permissionsRole | view | diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index bdd91d4d59..4c6453ea1d 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -65,15 +65,10 @@ class SharingNgContext implements Context { public function createLinkShare(string $user, TableNode $body): ResponseInterface { $bodyRows = $body->getRowsHash(); $space = $bodyRows['space']; - $resourceType = $bodyRows['resourceType']; $resource = $bodyRows['resource']; $spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"]; - if ($resourceType === 'folder') { - $itemId = $this->spacesContext->getResourceId($user, $space, $resource); - } else { - $itemId = $this->spacesContext->getFileId($user, $space, $resource); - } + $itemId = $this->spacesContext->getResourceId($user, $space, $resource); $bodyRows['displayName'] = $bodyRows['displayName'] ?? null; $bodyRows['expirationDateTime'] = $bodyRows['expirationDateTime'] ?? null; @@ -399,14 +394,9 @@ class SharingNgContext implements Context { public function userSetsOrUpdatesFollowingPasswordForLastLinkShareUsingTheGraphApi(string $user, TableNode $body):void { $bodyRows = $body->getRowsHash(); $space = $bodyRows['space']; - $resourceType = $bodyRows['resourceType']; $resource = $bodyRows['resource']; $spaceId = ($this->spacesContext->getSpaceByName($user, $space))["id"]; - if ($resourceType === 'folder') { - $itemId = $this->spacesContext->getResourceId($user, $space, $resource); - } else { - $itemId = $this->spacesContext->getFileId($user, $space, $resource); - } + $itemId = $this->spacesContext->getResourceId($user, $space, $resource); if (\array_key_exists('password', $bodyRows)) { $body = [ @@ -432,7 +422,6 @@ class SharingNgContext implements Context { /** * @param string $sharer * @param string $shareType (user|group) - * @param string $resourceType * @param string $resource * @param string $space * @param string|null $sharee can be both user or group @@ -444,15 +433,12 @@ class SharingNgContext implements Context { public function removeSharePermission( string $sharer, string $shareType, - string $resourceType, string $resource, string $space, ?string $sharee = null ): ResponseInterface { $spaceId = ($this->spacesContext->getSpaceByName($sharer, $space))["id"]; - $itemId = ($resourceType === 'folder') - ? $this->spacesContext->getResourceId($sharer, $space, $resource) - : $this->spacesContext->getFileId($sharer, $space, $resource); + $itemId = $this->spacesContext->getResourceId($sharer, $space, $resource); $permId = ($shareType === 'link') ? $this->featureContext->shareNgGetLastCreatedLinkShareID() @@ -470,12 +456,11 @@ class SharingNgContext implements Context { } /** - * @When /^user "([^"]*)" removes the share permission of (user|group) "([^"]*)" from (file|folder) "([^"]*)" of space "([^"]*)" using the Graph API$/ + * @When /^user "([^"]*)" removes the share permission of (user|group) "([^"]*)" from (?:file|folder|resource) "([^"]*)" of space "([^"]*)" using the Graph API$/ * * @param string $sharer * @param string $shareType (user|group) * @param string $sharee can be both user or group - * @param string $resourceType * @param string $resource * @param string $space * @@ -487,20 +472,18 @@ class SharingNgContext implements Context { string $sharer, string $shareType, string $sharee, - string $resourceType, string $resource, string $space ): void { $this->featureContext->setResponse( - $this->removeSharePermission($sharer, $shareType, $resourceType, $resource, $space) + $this->removeSharePermission($sharer, $shareType, $resource, $space) ); } /** - * @When /^user "([^"]*)" removes the share permission of link from (file|folder) "([^"]*)" of space "([^"]*)" using the Graph API$/ + * @When /^user "([^"]*)" removes the share permission of link from (?:file|folder) "([^"]*)" of space "([^"]*)" using the Graph API$/ * * @param string $sharer - * @param string $resourceType * @param string $resource * @param string $space * @@ -510,12 +493,11 @@ class SharingNgContext implements Context { */ public function userRemovesSharePermissionOfAResourceInLinkShareUsingGraphAPI( string $sharer, - string $resourceType, string $resource, string $space ):void { $this->featureContext->setResponse( - $this->removeSharePermission($sharer, 'link', $resourceType, $resource, $space) + $this->removeSharePermission($sharer, 'link', $resource, $space) ); }