diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index ee9ded0ae..25b8aaad6 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -343,9 +343,9 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [coreApiWebdavProperties/copyFile.feature:115](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L115) - [coreApiWebdavProperties/copyFile.feature:116](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L116) - [coreApiWebdavProperties/copyFile.feature:121](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L121) -- [coreApiWebdavProperties/createFileFolder.feature:97](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L97) -- [coreApiWebdavProperties/createFileFolder.feature:98](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L98) -- [coreApiWebdavProperties/createFileFolder.feature:103](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L103) +- [coreApiWebdavProperties/createFileFolder.feature:106](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L106) +- [coreApiWebdavProperties/createFileFolder.feature:107](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L107) +- [coreApiWebdavProperties/createFileFolder.feature:112](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L112) - [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) diff --git a/tests/acceptance/features/apiSharingNg/sharedByMe.feature b/tests/acceptance/features/apiSharingNg/sharedByMe.feature index 76a2a3873..08e8419dd 100644 --- a/tests/acceptance/features/apiSharingNg/sharedByMe.feature +++ b/tests/acceptance/features/apiSharingNg/sharedByMe.feature @@ -1950,3 +1950,1472 @@ Feature: resources shared by user } } """ + + + Scenario: sharer lists the file link share (Personal space) + Given user "Alice" has uploaded file with content "hello world" to "textfile.txt" + And user "Alice" has created the following resource link share: + | resource | textfile.txt | + | space | Personal | + | permissionsRole | view | + | password | %public% | + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should contain resource "textfile.txt" with the following data: + """ + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "file", + "lastModifiedDateTime", + "size" + ], + "properties": { + "name": { + "const": "textfile.txt" + }, + "file": { + "type": "object", + "required": ["mimeType"] + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%space_id_pattern%$" + }, + "driveType": { + "const": "personal" + }, + "path": { + "const": "/" + }, + "name": { + "const": "/" + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "@libre.graph.displayName": { + "const": "" + }, + "@libre.graph.quickLink": { + "const": false + }, + "preventsDownload": { + "const": false + }, + "type": { + "const": "view" + }, + "webUrl": { + "type": "string", + "pattern": "^%base_url%/s/[a-zA-Z]+$" + } + } + }, + "id": { + "type": "string", + "pattern": "[a-zA-Z]+" + }, + "hasPassword": { + "const": true + } + } + } + } + } + } + """ + + + Scenario: sharer lists the folder link share (Personal space) + Given user "Alice" has created folder "FolderToShare" + And user "Alice" has created the following resource link share: + | resource | FolderToShare | + | space | Personal | + | permissionsRole | edit | + | password | %public% | + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should contain resource "FolderToShare" with the following data: + """ + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "folder", + "lastModifiedDateTime", + "size" + ], + "properties": { + "name": { + "const": "FolderToShare" + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "folder": { + "const": {} + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%space_id_pattern%$" + }, + "driveType": { + "const": "personal" + }, + "path": { + "const": "/" + }, + "name": { + "const": "/" + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "@libre.graph.displayName": { + "const": "" + }, + "@libre.graph.quickLink": { + "const": false + }, + "preventsDownload": { + "const": false + }, + "type": { + "const": "edit" + }, + "webUrl": { + "type": "string", + "pattern": "^%base_url%/s/[a-zA-Z]+$" + } + } + }, + "id": { + "type": "string", + "pattern": "[a-zA-Z]+" + }, + "hasPassword": { + "const": true + } + } + } + } + } + } + """ + + + Scenario: sharer lists the link shares of same name files (Personal space) + Given user "Alice" has uploaded file with content "hello world" to "textfile.txt" + And user "Alice" has created folder "FolderToShare" + And user "Alice" has uploaded file with content "hello world" to "FolderToShare/textfile.txt" + And user "Alice" has created the following resource link share: + | resource | textfile.txt | + | space | Personal | + | permissionsRole | edit | + | password | %public% | + And user "Alice" has created the following resource link share: + | resource | FolderToShare/textfile.txt | + | space | Personal | + | permissionsRole | view | + | password | %public% | + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "file" + ], + "properties": { + "name": { + "const": "textfile.txt" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveType": { + "const": "personal" + }, + "path": { + "const": "/" + }, + "name": { + "const": "/" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "type": { + "const": "edit" + } + } + } + } + } + } + } + }, + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "file" + ], + "properties": { + "name": { + "const": "textfile.txt" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveType": { + "const": "personal" + }, + "path": { + "const": "/FolderToShare" + }, + "name": { + "const": "FolderToShare" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "type": { + "const": "view" + } + } + } + } + } + } + } + } + ] + } + } + } + } + """ + + + Scenario: sharer lists the link shares of same name folders (Personal space) + Given user "Alice" has uploaded file with content "hello world" to "textfile.txt" + And user "Alice" has created folder "FolderToShare" + And user "Alice" has created folder "parent" + And user "Alice" has created folder "parent/FolderToShare" + And user "Alice" has created the following resource link share: + | resource | FolderToShare | + | space | Personal | + | permissionsRole | edit | + | password | %public% | + And user "Alice" has created the following resource link share: + | resource | parent/FolderToShare | + | space | Personal | + | permissionsRole | view | + | password | %public% | + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "folder" + ], + "properties": { + "name": { + "const": "FolderToShare" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveType": { + "const": "personal" + }, + "path": { + "const": "/" + }, + "name": { + "const": "/" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "type": { + "const": "edit" + } + } + } + } + } + } + } + }, + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "folder" + ], + "properties": { + "name": { + "const": "FolderToShare" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveType": { + "const": "personal" + }, + "path": { + "const": "/parent" + }, + "name": { + "const": "parent" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "type": { + "const": "view" + } + } + } + } + } + } + } + } + ] + } + } + } + } + """ + + + Scenario: sharer lists the link shares of a file after deleting one link share (Personal space) + Given user "Alice" has uploaded file with content "hello world" to "textfile.txt" + And user "Alice" has created the following resource link share: + | resource | textfile.txt | + | space | Personal | + | permissionsRole | edit | + | password | %public% | + And user "Alice" has created the following resource link share: + | resource | textfile.txt | + | space | Personal | + | permissionsRole | view | + | password | %public% | + And user "Alice" has removed the last link share of file "textfile.txt" from space "Personal" + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "file" + ], + "properties": { + "name": { + "const": "textfile.txt" + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "type": { + "const": "edit" + } + } + } + } + } + } + } + } + } + } + } + """ + + + Scenario: sharer lists the link shares of a folder after deleting one link share (Personal space) + And user "Alice" has created folder "FolderToShare" + And user "Alice" has created the following resource link share: + | resource | FolderToShare | + | space | Personal | + | permissionsRole | edit | + | password | %public% | + And user "Alice" has created the following resource link share: + | resource | FolderToShare | + | space | Personal | + | permissionsRole | view | + | password | %public% | + And user "Alice" has removed the last link share of folder "FolderToShare" from space "Personal" + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "folder" + ], + "properties": { + "name": { + "const": "FolderToShare" + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "type": { + "const": "edit" + } + } + } + } + } + } + } + } + } + } + } + """ + + + Scenario: sharer lists the file link share (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 "hello world" to "textfile.txt" + And user "Alice" has created the following resource link share: + | resource | textfile.txt | + | space | NewSpace | + | permissionsRole | view | + | password | %public% | + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should contain resource "textfile.txt" with the following data: + """ + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "file", + "lastModifiedDateTime", + "size" + ], + "properties": { + "name": { + "const": "textfile.txt" + }, + "file": { + "type": "object", + "required": ["mimeType"] + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%space_id_pattern%$" + }, + "driveType": { + "const": "project" + }, + "path": { + "const": "/" + }, + "name": { + "const": "/" + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "@libre.graph.displayName": { + "const": "" + }, + "@libre.graph.quickLink": { + "const": false + }, + "preventsDownload": { + "const": false + }, + "type": { + "const": "view" + }, + "webUrl": { + "type": "string", + "pattern": "^%base_url%/s/[a-zA-Z]+$" + } + } + }, + "id": { + "type": "string", + "pattern": "[a-zA-Z]+" + }, + "hasPassword": { + "const": true + } + } + } + } + } + } + """ + + + Scenario: sharer lists the folder link share (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 created a folder "FolderToShare" in space "NewSpace" + And user "Alice" has created the following resource link share: + | resource | FolderToShare | + | space | NewSpace | + | permissionsRole | edit | + | password | %public% | + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should contain resource "FolderToShare" with the following data: + """ + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "folder", + "lastModifiedDateTime", + "size" + ], + "properties": { + "name": { + "const": "FolderToShare" + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "folder": { + "const": {} + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%space_id_pattern%$" + }, + "driveType": { + "const": "project" + }, + "path": { + "const": "/" + }, + "name": { + "const": "/" + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "@libre.graph.displayName": { + "const": "" + }, + "@libre.graph.quickLink": { + "const": false + }, + "preventsDownload": { + "const": false + }, + "type": { + "const": "edit" + }, + "webUrl": { + "type": "string", + "pattern": "^%base_url%/s/[a-zA-Z]+$" + } + } + }, + "id": { + "type": "string", + "pattern": "[a-zA-Z]+" + }, + "hasPassword": { + "const": true + } + } + } + } + } + } + """ + + + Scenario: sharer lists the link shares of same name files (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 "hello world" to "textfile.txt" + And user "Alice" has created a folder "FolderToShare" in space "NewSpace" + And user "Alice" has uploaded a file inside space "NewSpace" with content "hello world" to "FolderToShare/textfile.txt" + And user "Alice" has created the following resource link share: + | resource | textfile.txt | + | space | NewSpace | + | permissionsRole | edit | + | password | %public% | + And user "Alice" has created the following resource link share: + | resource | FolderToShare/textfile.txt | + | space | NewSpace | + | permissionsRole | view | + | password | %public% | + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "file" + ], + "properties": { + "name": { + "const": "textfile.txt" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveType": { + "const": "project" + }, + "path": { + "const": "/" + }, + "name": { + "const": "/" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "type": { + "const": "edit" + } + } + } + } + } + } + } + }, + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "file" + ], + "properties": { + "name": { + "const": "textfile.txt" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveType": { + "const": "project" + }, + "path": { + "const": "/FolderToShare" + }, + "name": { + "const": "FolderToShare" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "type": { + "const": "view" + } + } + } + } + } + } + } + } + ] + } + } + } + } + """ + + + Scenario: sharer lists the link shares of same name folders (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 created a folder "FolderToShare" in space "NewSpace" + And user "Alice" has created a folder "parent" in space "NewSpace" + And user "Alice" has created a folder "parent/FolderToShare" in space "NewSpace" + And user "Alice" has created the following resource link share: + | resource | FolderToShare | + | space | NewSpace | + | permissionsRole | edit | + | password | %public% | + And user "Alice" has created the following resource link share: + | resource | parent/FolderToShare | + | space | NewSpace | + | permissionsRole | view | + | password | %public% | + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 2, + "maxItems": 2, + "uniqueItems": true, + "items": { + "oneOf": [ + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "folder" + ], + "properties": { + "name": { + "const": "FolderToShare" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveType": { + "const": "project" + }, + "path": { + "const": "/" + }, + "name": { + "const": "/" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "type": { + "const": "edit" + } + } + } + } + } + } + } + }, + { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "folder" + ], + "properties": { + "name": { + "const": "FolderToShare" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveType": { + "const": "project" + }, + "path": { + "const": "/parent" + }, + "name": { + "const": "parent" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "type": { + "const": "view" + } + } + } + } + } + } + } + } + ] + } + } + } + } + """ + + + Scenario: sharer lists the link shares of a file after deleting one link share (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 "hello world" to "textfile.txt" + And user "Alice" has created the following resource link share: + | resource | textfile.txt | + | space | NewSpace | + | permissionsRole | edit | + | password | %public% | + And user "Alice" has created the following resource link share: + | resource | textfile.txt | + | space | NewSpace | + | permissionsRole | view | + | password | %public% | + And user "Alice" has removed the last link share of file "textfile.txt" from space "NewSpace" + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "file" + ], + "properties": { + "name": { + "const": "textfile.txt" + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "type": { + "const": "edit" + } + } + } + } + } + } + } + } + } + } + } + """ + + + Scenario: sharer lists the link shares of a folder after deleting one link share (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 created a folder "FolderToShare" in space "NewSpace" + And user "Alice" has created the following resource link share: + | resource | FolderToShare | + | space | NewSpace | + | permissionsRole | edit | + | password | %public% | + And user "Alice" has created the following resource link share: + | resource | FolderToShare | + | space | NewSpace | + | permissionsRole | view | + | password | %public% | + And user "Alice" has removed the last link share of folder "FolderToShare" from space "NewSpace" + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "folder" + ], + "properties": { + "name": { + "const": "FolderToShare" + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "type": { + "const": "edit" + } + } + } + } + } + } + } + } + } + } + } + """ + + @issue-8355 + Scenario: sharer lists the link share of a 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 created the following space link share: + | space | NewSpace | + | permissionsRole | view | + | password | %public% | + When user "Alice" lists the shares shared by her using the Graph API + Then the HTTP status code should be "200" + And the JSON data of the response should match + """ + { + "type": "object", + "required": ["value"], + "properties": { + "value": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": [ + "parentReference", + "permissions", + "name", + "id", + "eTag", + "folder", + "lastModifiedDateTime", + "size" + ], + "properties": { + "name": { + "const": "." + }, + "folder": { + "const": {} + }, + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "parentReference": { + "type": "object", + "required": ["driveId", "driveType", "id", "name", "path"], + "properties": { + "driveId": { + "type": "string", + "pattern": "^%space_id_pattern%$" + }, + "driveType": { + "const": "project" + }, + "path": { + "const": "." + }, + "name": { + "const": "." + }, + "id": { + "type": "string", + "pattern": "^%space_id_pattern%$" + } + } + }, + "permissions": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "object", + "required": ["hasPassword", "id", "link", "createdDateTime"], + "properties": { + "link": { + "type": "object", + "required": [ + "@libre.graph.displayName", + "@libre.graph.quickLink", + "preventsDownload", + "type", + "webUrl" + ], + "properties": { + "@libre.graph.displayName": { + "const": "" + }, + "@libre.graph.quickLink": { + "const": false + }, + "preventsDownload": { + "const": false + }, + "type": { + "const": "view" + }, + "webUrl": { + "type": "string", + "pattern": "^%base_url%/s/[a-zA-Z]+$" + } + } + }, + "id": { + "type": "string", + "pattern": "[a-zA-Z]+" + }, + "hasPassword": { + "const": true + } + } + } + } + } + } + } + } + } + """ diff --git a/tests/acceptance/features/bootstrap/GraphContext.php b/tests/acceptance/features/bootstrap/GraphContext.php index 028479530..ba681a4b9 100644 --- a/tests/acceptance/features/bootstrap/GraphContext.php +++ b/tests/acceptance/features/bootstrap/GraphContext.php @@ -2519,9 +2519,9 @@ class GraphContext implements Context { * @param string $user * @param bool $waitForCacheExpiry * - * @return void + * @return ResponseInterface */ - public function listSharesSharedByMe(string $user, bool $waitForCacheExpiry = false) { + public function listSharesSharedByMe(string $user, bool $waitForCacheExpiry = false): ResponseInterface { $credentials = $this->getAdminOrUserCredentials($user); if ($waitForCacheExpiry) { // ENV (GRAPH_SPACES_GROUPS_CACHE_TTL | GRAPH_SPACES_USERS_CACHE_TTL) is set default to 60 sec @@ -2529,13 +2529,12 @@ class GraphContext implements Context { // for tests we have set the above ENV's to minimum which is 1 sec as we check the details for the deleted users sleep(1); } - $response = GraphHelper::getSharesSharedByMe( + return GraphHelper::getSharesSharedByMe( $this->featureContext->getBaseUrl(), $this->featureContext->getStepLineRef(), $credentials['username'], $credentials['password'] ); - $this->featureContext->setResponse($response); } /** @@ -2547,7 +2546,8 @@ class GraphContext implements Context { * @throws GuzzleException */ public function userListsTheResourcesSharedByAUserUsingGraphApi(string $user): void { - $this->listSharesSharedByMe($user); + $response = $this->listSharesSharedByMe($user); + $this->featureContext->setResponse($response); } /** @@ -2559,7 +2559,8 @@ class GraphContext implements Context { * @throws GuzzleException */ public function userListsTheResourcesSharedByAUserAfterClearingUserOrGroupSpaceUsingGraphApi(string $user): void { - $this->listSharesSharedByMe($user, true); + $response = $this->listSharesSharedByMe($user, true); + $this->featureContext->setResponse($response); } /** diff --git a/tests/acceptance/features/bootstrap/SharingNgContext.php b/tests/acceptance/features/bootstrap/SharingNgContext.php index 1d091ffdc..99c24a6fd 100644 --- a/tests/acceptance/features/bootstrap/SharingNgContext.php +++ b/tests/acceptance/features/bootstrap/SharingNgContext.php @@ -837,6 +837,26 @@ class SharingNgContext implements Context { ); } + /** + * @When /^user "([^"]*)" has removed the last link share of (?:file|folder) "([^"]*)" from space "([^"]*)"$/ + * + * @param string $sharer + * @param string $resource + * @param string $space + * + * @return void + * @throws JsonException + * @throws GuzzleException + */ + public function userHasRemovedTheLastLinkShareOfFileOrFolderFromSpace( + string $sharer, + string $resource, + string $space + ): void { + $response = $this->removeAccessToSpaceItem($sharer, 'link', $space, $resource); + $this->featureContext->theHTTPStatusCodeShouldBe(204, "", $response); + } + /** * @When /^user "([^"]*)" removes the link of (?:file|folder) "([^"]*)" from space "([^"]*)" using the Graph API$/ * diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index f7455c534..ae6ede170 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -1151,7 +1151,7 @@ trait WebDav { } /** - * @Then /^the content of file "([^"]*)" for user "([^"]*)" should be "([^"]*)"$/ + * @Then the content of file :fileName for user :user should be :content * * @param string $fileName * @param string $user diff --git a/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature b/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature index 07b5b27f1..ff5f97d16 100644 --- a/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature +++ b/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature @@ -10,39 +10,48 @@ Feature: create files and folder Scenario Outline: create a folder Given using DAV path - When user "Alice" creates folder "" using the WebDAV API + When user "Alice" creates folder using the WebDAV API Then the HTTP status code should be "201" - And as "Alice" folder "" should exist + And as "Alice" folder should exist Examples: | dav-path-version | folder-name | - | old | /upload | - | old | /strängé folder | - | old | /C++ folder.cpp | - | old | /नेपाली | - | old | /folder #2 | - | old | /folder ?2 | - | old | /😀 🤖 | - | old | /new&folder | - | new | /upload | - | new | /strängé folder | - | new | /C++ folder.cpp | - | new | /नेपाली | - | new | /folder #2 | - | new | /folder ?2 | - | new | /😀 🤖 | - | new | /new&folder | + | old | "upload" | + | old | "strängé folder" | + | old | "C++ folder.cpp" | + | old | "नेपाली" | + | old | "folder #2" | + | old | "folder ?2" | + | old | "😀 🤖" | + | old | "new&folder" | + | old | "Sample,comma" | + | old | "'single'" | + | old | '"double"' | + | new | "upload" | + | new | "strängé folder" | + | new | "C++ folder.cpp" | + | new | "नेपाली" | + | new | "folder #2" | + | new | "folder ?2" | + | new | "😀 🤖" | + | new | "new&folder" | + | new | "Sample,comma" | + | new | "'single'" | + | new | '"double"' | @skipOnRevaMaster Examples: - | dav-path-version | folder-name | - | spaces | /upload | - | spaces | /strängé folder | - | spaces | /C++ folder.cpp | - | spaces | /नेपाली | - | spaces | /folder #2 | - | spaces | /folder ?2 | - | spaces | /😀 🤖 | - | spaces | /new&folder | + | dav-path-version | folder-name | + | spaces | "upload" | + | spaces | "strängé folder" | + | spaces | "C++ folder.cpp" | + | spaces | "नेपाली" | + | spaces | "folder #2" | + | spaces | "folder ?2" | + | spaces | "😀 🤖" | + | spaces | "new&folder" | + | spaces | "Sample,comma" | + | spaces | "'single'" | + | spaces | '"double"' | @smokeTest Scenario Outline: get resourcetype property of a folder @@ -143,37 +152,162 @@ Feature: create files and folder Scenario Outline: create a file Given using DAV path - When user "Alice" uploads file with content "some text" to "" using the WebDAV API + When user "Alice" uploads file with content "some text" to using the WebDAV API Then the HTTP status code should be "201" - And as "Alice" file "" should exist - And the content of file "" for user "Alice" should be "some text" + And as "Alice" file should exist + And the content of file for user "Alice" should be "some text" Examples: - | dav-path-version | file-name | - | old | /upload.txt | - | old | /strängéfile.txt | - | old | /C++ file.cpp | - | old | /नेपाली | - | old | /file #2.txt | - | old | /file ?2.pdf | - | old | /😀 🤖.txt | - | old | /new&file.txt | - | new | /upload.txt | - | new | /strängéfile.txt | - | new | /C++ file.cpp | - | new | /नेपाली | - | new | /file #2.txt | - | new | /file ?2.pdf | - | new | /😀 🤖.txt | - | new | /new&file.txt | + | dav-path-version | file-name | + | old | "upload.txt" | + | old | "strängéfile.txt" | + | old | "C++ file.cpp" | + | old | "नेपाली" | + | old | "file #2.txt" | + | old | "file ?2.pdf" | + | old | "😀 🤖.txt" | + | old | "new&file.txt" | + | old | "Sample,comma.txt" | + | old | "'single'.txt" | + | old | '"double".txt' | + | new | "upload.txt" | + | new | "strängéfile.txt" | + | new | "C++ file.cpp" | + | new | "नेपाली" | + | new | "file #2.txt" | + | new | "file ?2.pdf" | + | new | "😀 🤖.txt" | + | new | "new&file.txt" | + | new | "Sample,comma.txt" | + | new | "'single'.txt" | + | new | '"double".txt' | @skipOnRevaMaster Examples: - | dav-path-version | file-name | - | spaces | /upload.txt | - | spaces | /strängéfile.txt | - | spaces | /C++ file.cpp | - | spaces | /नेपाली | - | spaces | /file #2.txt | - | spaces | /file ?2.pdf | - | spaces | /😀 🤖.txt | - | spaces | /new&file.txt | + | dav-path-version | file-name | + | spaces | "upload.txt" | + | spaces | "strängéfile.txt" | + | spaces | "C++ file.cpp" | + | spaces | "नेपाली" | + | spaces | "file #2.txt" | + | spaces | "file ?2.pdf" | + | spaces | "😀 🤖.txt" | + | spaces | "new&file.txt" | + | spaces | "Sample,comma.txt" | + | spaces | "'single'.txt" | + | spaces | '"double".txt' | + + + Scenario Outline: try to create file with '.', '..' and 'empty' + Given using DAV path + When user "Alice" uploads file with content "some text" to "" using the WebDAV API + Then the HTTP status code should be "" + Examples: + | dav-path-version | file-name | http-status-code | + | old | /. | 500 | + | old | /.. | 404 | + | old | /../lorem | 404 | + | old | | 500 | + | new | /. | 500 | + | new | /.. | 405 | + | new | /../lorem | 404 | + | new | | 500 | + + @skipOnRevaMaster + Examples: + | dav-path-version | file-name | http-status-code | + | spaces | /. | 500 | + | spaces | /.. | 405 | + | spaces | /../lorem | 404 | + | spaces | | 500 | + + + Scenario Outline: try to create folder with '.', '..' and 'empty' + Given using DAV path + When user "Alice" creates folder "" using the WebDAV API + Then the HTTP status code should be "" + Examples: + | dav-path-version | folder-name | http-status-code | + | old | /. | 405 | + | old | /.. | 404 | + | old | /../lorem | 404 | + | old | | 405 | + | new | /. | 405 | + | new | /.. | 405 | + | new | /../lorem | 409 | + | new | | 405 | + + @skipOnRevaMaster + Examples: + | dav-path-version | folder-name | http-status-code | + | spaces | /. | 400 | + | spaces | /.. | 405 | + | spaces | /../lorem | 404 | + | spaces | | 400 | + + + Scenario Outline: create a file with dots in the name + Given using DAV path + And user "Alice" uploads file with content "some text" to "" using the WebDAV API + Then the HTTP status code should be "201" + And the content of file "" for user "Alice" should be "some text" + Examples: + | dav-path-version | file-name | + | old | /fo. | + | old | /fo.1 | + | old | /fo...1.. | + | old | /... | + | old | /..fo | + | old | /fo.xyz | + | old | /fo.exe | + | new | /fo. | + | new | /fo.1 | + | new | /fo...1.. | + | new | /... | + | new | /..fo | + | new | /fo.xyz | + | new | /fo.exe | + + @skipOnRevaMaster + Examples: + | dav-path-version | file-name | + | spaces | /fo. | + | spaces | /fo.1 | + | spaces | /fo...1.. | + | spaces | /... | + | spaces | /..fo | + | spaces | /fo.xyz | + | spaces | /fo.exe | + + + Scenario Outline: create a folder with dots in the name + Given using DAV path + When user "Alice" creates folder "" using the WebDAV API + Then the HTTP status code should be "201" + And as "Alice" folder "" should exist + Examples: + | dav-path-version | file-name | + | old | /fo. | + | old | /fo.1 | + | old | /fo...1.. | + | old | /... | + | old | /..fo | + | old | /fo.xyz | + | old | /fo.exe | + | new | /fo. | + | new | /fo.1 | + | new | /fo...1.. | + | new | /... | + | new | /..fo | + | new | /fo.xyz | + | new | /fo.exe | + + @skipOnRevaMaster + Examples: + | dav-path-version | file-name | + | spaces | /fo. | + | spaces | /fo.1 | + | spaces | /fo...1.. | + | spaces | /... | + | spaces | /..fo | + | spaces | /fo.xyz | + | spaces | /fo.exe |