aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_status_edit.yaml379
-rw-r--r--tests/test_status.py16
2 files changed, 395 insertions, 0 deletions
diff --git a/tests/cassettes/test_status_edit.yaml b/tests/cassettes/test_status_edit.yaml
new file mode 100644
index 0000000..1343b28
--- /dev/null
+++ b/tests/cassettes/test_status_edit.yaml
@@ -0,0 +1,379 @@
1interactions:
2- request:
3 body: status=the+best+editor%3F+why%2C+of+course+it+is+VS+Code
4 headers:
5 Accept:
6 - '*/*'
7 Accept-Encoding:
8 - gzip, deflate
9 Authorization:
10 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
11 Connection:
12 - keep-alive
13 Content-Length:
14 - '56'
15 Content-Type:
16 - application/x-www-form-urlencoded
17 User-Agent:
18 - tests/v311
19 method: POST
20 uri: http://localhost:3000/api/v1/statuses
21 response:
22 body:
23 string: '{"id":"109384054168698393","created_at":"2022-11-21T22:03:29.362Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109384054168698393","url":"http://localhost:3000/@mastodonpy_test/109384054168698393","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003ethe
24 best editor? why, of course it is VS Code\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
25 test suite","website":null},"account":{"id":"109383687546708201","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":6,"last_status_at":"2022-11-21","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
26 headers:
27 Cache-Control:
28 - no-store
29 Content-Security-Policy:
30 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
31 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
32 style-src ''self'' http://localhost:3000 ''nonce-3UDW6mpgnOTfx5Euaa1LQA=='';
33 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
34 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
35 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
36 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
37 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
38 worker-src ''self'' blob: http://localhost:3000'
39 Content-Type:
40 - application/json; charset=utf-8
41 ETag:
42 - W/"8a45eb762bdb11cdd6cd63bfebe39f63"
43 Referrer-Policy:
44 - strict-origin-when-cross-origin
45 Transfer-Encoding:
46 - chunked
47 Vary:
48 - Accept, Origin
49 X-Content-Type-Options:
50 - nosniff
51 X-Download-Options:
52 - noopen
53 X-Frame-Options:
54 - SAMEORIGIN
55 X-Permitted-Cross-Domain-Policies:
56 - none
57 X-RateLimit-Limit:
58 - '300'
59 X-RateLimit-Remaining:
60 - '292'
61 X-RateLimit-Reset:
62 - '2022-11-22T00:00:00.383365Z'
63 X-Request-Id:
64 - e56f662b-28f8-4ba7-9b38-36e71ac7d73c
65 X-Runtime:
66 - '0.033929'
67 X-XSS-Protection:
68 - 1; mode=block
69 status:
70 code: 200
71 message: OK
72- request:
73 body: null
74 headers:
75 Accept:
76 - '*/*'
77 Accept-Encoding:
78 - gzip, deflate
79 Authorization:
80 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
81 Connection:
82 - keep-alive
83 User-Agent:
84 - tests/v311
85 method: GET
86 uri: http://localhost:3000/api/v1/statuses/109384054168698393/history
87 response:
88 body:
89 string: '[]'
90 headers:
91 Cache-Control:
92 - no-store
93 Content-Security-Policy:
94 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
95 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
96 style-src ''self'' http://localhost:3000 ''nonce-oKku/pMs24FqYkpW5MkiGQ=='';
97 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
98 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
99 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
100 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
101 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
102 worker-src ''self'' blob: http://localhost:3000'
103 Content-Type:
104 - application/json; charset=utf-8
105 ETag:
106 - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5"
107 Referrer-Policy:
108 - strict-origin-when-cross-origin
109 Transfer-Encoding:
110 - chunked
111 Vary:
112 - Accept, Origin
113 X-Content-Type-Options:
114 - nosniff
115 X-Download-Options:
116 - noopen
117 X-Frame-Options:
118 - SAMEORIGIN
119 X-Permitted-Cross-Domain-Policies:
120 - none
121 X-Request-Id:
122 - 4a780264-f947-4745-a5de-7165d8eee3d9
123 X-Runtime:
124 - '0.010494'
125 X-XSS-Protection:
126 - 1; mode=block
127 status:
128 code: 200
129 message: OK
130- request:
131 body: status=the+best+editor%3F+why%2C+of+course+it+is+the+KDE+Advanced+Text+Editor%2C+Kate
132 headers:
133 Accept:
134 - '*/*'
135 Accept-Encoding:
136 - gzip, deflate
137 Authorization:
138 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
139 Connection:
140 - keep-alive
141 Content-Length:
142 - '85'
143 Content-Type:
144 - application/x-www-form-urlencoded
145 User-Agent:
146 - tests/v311
147 method: PUT
148 uri: http://localhost:3000/api/v1/statuses/109384054168698393
149 response:
150 body:
151 string: '{"id":"109384054168698393","created_at":"2022-11-21T22:03:29.362Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109384054168698393","url":"http://localhost:3000/@mastodonpy_test/109384054168698393","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":"2022-11-21T22:03:29.418Z","favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003ethe
152 best editor? why, of course it is the KDE Advanced Text Editor, Kate\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
153 test suite","website":null},"account":{"id":"109383687546708201","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":6,"last_status_at":"2022-11-21","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
154 headers:
155 Cache-Control:
156 - no-store
157 Content-Security-Policy:
158 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
159 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
160 style-src ''self'' http://localhost:3000 ''nonce-11jMbHJPLcAv+qMX8EK9Eg=='';
161 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
162 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
163 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
164 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
165 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
166 worker-src ''self'' blob: http://localhost:3000'
167 Content-Type:
168 - application/json; charset=utf-8
169 ETag:
170 - W/"976b69a807cf9d4601d0c73c8eb249fc"
171 Referrer-Policy:
172 - strict-origin-when-cross-origin
173 Transfer-Encoding:
174 - chunked
175 Vary:
176 - Accept, Origin
177 X-Content-Type-Options:
178 - nosniff
179 X-Download-Options:
180 - noopen
181 X-Frame-Options:
182 - SAMEORIGIN
183 X-Permitted-Cross-Domain-Policies:
184 - none
185 X-RateLimit-Limit:
186 - '300'
187 X-RateLimit-Remaining:
188 - '291'
189 X-RateLimit-Reset:
190 - '2022-11-22T00:00:00.437259Z'
191 X-Request-Id:
192 - 1f4c3ffd-1c13-45ee-a9df-8d7fff11a17c
193 X-Runtime:
194 - '0.033812'
195 X-XSS-Protection:
196 - 1; mode=block
197 status:
198 code: 200
199 message: OK
200- request:
201 body: null
202 headers:
203 Accept:
204 - '*/*'
205 Accept-Encoding:
206 - gzip, deflate
207 Authorization:
208 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
209 Connection:
210 - keep-alive
211 User-Agent:
212 - tests/v311
213 method: GET
214 uri: http://localhost:3000/api/v1/statuses/109384054168698393
215 response:
216 body:
217 string: '{"id":"109384054168698393","created_at":"2022-11-21T22:03:29.362Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109384054168698393","url":"http://localhost:3000/@mastodonpy_test/109384054168698393","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":"2022-11-21T22:03:29.418Z","favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"content":"\u003cp\u003ethe
218 best editor? why, of course it is the KDE Advanced Text Editor, Kate\u003c/p\u003e","filtered":[],"reblog":null,"application":{"name":"Mastodon.py
219 test suite","website":null},"account":{"id":"109383687546708201","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":6,"last_status_at":"2022-11-21","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'
220 headers:
221 Cache-Control:
222 - no-store
223 Content-Security-Policy:
224 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
225 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
226 style-src ''self'' http://localhost:3000 ''nonce-/HjTa7cbsYkrasMByN5dRw=='';
227 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
228 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
229 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
230 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
231 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
232 worker-src ''self'' blob: http://localhost:3000'
233 Content-Type:
234 - application/json; charset=utf-8
235 ETag:
236 - W/"8d8244c105ccd1fff42ddc2e75976f91"
237 Referrer-Policy:
238 - strict-origin-when-cross-origin
239 Transfer-Encoding:
240 - chunked
241 Vary:
242 - Accept, Origin
243 X-Content-Type-Options:
244 - nosniff
245 X-Download-Options:
246 - noopen
247 X-Frame-Options:
248 - SAMEORIGIN
249 X-Permitted-Cross-Domain-Policies:
250 - none
251 X-Request-Id:
252 - 36c0e7e0-064a-42f1-91e0-82c90ebc4456
253 X-Runtime:
254 - '0.030588'
255 X-XSS-Protection:
256 - 1; mode=block
257 status:
258 code: 200
259 message: OK
260- request:
261 body: null
262 headers:
263 Accept:
264 - '*/*'
265 Accept-Encoding:
266 - gzip, deflate
267 Authorization:
268 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
269 Connection:
270 - keep-alive
271 User-Agent:
272 - tests/v311
273 method: GET
274 uri: http://localhost:3000/api/v1/statuses/109384054168698393/history
275 response:
276 body:
277 string: '[{"content":"\u003cp\u003ethe best editor? why, of course it is VS
278 Code\u003c/p\u003e","spoiler_text":"","sensitive":false,"created_at":"2022-11-21T22:03:29.362Z","account":{"id":"109383687546708201","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":6,"last_status_at":"2022-11-21","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"emojis":[]},{"content":"\u003cp\u003ethe
279 best editor? why, of course it is the KDE Advanced Text Editor, Kate\u003c/p\u003e","spoiler_text":"","sensitive":false,"created_at":"2022-11-21T22:03:29.418Z","account":{"id":"109383687546708201","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-21T00:00:00.000Z","note":"","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/avatars/original/missing.png","avatar_static":"http://localhost:3000/avatars/original/missing.png","header":"http://localhost:3000/headers/original/missing.png","header_static":"http://localhost:3000/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":6,"last_status_at":"2022-11-21","noindex":false,"emojis":[],"fields":[]},"media_attachments":[],"emojis":[]}]'
280 headers:
281 Cache-Control:
282 - no-store
283 Content-Security-Policy:
284 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
285 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
286 style-src ''self'' http://localhost:3000 ''nonce-mn4VRGJCjg55CXsiLcW5tA=='';
287 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
288 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
289 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
290 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
291 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
292 worker-src ''self'' blob: http://localhost:3000'
293 Content-Type:
294 - application/json; charset=utf-8
295 ETag:
296 - W/"e5185ce4a3ebf261210613a8bb85e77e"
297 Referrer-Policy:
298 - strict-origin-when-cross-origin
299 Transfer-Encoding:
300 - chunked
301 Vary:
302 - Accept, Origin
303 X-Content-Type-Options:
304 - nosniff
305 X-Download-Options:
306 - noopen
307 X-Frame-Options:
308 - SAMEORIGIN
309 X-Permitted-Cross-Domain-Policies:
310 - none
311 X-Request-Id:
312 - 17896b84-96a0-4ed4-b3a0-8fca353a3725
313 X-Runtime:
314 - '0.016628'
315 X-XSS-Protection:
316 - 1; mode=block
317 status:
318 code: 200
319 message: OK
320- request:
321 body: null
322 headers:
323 Accept:
324 - '*/*'
325 Accept-Encoding:
326 - gzip, deflate
327 Authorization:
328 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
329 Connection:
330 - keep-alive
331 User-Agent:
332 - tests/v311
333 method: GET
334 uri: http://localhost:3000/api/v1/statuses/109384054168698393/source
335 response:
336 body:
337 string: '{"id":"109384054168698393","text":"the best editor? why, of course
338 it is the KDE Advanced Text Editor, Kate","spoiler_text":""}'
339 headers:
340 Cache-Control:
341 - no-store
342 Content-Security-Policy:
343 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
344 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
345 style-src ''self'' http://localhost:3000 ''nonce-1CVpCwMC0PSWzPM4QmGGoA=='';
346 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
347 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
348 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
349 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
350 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
351 worker-src ''self'' blob: http://localhost:3000'
352 Content-Type:
353 - application/json; charset=utf-8
354 ETag:
355 - W/"41ed5fd640708627beb7f31b84cb65d3"
356 Referrer-Policy:
357 - strict-origin-when-cross-origin
358 Transfer-Encoding:
359 - chunked
360 Vary:
361 - Accept, Origin
362 X-Content-Type-Options:
363 - nosniff
364 X-Download-Options:
365 - noopen
366 X-Frame-Options:
367 - SAMEORIGIN
368 X-Permitted-Cross-Domain-Policies:
369 - none
370 X-Request-Id:
371 - b5919220-e51e-4496-80f5-5a17e908702f
372 X-Runtime:
373 - '0.016356'
374 X-XSS-Protection:
375 - 1; mode=block
376 status:
377 code: 200
378 message: OK
379version: 1
diff --git a/tests/test_status.py b/tests/test_status.py
index 20e32f2..e747571 100644
--- a/tests/test_status.py
+++ b/tests/test_status.py
@@ -213,3 +213,19 @@ def test_scheduled_status_long_part2(api):
213 if text in status.content: 213 if text in status.content:
214 found_status = True 214 found_status = True
215 assert found_status 215 assert found_status
216
217@pytest.mark.vcr()
218def test_status_edit(api, api2):
219 status = api.status_post("the best editor? why, of course it is VS Code")
220 edit_list_1 = api2.status_history(status)
221 status_edited = api.status_update(status, "the best editor? why, of course it is the KDE Advanced Text Editor, Kate")
222 status_result = api2.status(status)
223 edit_list_2 = api2.status_history(status)
224
225 assert len(edit_list_1) == 0
226 assert len(edit_list_2) == 2
227 assert "the best editor? why, of course it is the KDE Advanced Text Editor, Kate" in status_result.content
228
229 source = api2.status_source(status)
230 assert source.text == "the best editor? why, of course it is the KDE Advanced Text Editor, Kate"
231 \ No newline at end of file
Powered by cgit v1.2.3 (git 2.41.0)