aboutsummaryrefslogtreecommitdiff
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
parentb35e3f3da8dee548acedb12cb1883569f03de793 (diff)
downloadmastodon.py-ae9f7640878e3f402b4f8784cecadf5aab0d5d7c.tar.gz
Add remove_from_followers
-rw-r--r--CHANGELOG.rst1
-rw-r--r--TODO.md2
-rw-r--r--docs/index.rst1
-rw-r--r--mastodon/Mastodon.py43
-rw-r--r--tests/cassettes/test_account_remove_from_followers.yaml478
-rw-r--r--tests/test_account.py8
6 files changed, 511 insertions, 22 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index b21064f..c6d7c91 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -16,6 +16,7 @@ v1.8.0 (in progress)
16* Added the stats admin APIs (`admin_measures`, `admin_dimensions`, `admin_retention`) 16* Added the stats admin APIs (`admin_measures`, `admin_dimensions`, `admin_retention`)
17* Added client auth data to access token file. 17* Added client auth data to access token file.
18* Added `account_familiar_followers` API 18* Added `account_familiar_followers` API
19* Added `account_remove_from_followers` API
19 20
20v1.7.0 21v1.7.0
21------ 22------
diff --git a/TODO.md b/TODO.md
index 6018703..b991906 100644
--- a/TODO.md
+++ b/TODO.md
@@ -46,7 +46,7 @@ Refer to mastodon changelog and API docs for details when implementing, add or m
46* [x] Add explore page with trending posts and links 46* [x] Add explore page with trending posts and links
47* [x] Add graphs and retention metrics to admin dashboard 47* [x] Add graphs and retention metrics to admin dashboard
48* [x] Add GET /api/v1/accounts/familiar_followers to REST API 48* [x] Add GET /api/v1/accounts/familiar_followers to REST API
49* [ ] Add POST /api/v1/accounts/:id/remove_from_followers to REST API 49* [x] Add POST /api/v1/accounts/:id/remove_from_followers to REST API
50* [x] Add category and rule_ids params to POST /api/v1/reports IN REST API 50* [x] Add category and rule_ids params to POST /api/v1/reports IN REST API
51* [x] Add global lang param to REST API 51* [x] Add global lang param to REST API
52* [x] Add types param to GET /api/v1/notifications in REST API 52* [x] Add types param to GET /api/v1/notifications in REST API
diff --git a/docs/index.rst b/docs/index.rst
index d035be3..f44ee55 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1102,6 +1102,7 @@ their relationships.
1102.. automethod:: Mastodon.account_lookup 1102.. automethod:: Mastodon.account_lookup
1103.. automethod:: Mastodon.account_lists 1103.. automethod:: Mastodon.account_lists
1104.. automethod:: Mastodon.account_familiar_followers 1104.. automethod:: Mastodon.account_familiar_followers
1105.. automethod:: Mastodon.account_remove_from_followers
1105 1106
1106Reading data: Featured tags 1107Reading data: Featured tags
1107~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1108~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index 9386882..2adcd74 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -40,7 +40,6 @@ try:
40except: 40except:
41 IMPL_HAS_ECE = False 41 IMPL_HAS_ECE = False
42 42
43
44IMPL_HAS_BLURHASH = True 43IMPL_HAS_BLURHASH = True
45try: 44try:
46 import blurhash 45 import blurhash
@@ -262,6 +261,7 @@ class Mastodon:
262 __DICT_VERSION_REACTION = "3.1.0" 261 __DICT_VERSION_REACTION = "3.1.0"
263 __DICT_VERSION_ANNOUNCEMENT = bigger_version("3.1.0", __DICT_VERSION_REACTION) 262 __DICT_VERSION_ANNOUNCEMENT = bigger_version("3.1.0", __DICT_VERSION_REACTION)
264 __DICT_VERSION_STATUS_EDIT = "3.5.0" 263 __DICT_VERSION_STATUS_EDIT = "3.5.0"
264 __DICT_VERSION_FAMILIAR_FOLLOWERS = bigger_version("3.5.0", __DICT_VERSION_ACCOUNT)
265 __DICT_VERSION_ADMIN_DOMAIN_BLOCK = "4.0.0" 265 __DICT_VERSION_ADMIN_DOMAIN_BLOCK = "4.0.0"
266 __DICT_VERSION_ADMIN_MEASURE = "3.5.0" 266 __DICT_VERSION_ADMIN_MEASURE = "3.5.0"
267 __DICT_VERSION_ADMIN_DIMENSION = "3.5.0" 267 __DICT_VERSION_ADMIN_DIMENSION = "3.5.0"
@@ -1357,7 +1357,7 @@ class Mastodon:
1357 """ 1357 """
1358 return self.__api_request('GET', '/api/v1/accounts/lookup', self.__generate_params(locals())) 1358 return self.__api_request('GET', '/api/v1/accounts/lookup', self.__generate_params(locals()))
1359 1359
1360 @api_version("3.5.0", "3.5.0", __DICT_VERSION_ACCOUNT) 1360 @api_version("3.5.0", "3.5.0", __DICT_VERSION_FAMILIAR_FOLLOWERS)
1361 def account_familiar_followers(self, id): 1361 def account_familiar_followers(self, id):
1362 """ 1362 """
1363 Find followers for the account given by id (can be a list) that also follow the 1363 Find followers for the account given by id (can be a list) that also follow the
@@ -2457,8 +2457,19 @@ class Mastodon:
2457 Returns a `relationship dict`_ containing the updated relationship to the user. 2457 Returns a `relationship dict`_ containing the updated relationship to the user.
2458 """ 2458 """
2459 id = self.__unpack_id(id) 2459 id = self.__unpack_id(id)
2460 url = '/api/v1/accounts/{0}/unfollow'.format(str(id)) 2460 return self.__api_request('POST', '/api/v1/accounts/{0}/unfollow'.format(str(id)))
2461 return self.__api_request('POST', url) 2461
2462 @api_version("3.5.0", "3.5.0", __DICT_VERSION_RELATIONSHIP)
2463 def account_remove_from_followers(self, id):
2464 """
2465 Remove a user from the logged in users followers (i.e. make them unfollow the logged in
2466 user / "softblock" them).
2467
2468 Returns a `relationship dict`_ reflecting the updated following status.
2469 """
2470 id = self.__unpack_id(id)
2471 return self.__api_request('POST', '/api/v1/accounts/{0}/remove_from_followers'.format(str(id)))
2472
2462 2473
2463 @api_version("1.0.0", "1.4.0", __DICT_VERSION_RELATIONSHIP) 2474 @api_version("1.0.0", "1.4.0", __DICT_VERSION_RELATIONSHIP)
2464 def account_block(self, id): 2475 def account_block(self, id):
@@ -3618,16 +3629,14 @@ class Mastodon:
3618 raise NotImplementedError( 3629 raise NotImplementedError(
3619 'To use the crypto tools, please install the webpush feature dependencies.') 3630 'To use the crypto tools, please install the webpush feature dependencies.')
3620 3631
3621 push_key_pair = ec.generate_private_key( 3632 push_key_pair = ec.generate_private_key(ec.SECP256R1(), default_backend())
3622 ec.SECP256R1(), default_backend())
3623 push_key_priv = push_key_pair.private_numbers().private_value 3633 push_key_priv = push_key_pair.private_numbers().private_value
3624 3634
3625 crypto_ver = cryptography.__version__ 3635 crypto_ver = cryptography.__version__
3626 if len(crypto_ver) < 5: 3636 if len(crypto_ver) < 5:
3627 crypto_ver += ".0" 3637 crypto_ver += ".0"
3628 if bigger_version(crypto_ver, "2.5.0") == crypto_ver: 3638 if bigger_version(crypto_ver, "2.5.0") == crypto_ver:
3629 push_key_pub = push_key_pair.public_key().public_bytes( 3639 push_key_pub = push_key_pair.public_key().public_bytes(serialization.Encoding.X962, serialization.PublicFormat.UncompressedPoint)
3630 serialization.Encoding.X962, serialization.PublicFormat.UncompressedPoint)
3631 else: 3640 else:
3632 push_key_pub = push_key_pair.public_key().public_numbers().encode_point() 3641 push_key_pub = push_key_pair.public_key().public_numbers().encode_point()
3633 push_shared_secret = os.urandom(16) 3642 push_shared_secret = os.urandom(16)
@@ -3657,14 +3666,10 @@ class Mastodon:
3657 raise NotImplementedError( 3666 raise NotImplementedError(
3658 'To use the crypto tools, please install the webpush feature dependencies.') 3667 'To use the crypto tools, please install the webpush feature dependencies.')
3659 3668
3660 salt = self.__decode_webpush_b64( 3669 salt = self.__decode_webpush_b64(encryption_header.split("salt=")[1].strip())
3661 encryption_header.split("salt=")[1].strip()) 3670 dhparams = self.__decode_webpush_b64(crypto_key_header.split("dh=")[1].split(";")[0].strip())
3662 dhparams = self.__decode_webpush_b64( 3671 p256ecdsa = self.__decode_webpush_b64(crypto_key_header.split("p256ecdsa=")[1].strip())
3663 crypto_key_header.split("dh=")[1].split(";")[0].strip()) 3672 dec_key = ec.derive_private_key(decrypt_params['privkey'], ec.SECP256R1(), default_backend())
3664 p256ecdsa = self.__decode_webpush_b64(
3665 crypto_key_header.split("p256ecdsa=")[1].strip())
3666 dec_key = ec.derive_private_key(
3667 decrypt_params['privkey'], ec.SECP256R1(), default_backend())
3668 decrypted = http_ece.decrypt( 3673 decrypted = http_ece.decrypt(
3669 data, 3674 data,
3670 salt=salt, 3675 salt=salt,
@@ -3703,8 +3708,7 @@ class Mastodon:
3703 'To use the blurhash functions, please install the blurhash Python module.') 3708 'To use the blurhash functions, please install the blurhash Python module.')
3704 3709
3705 # Figure out what size to decode to 3710 # Figure out what size to decode to
3706 decode_components_x, decode_components_y = blurhash.components( 3711 decode_components_x, decode_components_y = blurhash.components(media_dict["blurhash"])
3707 media_dict["blurhash"])
3708 if size_per_component: 3712 if size_per_component:
3709 decode_size_x = decode_components_x * out_size[0] 3713 decode_size_x = decode_components_x * out_size[0]
3710 decode_size_y = decode_components_y * out_size[1] 3714 decode_size_y = decode_components_y * out_size[1]
@@ -3713,8 +3717,7 @@ class Mastodon:
3713 decode_size_y = out_size[1] 3717 decode_size_y = out_size[1]
3714 3718
3715 # Decode 3719 # Decode
3716 decoded_image = blurhash.decode( 3720 decoded_image = blurhash.decode(media_dict["blurhash"], decode_size_x, decode_size_y, linear=return_linear)
3717 media_dict["blurhash"], decode_size_x, decode_size_y, linear=return_linear)
3718 3721
3719 # And that's pretty much it. 3722 # And that's pretty much it.
3720 return decoded_image 3723 return decoded_image
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)