diff --git a/tests/acceptance/bootstrap/SpacesContext.php b/tests/acceptance/bootstrap/SpacesContext.php index a8b0da7de76..86cb3b7c812 100644 --- a/tests/acceptance/bootstrap/SpacesContext.php +++ b/tests/acceptance/bootstrap/SpacesContext.php @@ -2065,9 +2065,9 @@ public function userHasCopiedOrMovedFileInsideSpaceUsingFileId( $sourceFile = \explode("/", $sourceFile); $sourceFile = \end($sourceFile); $destinationFile = \trim($destinationFile, "/"); - if ($actionType === 'copied' || $actionType === 'moved') { + if ($actionType === 'copied') { $fileDestination = $this->escapePath($destinationFile) . '/' . $this->escapePath($sourceFile); - } else { + } elseif ($actionType === 'renamed' || $actionType === 'moved') { $fileDestination = $destinationFile; } diff --git a/tests/acceptance/features/apiActivities/activitiesByFileId.feature b/tests/acceptance/features/apiActivities/activitiesByFileId.feature index 079b41341b6..11037dbe950 100644 --- a/tests/acceptance/features/apiActivities/activitiesByFileId.feature +++ b/tests/acceptance/features/apiActivities/activitiesByFileId.feature @@ -365,7 +365,7 @@ Feature: check activities Given user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt" And we save it into "FILEID" And user "Alice" has created folder "New Folder" - And user "Alice" has moved file "textfile.txt" into "New Folder" inside space "Personal" using file-id "<>" + And user "Alice" has moved file "textfile.txt" into "New Folder/textfile.txt" inside space "Personal" using file-id "<>" When user "Alice" lists the activities of file "New Folder/textfile.txt" from space "Personal" using the Graph API Then the HTTP status code should be "200" And the JSON data of the response should match @@ -472,3 +472,809 @@ Feature: check activities } } """ + + + Scenario: check activities of destination folder after moving a file into it using file-id + Given user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt" + And we save it into "FILEID" + And user "Alice" has created folder "FOLDER" + And user "Alice" has moved file "textfile.txt" into "FOLDER/textfile.txt" inside space "Personal" using file-id "<>" + When user "Alice" lists the activities of file "FOLDER" from space "Personal" 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": ["id","template","times"], + "properties": { + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} added {resource} to {folder}" + } + } + } + } + }, + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} moved {resource} to {folder}" + }, + "variables": { + "type": "object", + "required": ["folder", "resource", "user"], + "properties": { + "folder": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "const": "FOLDER" + } + } + }, + "resource": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "textfile.txt" + } + } + }, + "user": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + }, + "displayName": { + "const": "Alice Hansen" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """ + + + Scenario: check activities of destinaton file and folder after moving a 0 byte file using file-id + Given user "Alice" has uploaded file "filesForUpload/zerobyte.txt" to "zerobyte.txt" + And we save it into "FILEID" + And user "Alice" has created folder "FOLDER" + And user "Alice" has moved file "zerobyte.txt" into "FOLDER/zerobyte.txt" inside space "Personal" using file-id "<>" + When user "Alice" lists the activities of file "FOLDER/zerobyte.txt" from space "Personal" 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": ["id","template","times"], + "properties": { + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} added {resource} to {folder}" + } + } + } + } + }, + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} moved {resource} to {folder}" + }, + "variables": { + "type": "object", + "required": ["folder", "resource", "user"], + "properties": { + "folder": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "const": "FOLDER" + } + } + }, + "resource": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "zerobyte.txt" + } + } + }, + "user": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + }, + "displayName": { + "const": "Alice Hansen" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """ + When user "Alice" lists the activities of file "FOLDER" from space "Personal" 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": ["id","template","times"], + "properties": { + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} added {resource} to {folder}" + } + } + } + } + }, + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { + "const": "{user} moved {resource} to {folder}" + }, + "variables": { + "type": "object", + "required": ["folder", "resource", "user"], + "properties": { + "folder": { + "type": "object", + "required": ["name"], + "properties": { + "name": { + "const": "FOLDER" + } + } + }, + "resource": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "zerobyte.txt" + } + } + }, + "user": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "%user_id_pattern%" + }, + "displayName": { + "const": "Alice Hansen" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """ + + + Scenario: check activities of destinaton file and folder after moving a file by renaming destination file using file-id + Given user "Alice" has uploaded file with content "ownCloud test text file" to "textfile.txt" + And we save it into "FILEID" + And user "Alice" has created folder "/FOLDER" + And user "Alice" has moved file "textfile.txt" into "FOLDER/renamed.txt" inside space "Personal" using file-id "<>" + When user "Alice" lists the activities of file "FOLDER/renamed.txt" from space "Personal" 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": ["id", "template", "times"], + "properties": { + "template": { + "type": "object", + "required": ["message", "variables"], + "properties": { + "message": { + "const": "{user} added {resource} to {folder}" + } + } + } + } + }, + { + "type": "object", + "required": ["id", "template", "times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message", "variables"], + "properties": { + "message": { + "const": "{user} renamed {oldResource} to {resource}" + }, + "variables": { + "type": "object", + "required": ["folder", "oldResource", "resource", "user"], + "properties": { + "folder": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { + "const": "FOLDER" + } + } + }, + "oldResource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { + "const": "textfile.txt" + } + } + }, + "resource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "renamed.txt" + } + } + }, + "user": { + "type": "object", + "required": ["id", "displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "const": "Alice Hansen" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """ + When user "Alice" lists the activities of file "FOLDER" from space "Personal" 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": ["id", "template", "times"], + "properties": { + "template": { + "type": "object", + "required": ["message", "variables"], + "properties": { + "message": { + "const": "{user} added {resource} to {folder}" + } + } + } + } + }, + { + "type": "object", + "required": ["id", "template", "times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message", "variables"], + "properties": { + "message": { + "const": "{user} renamed {oldResource} to {resource}" + }, + "variables": { + "type": "object", + "required": ["folder", "oldResource", "resource", "user"], + "properties": { + "folder": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { + "const": "FOLDER" + } + } + }, + "oldResource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { + "const": "textfile.txt" + } + } + }, + "resource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "renamed.txt" + } + } + }, + "user": { + "type": "object", + "required": ["id", "displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "const": "Alice Hansen" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """ + + + Scenario: check activities of destinaton file and folder after moving a 0 byte file by renaming destination file using file-id + Given user "Alice" has uploaded file "filesForUpload/zerobyte.txt" to "/zerobyte.txt" + And we save it into "FILEID" + And user "Alice" has created folder "/FOLDER" + And user "Alice" has moved file "zerobye.txt" into "FOLDER/renamed.txt" inside space "Personal" using file-id "<>" + When user "Alice" lists the activities of file "FOLDER/renamed.txt" from space "Personal" 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": ["id", "template", "times"], + "properties": { + "template": { + "type": "object", + "required": ["message", "variables"], + "properties": { + "message": { + "const": "{user} added {resource} to {folder}" + } + } + } + } + }, + { + "type": "object", + "required": ["id", "template", "times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message", "variables"], + "properties": { + "message": { + "const": "{user} renamed {oldResource} to {resource}" + }, + "variables": { + "type": "object", + "required": ["folder", "oldResource", "resource", "user"], + "properties": { + "folder": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { + "const": "FOLDER" + } + } + }, + "oldResource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { + "const": "zerobyte.txt" + } + } + }, + "resource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "renamed.txt" + } + } + }, + "user": { + "type": "object", + "required": ["id", "displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "const": "Alice Hansen" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """ + When user "Alice" lists the activities of file "FOLDER" from space "Personal" 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": ["id", "template", "times"], + "properties": { + "template": { + "type": "object", + "required": ["message", "variables"], + "properties": { + "message": { + "const": "{user} added {resource} to {folder}" + } + } + } + } + }, + { + "type": "object", + "required": ["id", "template", "times"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "template": { + "type": "object", + "required": ["message", "variables"], + "properties": { + "message": { + "const": "{user} renamed {oldResource} to {resource}" + }, + "variables": { + "type": "object", + "required": ["folder", "oldResource", "resource", "user"], + "properties": { + "folder": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { + "const": "FOLDER" + } + } + }, + "oldResource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { + "const": "zerobyte.txt" + } + } + }, + "resource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "id": { + "type": "string", + "pattern": "^%file_id_pattern%$" + }, + "name": { + "const": "renamed.txt" + } + } + }, + "user": { + "type": "object", + "required": ["id", "displayName"], + "properties": { + "id": { + "type": "string", + "pattern": "^%user_id_pattern%$" + }, + "displayName": { + "const": "Alice Hansen" + } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { + "type": "string", + "format": "date-time" + } + } + } + } + } + ] + } + } + } + } + """