Merge pull request #11382 from owncloud/test/fileID-activities-deleting-0-byte-file

[tests-only][full-ci] Check activities after deleting a file using file-id
This commit is contained in:
Sawjan Gurung authored and GitHub committed 2025-06-03 16:45:11 +05:45
commit da4ae092f3
3 files changed
+142

No files matched your search

+36
View File
@@ -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
);
}
}
@@ -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.
@@ -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 "<<FILEID>>"
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" }
}
}
}
}
]
}
}
}
}
"""