aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorhalcy <halcy@ARARAGI-KUN>2022-11-27 23:55:26 +0200
committerhalcy <halcy@ARARAGI-KUN>2022-11-27 23:55:26 +0200
commitae9f7640878e3f402b4f8784cecadf5aab0d5d7c (patch)
tree59f0843b89db150adbe5eb57b2a79b55c6251a57 /tests
parentb35e3f3da8dee548acedb12cb1883569f03de793 (diff)
downloadmastodon.py-ae9f7640878e3f402b4f8784cecadf5aab0d5d7c.tar.gz
Add remove_from_followers
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_account_remove_from_followers.yaml478
-rw-r--r--tests/test_account.py8
2 files changed, 485 insertions, 1 deletions
diff --git a/tests/cassettes/test_account_remove_from_followers.yaml b/tests/cassettes/test_account_remove_from_followers.yaml
new file mode 100644
index 0000000..9182231
--- /dev/null
+++ b/tests/cassettes/test_account_remove_from_followers.yaml
@@ -0,0 +1,478 @@
1interactions:
2- request:
3 body: null
4 headers:
5 Accept:
6 - '*/*'
7 Accept-Encoding:
8 - gzip, deflate
9 Authorization:
10 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
11 Connection:
12 - keep-alive
13 User-Agent:
14 - tests/v311
15 method: GET
16 uri: http://localhost:3000/api/v1/accounts/verify_credentials
17 response:
18 body:
19 string: '{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","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":0,"last_status_at":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"3","name":"Owner","permissions":"1048575","color":"","highlighted":true}}'
20 headers:
21 Cache-Control:
22 - no-store
23 Content-Security-Policy:
24 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
25 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
26 style-src ''self'' http://localhost:3000 ''nonce-R0dOyCBcX1yy1m5FC+QBeg=='';
27 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
28 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
29 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
30 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
31 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
32 worker-src ''self'' blob: http://localhost:3000'
33 Content-Type:
34 - application/json; charset=utf-8
35 ETag:
36 - W/"a92dcb08b6f874d680c45eede3cca2ec"
37 Referrer-Policy:
38 - strict-origin-when-cross-origin
39 Transfer-Encoding:
40 - chunked
41 Vary:
42 - Accept, Origin
43 X-Content-Type-Options:
44 - nosniff
45 X-Download-Options:
46 - noopen
47 X-Frame-Options:
48 - SAMEORIGIN
49 X-Permitted-Cross-Domain-Policies:
50 - none
51 X-Request-Id:
52 - 3cb66a54-d7b2-41d3-9286-d7a3408ef1a3
53 X-Runtime:
54 - '0.020531'
55 X-XSS-Protection:
56 - 1; mode=block
57 status:
58 code: 200
59 message: OK
60- request:
61 body: reblogs=1&notify=0
62 headers:
63 Accept:
64 - '*/*'
65 Accept-Encoding:
66 - gzip, deflate
67 Authorization:
68 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
69 Connection:
70 - keep-alive
71 Content-Length:
72 - '18'
73 Content-Type:
74 - application/x-www-form-urlencoded
75 User-Agent:
76 - tests/v311
77 method: POST
78 uri: http://localhost:3000/api/v1/accounts/109411885671340064/follow
79 response:
80 body:
81 string: '{"id":"109411885671340064","following":true,"showing_reblogs":true,"notifying":false,"languages":null,"followed_by":false,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":""}'
82 headers:
83 Cache-Control:
84 - no-store
85 Content-Security-Policy:
86 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
87 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
88 style-src ''self'' http://localhost:3000 ''nonce-+BjRNgT24KKtrEiWOEtFJQ=='';
89 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
90 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
91 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
92 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
93 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
94 worker-src ''self'' blob: http://localhost:3000'
95 Content-Type:
96 - application/json; charset=utf-8
97 ETag:
98 - W/"af292124c7f7757a6ec996d381b1428e"
99 Referrer-Policy:
100 - strict-origin-when-cross-origin
101 Transfer-Encoding:
102 - chunked
103 Vary:
104 - Accept, Origin
105 X-Content-Type-Options:
106 - nosniff
107 X-Download-Options:
108 - noopen
109 X-Frame-Options:
110 - SAMEORIGIN
111 X-Permitted-Cross-Domain-Policies:
112 - none
113 X-RateLimit-Limit:
114 - '400'
115 X-RateLimit-Remaining:
116 - '398'
117 X-RateLimit-Reset:
118 - '2022-11-28T00:00:00.639846Z'
119 X-Request-Id:
120 - b8962ba9-f875-4975-97bb-df94b6eb4ffc
121 X-Runtime:
122 - '0.043218'
123 X-XSS-Protection:
124 - 1; mode=block
125 status:
126 code: 200
127 message: OK
128- request:
129 body: null
130 headers:
131 Accept:
132 - '*/*'
133 Accept-Encoding:
134 - gzip, deflate
135 Authorization:
136 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
137 Connection:
138 - keep-alive
139 User-Agent:
140 - tests/v311
141 method: GET
142 uri: http://localhost:3000/api/v1/accounts/verify_credentials
143 response:
144 body:
145 string: '{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","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":1,"following_count":0,"statuses_count":0,"last_status_at":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"3","name":"Owner","permissions":"1048575","color":"","highlighted":true}}'
146 headers:
147 Cache-Control:
148 - no-store
149 Content-Security-Policy:
150 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
151 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
152 style-src ''self'' http://localhost:3000 ''nonce-sOq1lKB5A0ber9S6v+u7DA=='';
153 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
154 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
155 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
156 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
157 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
158 worker-src ''self'' blob: http://localhost:3000'
159 Content-Type:
160 - application/json; charset=utf-8
161 ETag:
162 - W/"defdf16b9376bb51a9a69e6d6a5d3ab8"
163 Referrer-Policy:
164 - strict-origin-when-cross-origin
165 Transfer-Encoding:
166 - chunked
167 Vary:
168 - Accept, Origin
169 X-Content-Type-Options:
170 - nosniff
171 X-Download-Options:
172 - noopen
173 X-Frame-Options:
174 - SAMEORIGIN
175 X-Permitted-Cross-Domain-Policies:
176 - none
177 X-Request-Id:
178 - 150cfa42-bd36-4a82-9b22-b14db3938024
179 X-Runtime:
180 - '0.016869'
181 X-XSS-Protection:
182 - 1; mode=block
183 status:
184 code: 200
185 message: OK
186- request:
187 body: null
188 headers:
189 Accept:
190 - '*/*'
191 Accept-Encoding:
192 - gzip, deflate
193 Authorization:
194 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
195 Connection:
196 - keep-alive
197 User-Agent:
198 - tests/v311
199 method: GET
200 uri: http://localhost:3000/api/v1/accounts/relationships?id=109411885671340064
201 response:
202 body:
203 string: '[{"id":"109411885671340064","following":true,"showing_reblogs":true,"notifying":false,"languages":null,"followed_by":false,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":""}]'
204 headers:
205 Cache-Control:
206 - no-store
207 Content-Security-Policy:
208 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
209 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
210 style-src ''self'' http://localhost:3000 ''nonce-S2ETIreO4os8h47eriy+PA=='';
211 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
212 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
213 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
214 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
215 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
216 worker-src ''self'' blob: http://localhost:3000'
217 Content-Type:
218 - application/json; charset=utf-8
219 ETag:
220 - W/"e8e7c78d4d5bca66b2af884722eb658b"
221 Referrer-Policy:
222 - strict-origin-when-cross-origin
223 Transfer-Encoding:
224 - chunked
225 Vary:
226 - Accept, Origin
227 X-Content-Type-Options:
228 - nosniff
229 X-Download-Options:
230 - noopen
231 X-Frame-Options:
232 - SAMEORIGIN
233 X-Permitted-Cross-Domain-Policies:
234 - none
235 X-Request-Id:
236 - ad0bc94a-d5d5-476f-a8eb-52aa8d9a9227
237 X-Runtime:
238 - '0.014908'
239 X-XSS-Protection:
240 - 1; mode=block
241 status:
242 code: 200
243 message: OK
244- request:
245 body: null
246 headers:
247 Accept:
248 - '*/*'
249 Accept-Encoding:
250 - gzip, deflate
251 Authorization:
252 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
253 Connection:
254 - keep-alive
255 User-Agent:
256 - tests/v311
257 method: GET
258 uri: http://localhost:3000/api/v1/accounts/verify_credentials
259 response:
260 body:
261 string: '{"id":"109411885927532888","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00: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":1,"statuses_count":0,"last_status_at":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"-99","name":"","permissions":"65536","color":"","highlighted":false}}'
262 headers:
263 Cache-Control:
264 - no-store
265 Content-Security-Policy:
266 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
267 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
268 style-src ''self'' http://localhost:3000 ''nonce-+NtKlOuZVkU8Acusia2Htw=='';
269 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
270 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
271 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
272 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
273 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
274 worker-src ''self'' blob: http://localhost:3000'
275 Content-Type:
276 - application/json; charset=utf-8
277 ETag:
278 - W/"17970f44d54945f9f38ba671d9d60356"
279 Referrer-Policy:
280 - strict-origin-when-cross-origin
281 Transfer-Encoding:
282 - chunked
283 Vary:
284 - Accept, Origin
285 X-Content-Type-Options:
286 - nosniff
287 X-Download-Options:
288 - noopen
289 X-Frame-Options:
290 - SAMEORIGIN
291 X-Permitted-Cross-Domain-Policies:
292 - none
293 X-Request-Id:
294 - 74be946f-6e21-4ab1-b9df-5cde9dea3ea0
295 X-Runtime:
296 - '0.016156'
297 X-XSS-Protection:
298 - 1; mode=block
299 status:
300 code: 200
301 message: OK
302- request:
303 body: null
304 headers:
305 Accept:
306 - '*/*'
307 Accept-Encoding:
308 - gzip, deflate
309 Authorization:
310 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
311 Connection:
312 - keep-alive
313 Content-Length:
314 - '0'
315 User-Agent:
316 - tests/v311
317 method: POST
318 uri: http://localhost:3000/api/v1/accounts/109411885927532888/remove_from_followers
319 response:
320 body:
321 string: '{"id":"109411885927532888","following":false,"showing_reblogs":false,"notifying":false,"languages":null,"followed_by":false,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":""}'
322 headers:
323 Cache-Control:
324 - no-store
325 Content-Security-Policy:
326 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
327 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
328 style-src ''self'' http://localhost:3000 ''nonce-I3WirYh4zIJil4fz4Ypvuw=='';
329 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
330 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
331 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
332 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
333 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
334 worker-src ''self'' blob: http://localhost:3000'
335 Content-Type:
336 - application/json; charset=utf-8
337 ETag:
338 - W/"cafa36e073f0abd1d761a2481756af20"
339 Referrer-Policy:
340 - strict-origin-when-cross-origin
341 Transfer-Encoding:
342 - chunked
343 Vary:
344 - Accept, Origin
345 X-Content-Type-Options:
346 - nosniff
347 X-Download-Options:
348 - noopen
349 X-Frame-Options:
350 - SAMEORIGIN
351 X-Permitted-Cross-Domain-Policies:
352 - none
353 X-Request-Id:
354 - f87c5171-28c0-4376-8fa8-b9dd0ae5f1e1
355 X-Runtime:
356 - '0.023087'
357 X-XSS-Protection:
358 - 1; mode=block
359 status:
360 code: 200
361 message: OK
362- request:
363 body: null
364 headers:
365 Accept:
366 - '*/*'
367 Accept-Encoding:
368 - gzip, deflate
369 Authorization:
370 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2
371 Connection:
372 - keep-alive
373 User-Agent:
374 - tests/v311
375 method: GET
376 uri: http://localhost:3000/api/v1/accounts/verify_credentials
377 response:
378 body:
379 string: '{"id":"109411885671340064","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-26T00:00:00.000Z","note":"","url":"http://localhost:3000/@admin","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":0,"last_status_at":null,"noindex":false,"source":{"privacy":"public","sensitive":false,"language":null,"note":"","fields":[],"follow_requests_count":0},"emojis":[],"fields":[],"role":{"id":"3","name":"Owner","permissions":"1048575","color":"","highlighted":true}}'
380 headers:
381 Cache-Control:
382 - no-store
383 Content-Security-Policy:
384 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
385 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
386 style-src ''self'' http://localhost:3000 ''nonce-6VHUdI/c1cfanzBNaHf3CA=='';
387 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
388 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
389 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
390 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
391 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
392 worker-src ''self'' blob: http://localhost:3000'
393 Content-Type:
394 - application/json; charset=utf-8
395 ETag:
396 - W/"a92dcb08b6f874d680c45eede3cca2ec"
397 Referrer-Policy:
398 - strict-origin-when-cross-origin
399 Transfer-Encoding:
400 - chunked
401 Vary:
402 - Accept, Origin
403 X-Content-Type-Options:
404 - nosniff
405 X-Download-Options:
406 - noopen
407 X-Frame-Options:
408 - SAMEORIGIN
409 X-Permitted-Cross-Domain-Policies:
410 - none
411 X-Request-Id:
412 - bdcd3a80-4ad7-48f1-acbb-7841dccaf9cd
413 X-Runtime:
414 - '0.015990'
415 X-XSS-Protection:
416 - 1; mode=block
417 status:
418 code: 200
419 message: OK
420- request:
421 body: null
422 headers:
423 Accept:
424 - '*/*'
425 Accept-Encoding:
426 - gzip, deflate
427 Authorization:
428 - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN
429 Connection:
430 - keep-alive
431 User-Agent:
432 - tests/v311
433 method: GET
434 uri: http://localhost:3000/api/v1/accounts/relationships?id=109411885671340064
435 response:
436 body:
437 string: '[{"id":"109411885671340064","following":false,"showing_reblogs":false,"notifying":false,"languages":null,"followed_by":false,"blocking":false,"blocked_by":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false,"endorsed":false,"note":""}]'
438 headers:
439 Cache-Control:
440 - no-store
441 Content-Security-Policy:
442 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
443 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
444 style-src ''self'' http://localhost:3000 ''nonce-tRCVlnmRrPBbrJTyH85B4w=='';
445 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
446 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
447 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
448 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
449 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
450 worker-src ''self'' blob: http://localhost:3000'
451 Content-Type:
452 - application/json; charset=utf-8
453 ETag:
454 - W/"e0ec461bb1e1fc6ba00e167394f26490"
455 Referrer-Policy:
456 - strict-origin-when-cross-origin
457 Transfer-Encoding:
458 - chunked
459 Vary:
460 - Accept, Origin
461 X-Content-Type-Options:
462 - nosniff
463 X-Download-Options:
464 - noopen
465 X-Frame-Options:
466 - SAMEORIGIN
467 X-Permitted-Cross-Domain-Policies:
468 - none
469 X-Request-Id:
470 - e869b74d-9f48-4b05-8fdc-a33cb6d82924
471 X-Runtime:
472 - '0.012606'
473 X-XSS-Protection:
474 - 1; mode=block
475 status:
476 code: 200
477 message: OK
478version: 1
diff --git a/tests/test_account.py b/tests/test_account.py
index 184e346..afc2122 100644
--- a/tests/test_account.py
+++ b/tests/test_account.py
@@ -33,7 +33,6 @@ def test_account_relationships(api):
33 assert isinstance(relationships, list) 33 assert isinstance(relationships, list)
34 assert len(relationships) == 1 34 assert len(relationships) == 1
35 35
36
37@pytest.mark.vcr() 36@pytest.mark.vcr()
38def test_account_search(api): 37def test_account_search(api):
39 results = api.account_search('admin') 38 results = api.account_search('admin')
@@ -305,3 +304,10 @@ def test_account_familiar_followers(api, api2, api3):
305 assert len(followers_list) == 2 304 assert len(followers_list) == 2
306 assert followers_list[0].id == api2.me().id 305 assert followers_list[0].id == api2.me().id
307 assert followers_list[1].id == api3.me().id 306 assert followers_list[1].id == api3.me().id
307
308@pytest.mark.vcr()
309def test_account_remove_from_followers(api, api2):
310 api.account_follow(api2.me())
311 assert api.account_relationships(api2.me())[0].following == True
312 api2.account_remove_from_followers(api.me())
313 assert api.account_relationships(api2.me())[0].following == False \ No newline at end of file
Powered by cgit v1.2.3 (git 2.41.0)