diff --git a/tests/acceptance/bootstrap/WebDav.php b/tests/acceptance/bootstrap/WebDav.php index 2f07b814953..7459fd33605 100644 --- a/tests/acceptance/bootstrap/WebDav.php +++ b/tests/acceptance/bootstrap/WebDav.php @@ -4716,4 +4716,40 @@ trait WebDav { $this->setResponse($response); $this->pushToLastStatusCodesArrays(); } + + /** + * @Given user :user has deleted file :filename from space :space using file-id :fileId + * + * @param string $user + * @param string $filename + * @param string $space + * @param string $fileId + * + * @return void + * @throws JsonException + * @throws GuzzleException + */ + public function userHasDeletedFileFromSpaceUsingFileId( + string $user, + string $filename, + string $space, + string $fileId + ): void { + $baseUrl = $this->getBaseUrl(); + $davPath = WebDavHelper::getDavPath($this->getDavPathVersion()); + $user = $this->getActualUsername($user); + $password = $this->getPasswordForUser($user); + $fullUrl = "$baseUrl/$davPath/$fileId"; + $response = HttpRequestHelper::sendRequest( + $fullUrl, + 'DELETE', + $user, + $password + ); + $this->theHTTPStatusCodeShouldBe( + ["204"], + "HTTP status code was not 204 while trying to delete resource '$filename' for user '$user'", + $response + ); + } } diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 4ad69574bf3..f58b0a47a20 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -403,5 +403,8 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiActivities/activities.feature:4108](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiActivities/activities.feature#L4108) - [apiActivities/activitiesByFileId.feature:1842](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiActivities/activitiesByFileId.feature#L1842) +#### [Activity. no event for deleting a file using file-id](https://github.com/owncloud/ocis/issues/10328) +- [apiActivities/activitiesByFileId.feature:2017](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiActivities/activitiesByFileId.feature#L2017) + Note: always have an empty line at the end of this file. The bash script that processes this file requires that the last line has a newline on the end. diff --git a/tests/acceptance/features/apiActivities/activitiesByFileId.feature b/tests/acceptance/features/apiActivities/activitiesByFileId.feature index bf755340c67..9d839af6575 100644 --- a/tests/acceptance/features/apiActivities/activitiesByFileId.feature +++ b/tests/acceptance/features/apiActivities/activitiesByFileId.feature @@ -2012,3 +2012,106 @@ Feature: check activities } } """ + + @issue-10328 + Scenario: check activities after deleting a 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 deleted file "textfile.txt" from space "Personal" using file-id "<>" + When user "Alice" lists the activities of 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}" }, + "variables": { + "type": "object", + "required": ["resource", "folder", "user"], + "properties": { + "resource": { + "type": "object", + "required": ["id", "name"], + "properties": { + "name": { "const": "textfile.txt" } + } + } + } + } + } + } + } + }, + { + "type": "object", + "required": ["id","template","times"], + "properties": { + "id": { "pattern": "^%user_id_pattern%$" }, + "template": { + "type": "object", + "required": ["message","variables"], + "properties": { + "message": { "const": "{user} deleted {resource} from {folder}" }, + "variables": { + "type": "object", + "required": ["resource","folder","user"], + "properties": { + "resource": { + "type": "object", + "required": ["id","name"], + "properties": { + "id": { "pattern": "%file_id_pattern%" }, + "name": { "const": "textfile.txt" } + } + }, + "folder": { + "type": "object", + "required": ["name"], + "properties": { + "name": { "const": "Alice Hansen" } + } + }, + "user": { + "type": "object", + "required": ["id","displayName"], + "properties": { + "id": { "pattern": "%user_id_pattern%" }, + "displayName": { "const": "Alice Hansen" } + } + } + } + } + } + }, + "times": { + "type": "object", + "required": ["recordedTime"], + "properties": { + "recordedTime": { "format": "date-time" } + } + } + } + } + ] + } + } + } + } + """