Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8693472

Browse files
committedJul 29, 2024··
add test for file deletion activity
1 parent 9a6fdc4 commit 8693472

File tree

2 files changed

+197
-2
lines changed

2 files changed

+197
-2
lines changed
 

‎tests/acceptance/features/apiGraph/activities.feature

+176-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ Feature: check activities
33
I want to check who made which changes to files
44
So that I can track modifications
55

6-
7-
Scenario: check activities after uploading a file
6+
Background:
87
Given user "Alice" has been created with default attributes and without skeleton files
98
And user "Alice" has uploaded file with content "ownCloud test text file 0" to "/textfile0.txt"
9+
10+
11+
Scenario: check activities after uploading a file
1012
When user "Alice" checks the activities for file "textfile0.txt" in space "Personal" using the Graph API
1113
Then the HTTP status code should be "200"
1214
And the JSON data of the response should match
@@ -97,3 +99,175 @@ Feature: check activities
9799
}
98100
}
99101
"""
102+
103+
104+
Scenario: check activities after deleting a file
105+
When user "Alice" deletes file "/textfile0.txt" using the WebDAV API
106+
And user "Alice" checks the activities in space "Personal" using the Graph API
107+
Then the HTTP status code should be "200"
108+
And the JSON data of the response should match
109+
"""
110+
{
111+
"type": "object",
112+
"required": ["value"],
113+
"properties": {
114+
"value": {
115+
"type": "array",
116+
"minItems": 2,
117+
"maxItems": 2,
118+
"uniqueItems": true,
119+
"items": {
120+
"oneOf": [
121+
{
122+
"type": "object",
123+
"required": ["id","template","times"],
124+
"properties": {
125+
"id": {
126+
"type": "string",
127+
"pattern": "^%user_id_pattern%$"
128+
},
129+
"template": {
130+
"type": "object",
131+
"required": ["message","variables"],
132+
"properties": {
133+
"message": {
134+
"const": "{user} added {resource} to {space}"
135+
},
136+
"variables": {
137+
"type": "object",
138+
"required": ["resource","space","user"],
139+
"properties": {
140+
"resource": {
141+
"type": "object",
142+
"required": ["id","name"],
143+
"properties": {
144+
"id": {
145+
"const": ""
146+
},
147+
"name": {
148+
"const": "textfile0.txt"
149+
}
150+
}
151+
},
152+
"space": {
153+
"type": "object",
154+
"required": ["id","name"],
155+
"properties": {
156+
"id": {
157+
"type": "string",
158+
"pattern": "^%file_id_pattern%$"
159+
},
160+
"name": {
161+
"const": "Alice Hansen"
162+
}
163+
}
164+
},
165+
"user": {
166+
"type": "object",
167+
"required": ["id","displayName"],
168+
"properties": {
169+
"id": {
170+
"type": "string",
171+
"pattern": "%user_id_pattern%"
172+
},
173+
"displayName": {
174+
"const": "Alice"
175+
}
176+
}
177+
}
178+
}
179+
}
180+
}
181+
},
182+
"times": {
183+
"type": "object",
184+
"required": ["recordedTime"],
185+
"properties": {
186+
"recordedTime": {
187+
"type": "string",
188+
"format": "date-time"
189+
}
190+
}
191+
}
192+
}
193+
},
194+
{
195+
"type": "object",
196+
"required": ["id","template","times"],
197+
"properties": {
198+
"id": {
199+
"type": "string",
200+
"pattern": "^%user_id_pattern%$"
201+
},
202+
"template": {
203+
"type": "object",
204+
"required": ["message","variables"],
205+
"properties": {
206+
"message": {
207+
"const": "{user} deleted {resource} from {space}"
208+
},
209+
"variables": {
210+
"type": "object",
211+
"required": ["resource","space","user"],
212+
"properties": {
213+
"resource": {
214+
"type": "object",
215+
"required": ["id","name"],
216+
"properties": {
217+
"id": {
218+
"type": "string",
219+
"pattern": "%file_id_pattern%"
220+
},
221+
"name": {
222+
"const": "textfile0.txt"
223+
}
224+
}
225+
},
226+
"space": {
227+
"type": "object",
228+
"required": ["id","name"],
229+
"properties": {
230+
"id": {
231+
"type": "string",
232+
"pattern": "^%file_id_pattern%$"
233+
},
234+
"name": {
235+
"const": "Alice Hansen"
236+
}
237+
}
238+
},
239+
"user": {
240+
"type": "object",
241+
"required": ["id","displayName"],
242+
"properties": {
243+
"id": {
244+
"type": "string",
245+
"pattern": "%user_id_pattern%"
246+
},
247+
"displayName": {
248+
"const": "Alice"
249+
}
250+
}
251+
}
252+
}
253+
}
254+
}
255+
},
256+
"times": {
257+
"type": "object",
258+
"required": ["recordedTime"],
259+
"properties": {
260+
"recordedTime": {
261+
"type": "string",
262+
"format": "date-time"
263+
}
264+
}
265+
}
266+
}
267+
}
268+
]
269+
}
270+
}
271+
}
272+
}
273+
"""

‎tests/acceptance/features/bootstrap/GraphContext.php

+21
Original file line numberDiff line numberDiff line change
@@ -2797,4 +2797,25 @@ public function userChecksTheActivitiesForResourceInSpaceUsingTheGraphAPI(string
27972797
);
27982798
$this->featureContext->setResponse($response);
27992799
}
2800+
2801+
/**
2802+
* @When user :user checks the activities in space :spaceName using the Graph API
2803+
*
2804+
* @param string $user
2805+
* @param string $spaceName
2806+
*
2807+
* @return void
2808+
*
2809+
*/
2810+
public function userChecksTheActivitiesInSpaceUsingTheGraphApi($user, $spaceName): void {
2811+
$spaceId = ($this->featureContext->spacesContext->getSpaceByName($user, $spaceName))["id"];
2812+
$response = GraphHelper::getActivities(
2813+
$this->featureContext->getBaseUrl(),
2814+
$this->featureContext->getStepLineRef(),
2815+
$user,
2816+
$this->featureContext->getPasswordForUser($user),
2817+
$spaceId
2818+
);
2819+
$this->featureContext->setResponse($response);
2820+
}
28002821
}

0 commit comments

Comments
 (0)
Please sign in to comment.