From b4e991bf63291135d86d483bc9032b34261bbe5d Mon Sep 17 00:00:00 2001 From: Sawjan Gurung Date: Tue, 7 May 2024 12:26:59 +0545 Subject: [PATCH] [tests-only] extend group sharing and MOVE api tests (#9083) * test: add more COPY/MOVE tests * test: add sharing to group edgecase tests * test: new line * test: fix typo * test: update expected failure --- .../expected-failures-API-on-OCIS-storage.md | 8 +- .../apiSharingNg/shareInvitations.feature | 94 ++++++++++++++++ .../coreApiWebdavMove2/moveFile.feature | 104 ++++++++++++++++++ .../coreApiWebdavProperties/copyFile.feature | 26 +++++ 4 files changed, 228 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 4151817f41..3306a9fa4f 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -353,9 +353,9 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [coreApiWebdavUpload/uploadFile.feature:181](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature#L181) - [coreApiWebdavUpload/uploadFile.feature:180](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature#L180) - [coreApiWebdavUpload/uploadFile.feature:186](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature#L186) -- [coreApiWebdavMove2/moveFile.feature:196](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L196) -- [coreApiWebdavMove2/moveFile.feature:197](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L197) -- [coreApiWebdavMove2/moveFile.feature:202](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L202) +- [coreApiWebdavMove2/moveFile.feature:217](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L217) +- [coreApiWebdavMove2/moveFile.feature:218](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L218) +- [coreApiWebdavMove2/moveFile.feature:223](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L223) #### [cannot set blacklisted file names](https://github.com/owncloud/product/issues/260) @@ -396,7 +396,7 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [coreApiWebdavMove1/moveFolder.feature:44](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature#L44) - [coreApiWebdavMove1/moveFolder.feature:62](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature#L62) - [coreApiWebdavMove1/moveFolder.feature:80](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature#L80) -- [coreApiWebdavMove2/moveFile.feature:158](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L158) +- [coreApiWebdavMove2/moveFile.feature:179](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L179) - [coreApiWebdavMove2/moveFileToBlacklistedName.feature:24](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFileToBlacklistedName.feature#L24) #### [REPORT method on spaces returns an incorrect d:href response](https://github.com/owncloud/ocis/issues/3111) diff --git a/tests/acceptance/features/apiSharingNg/shareInvitations.feature b/tests/acceptance/features/apiSharingNg/shareInvitations.feature index 42b77a59ba..59c3ba57bc 100644 --- a/tests/acceptance/features/apiSharingNg/shareInvitations.feature +++ b/tests/acceptance/features/apiSharingNg/shareInvitations.feature @@ -3215,3 +3215,97 @@ Feature: Send a sharing invitations | Space Viewer | group | | Space Editor | group | | Manager | group | + + + Scenario: share a file to user and group having same name (Personal space) + Given user "Carol" has been created with default attributes and without skeleton files + And group "Brian" has been created + And the following users have been added to the following groups + | username | groupname | + | Carol | Brian | + And user "Alice" has uploaded file with content "lorem" to "textfile.txt" + When user "Alice" sends the following share invitation using the Graph API: + | resource | textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + Then the HTTP status code should be "200" + And for user "Brian" the space Shares should contain these entries: + | textfile.txt | + When user "Alice" sends the following share invitation using the Graph API: + | resource | textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | group | + | permissionsRole | Viewer | + Then the HTTP status code should be "200" + And for user "Carol" the space Shares should contain these entries: + | textfile.txt | + + + Scenario: share a file to group containing special characters in name (Personal space) + Given group "?\?@#%@;" has been created + And the following users have been added to the following groups + | username | groupname | + | Brian | ?\?@#%@; | + And user "Alice" has uploaded file with content "lorem" to "textfile.txt" + When user "Alice" sends the following share invitation using the Graph API: + | resource | textfile.txt | + | space | Personal | + | sharee | ?\?@#%@; | + | shareType | group | + | permissionsRole | Viewer | + Then the HTTP status code should be "200" + And for user "Brian" the space Shares should contain these entries: + | textfile.txt | + + + Scenario: share a file to user and group having same name (Project space) + Given using spaces DAV path + And user "Carol" has been created with default attributes and without skeleton files + And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API + 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 "lorem" to "textfile.txt" + And group "Brian" has been created + And the following users have been added to the following groups + | username | groupname | + | Carol | Brian | + When user "Alice" sends the following share invitation using the Graph API: + | resource | textfile.txt | + | space | NewSpace | + | sharee | Brian | + | shareType | user | + | permissionsRole | Viewer | + Then the HTTP status code should be "200" + And for user "Brian" the space Shares should contain these entries: + | textfile.txt | + When user "Alice" sends the following share invitation using the Graph API: + | resource | textfile.txt | + | space | NewSpace | + | sharee | Brian | + | shareType | group | + | permissionsRole | Viewer | + Then the HTTP status code should be "200" + And for user "Carol" the space Shares should contain these entries: + | textfile.txt | + + + Scenario: share a file to group containing special characters in name (Project space) + Given 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 "NewSpace" with the default quota using the Graph API + And user "Alice" has uploaded a file inside space "NewSpace" with content "lorem" to "textfile.txt" + And group "?\?@#%@;" has been created + And the following users have been added to the following groups + | username | groupname | + | Brian | ?\?@#%@; | + When user "Alice" sends the following share invitation using the Graph API: + | resource | textfile.txt | + | space | NewSpace | + | sharee | ?\?@#%@; | + | shareType | group | + | permissionsRole | Viewer | + Then the HTTP status code should be "200" + And for user "Brian" the space Shares should contain these entries: + | textfile.txt | diff --git a/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature b/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature index 6198535f36..f38da37836 100644 --- a/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature +++ b/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature @@ -126,6 +126,27 @@ Feature: move (rename) file | spaces | + Scenario Outline: move a file to existing file name + Given using DAV path + And user "Alice" has uploaded file with content "test file" to "testfile.txt" + And user "Alice" has uploaded file with content "some content" to "lorem.txt" + When user "Alice" moves file "testfile.txt" to "lorem.txt" using the WebDAV API + Then the HTTP status code should be "204" + And as "Alice" file "lorem.txt" should exist + And the content of file "lorem.txt" for user "Alice" should be "test file" + But as "Alice" file "testfile.txt" should not exist + And as "Alice" the file with original path "lorem.txt" should exist in the trashbin + Examples: + | dav-path-version | + | old | + | new | + + @skipOnRevaMaster + Examples: + | dav-path-version | + | spaces | + + Scenario Outline: move file into a not-existing folder Given using DAV path And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "fileToMove.txt" @@ -487,3 +508,86 @@ Feature: move (rename) file Examples: | dav-path-version | | spaces | + + + Scenario Outline: rename file to/from special characters + Given using DAV path + And user "Alice" has uploaded file with content "test file" to + When user "Alice" moves file to using the WebDAV API + Then the HTTP status code should be "201" + And as "Alice" file should exist + But as "Alice" file should not exist + Examples: + | dav-path-version | from-file-name | to-file-name | + | old | "testfile.txt" | "'single'quotes.txt" | + | old | "testfile.txt" | '"double"quotes.txt' | + | old | "testfile.txt" | "strängé नेपाली.txt" | + | old | "testfile.txt" | "file,comma.txt" | + | old | "testfile.txt" | " start with space.txt" | + | old | "'single'quotes.txt" | "testfile.txt" | + | old | '"double"quotes.txt' | "testfile.txt" | + | old | "strängé नेपाली.txt" | "testfile.txt" | + | old | "file,comma.txt" | "testfile.txt" | + | old | " start with space.txt" | "testfile.txt" | + | new | "testfile.txt" | "'single'quotes.txt" | + | new | "testfile.txt" | '"double"quotes.txt' | + | new | "testfile.txt" | "strängé नेपाली.txt" | + | new | "testfile.txt" | "file,comma.txt" | + | new | "testfile.txt" | " start with space.txt" | + | new | "'single'quotes.txt" | "testfile.txt" | + | new | '"double"quotes.txt' | "testfile.txt" | + | new | "strängé नेपाली.txt" | "testfile.txt" | + | new | "file,comma.txt" | "testfile.txt" | + | new | " start with space.txt" | "testfile.txt" | + + @skipOnRevaMaster + Examples: + | dav-path-version | from-file-name | to-file-name | + | spaces | "testfile.txt" | "'single'quotes.txt" | + | spaces | "testfile.txt" | '"double"quotes.txt' | + | spaces | "testfile.txt" | "strängé नेपाली.txt" | + | spaces | "testfile.txt" | "file,comma.txt" | + | spaces | "testfile.txt" | " start with space.txt" | + | spaces | "'single'quotes.txt" | "testfile.txt" | + | spaces | '"double"quotes.txt' | "testfile.txt" | + | spaces | "strängé नेपाली.txt" | "testfile.txt" | + | spaces | "file,comma.txt" | "testfile.txt" | + | spaces | " start with space.txt" | "testfile.txt" | + + + Scenario Outline: try to rename file to name having white space at the end + Given using DAV path + And user "Alice" has uploaded file with content "test file" to "testfile.txt" + When user "Alice" moves file "testfile.txt" to "space at end " using the WebDAV API + Then the HTTP status code should be "201" + And as "Alice" file "space at end" should exist + But as "Alice" file "testfile.txt" should not exist + And as "Alice" file "space at end " should not exist + Examples: + | dav-path-version | + | old | + | new | + + @skipOnRevaMaster + Examples: + | dav-path-version | + | spaces | + + + Scenario Outline: try to rename file to . and .. + Given using DAV path + And user "Alice" has uploaded file with content "test file" to "testfile.txt" + When user "Alice" moves file "testfile.txt" to "" using the WebDAV API + Then the HTTP status code should be "" + Examples: + | dav-path-version | file-name | http-status-code | + | old | /. | 409 | + | old | /.. | 404 | + | new | /. | 409 | + | new | /.. | 404 | + + @skipOnRevaMaster + Examples: + | dav-path-version | file-name | http-status-code | + | spaces | /. | 409 | + | spaces | /.. | 400 | diff --git a/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature b/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature index 0a349c617d..821264351b 100644 --- a/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature +++ b/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature @@ -854,3 +854,29 @@ Feature: copy file Examples: | dav-path-version | | spaces | + + + Scenario Outline: copy a file into a folder with special characters + Given using DAV path + And user "Alice" has created folder + And user "Alice" has uploaded file with content "test file" to + When user "Alice" copies file to using the WebDAV API + Then the HTTP status code should be "201" + And as "Alice" file should exist + And as "Alice" file should exist + And as "Alice" folder should exist + Examples: + | dav-path-version | file-name | folder-name | destination | + | old | "'single'" | "folder-'single'" | "folder-'single'/'single'" | + | old | "question?" | "folder-question?" | "folder-question?/question?" | + | old | "&and#hash" | "folder-&and#hash" | "folder-&and#hash/&and#hash" | + | new | "'single'" | "folder-'single'" | "folder-'single'/'single'" | + | new | "question?" | "folder-question?" | "folder-question?/question?" | + | new | "&and#hash" | "folder-&and#hash" | "folder-&and#hash/&and#hash" | + + @skipOnRevaMaster + Examples: + | dav-path-version | file-name | folder-name | destination | + | spaces | "'single'" | "folder-'single'" | "folder-'single'/'single'" | + | spaces | "question?" | "folder-question?" | "folder-question?/question?" | + | spaces | "&and#hash" | "folder-&and#hash" | "folder-&and#hash/&and#hash" |