aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO.md4
-rw-r--r--docs/index.rst2
-rw-r--r--mastodon/Mastodon.py12
-rw-r--r--tests/cassettes/test_account_notes.yaml123
-rw-r--r--tests/test_account.py27
5 files changed, 143 insertions, 25 deletions
diff --git a/TODO.md b/TODO.md
index 4bce5da..99e9644 100644
--- a/TODO.md
+++ b/TODO.md
@@ -14,7 +14,7 @@ Refer to mastodon changelog and API docs for details when implementing, add or m
14 14
153.2.0 153.2.0
16----- 16-----
17* [ ] Add personal notes for accounts 17* [x] Add personal notes for accounts
18* [x] Add customizable thumbnails for audio and video attachments 18* [x] Add customizable thumbnails for audio and video attachments
19* [x] Add color extraction for thumbnails 19* [x] Add color extraction for thumbnails
20 20
@@ -62,5 +62,5 @@ Refer to mastodon changelog and API docs for details when implementing, add or m
62 62
63General improvements that would be good to do before doing another release: 63General improvements that would be good to do before doing another release:
64* [ ] Split mastodon.py into parts in some way that makes sense, it's getting very unwieldy 64* [ ] Split mastodon.py into parts in some way that makes sense, it's getting very unwieldy
65* [ ] Fix the CI 65* [x] Fix the CI
66* [ ] Get test coverage like, real high 66* [ ] Get test coverage like, real high
diff --git a/docs/index.rst b/docs/index.rst
index 667ab1c..dad7669 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -493,6 +493,7 @@ Relationship dicts
493 # logged-in users Timeline 493 # logged-in users Timeline
494 'endorsed': # Boolean denoting wheter the specified user is being endorsed / featured by the 494 'endorsed': # Boolean denoting wheter the specified user is being endorsed / featured by the
495 # logged-in user 495 # logged-in user
496 'note': # A free text note the logged in user has created for this account (not publicly visible)
496 } 497 }
497 498
498Filter dicts 499Filter dicts
@@ -1176,6 +1177,7 @@ These functions allow you to interact with other accounts: To (un)follow and
1176.. automethod:: Mastodon.account_pin 1177.. automethod:: Mastodon.account_pin
1177.. automethod:: Mastodon.account_unpin 1178.. automethod:: Mastodon.account_unpin
1178.. automethod:: Mastodon.account_update_credentials 1179.. automethod:: Mastodon.account_update_credentials
1180.. automethod:: Mastodon.account_note_set
1179 1181
1180Writing data: Featured tags 1182Writing data: Featured tags
1181~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1183~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index ff542ef..7d881a0 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -215,7 +215,7 @@ class Mastodon:
215 __DICT_VERSION_INSTANCE = bigger_version("3.1.4", __DICT_VERSION_ACCOUNT) 215 __DICT_VERSION_INSTANCE = bigger_version("3.1.4", __DICT_VERSION_ACCOUNT)
216 __DICT_VERSION_HASHTAG = "2.3.4" 216 __DICT_VERSION_HASHTAG = "2.3.4"
217 __DICT_VERSION_EMOJI = "3.0.0" 217 __DICT_VERSION_EMOJI = "3.0.0"
218 __DICT_VERSION_RELATIONSHIP = "2.5.0" 218 __DICT_VERSION_RELATIONSHIP = "3.2.0"
219 __DICT_VERSION_NOTIFICATION = bigger_version(bigger_version("1.0.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS) 219 __DICT_VERSION_NOTIFICATION = bigger_version(bigger_version("1.0.0", __DICT_VERSION_ACCOUNT), __DICT_VERSION_STATUS)
220 __DICT_VERSION_CONTEXT = bigger_version("1.0.0", __DICT_VERSION_STATUS) 220 __DICT_VERSION_CONTEXT = bigger_version("1.0.0", __DICT_VERSION_STATUS)
221 __DICT_VERSION_LIST = "2.1.0" 221 __DICT_VERSION_LIST = "2.1.0"
@@ -2260,6 +2260,16 @@ class Mastodon:
2260 url = '/api/v1/accounts/{0}/unpin'.format(str(id)) 2260 url = '/api/v1/accounts/{0}/unpin'.format(str(id))
2261 return self.__api_request('POST', url) 2261 return self.__api_request('POST', url)
2262 2262
2263 def account_note_set(self, id, comment):
2264 """
2265 Set a note (visible to the logged in user only) for the given account.
2266
2267 returns a `status dict`_ with the `note` updated.
2268 """
2269 id = self.__unpack_id(id)
2270 params = self.__generate_params(locals(), ["id"])
2271 return self.__api_request('POST', '/api/v1/accounts/{0}/note'.format(str(id)), params)
2272
2263 ### 2273 ###
2264 # Writing data: Featured hashtags 2274 # Writing data: Featured hashtags
2265 ### 2275 ###
diff --git a/tests/cassettes/test_account_notes.yaml b/tests/cassettes/test_account_notes.yaml
new file mode 100644
index 0000000..275514c
--- /dev/null
+++ b/tests/cassettes/test_account_notes.yaml
@@ -0,0 +1,123 @@
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":"109336199753389764","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00: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-TRItETB4W72vy3k5XQZRAA=='';
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/"a576b865af5fce00b4019a62d9c55f75"
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 - 53684e14-3054-47ec-aa8f-7450b0c38056
53 X-Runtime:
54 - '0.025567'
55 X-XSS-Protection:
56 - 1; mode=block
57 status:
58 code: 200
59 message: OK
60- request:
61 body: comment=top+ebayer+gerne+wieder
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 - '31'
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/109336199753389764/note
79 response:
80 body:
81 string: '{"id":"109336199753389764","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":"top
82 ebayer gerne wieder"}'
83 headers:
84 Cache-Control:
85 - no-store
86 Content-Security-Policy:
87 - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src
88 ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000;
89 style-src ''self'' http://localhost:3000 ''nonce-3t+BKMJ4b8EcyKFsQ7MZOg=='';
90 media-src ''self'' https: data: http://localhost:3000; frame-src ''self''
91 https:; manifest-src ''self'' http://localhost:3000; connect-src ''self''
92 data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000
93 ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline''
94 ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000;
95 worker-src ''self'' blob: http://localhost:3000'
96 Content-Type:
97 - application/json; charset=utf-8
98 ETag:
99 - W/"c3ead4efc220cb74679970c3bb3bd0cf"
100 Referrer-Policy:
101 - strict-origin-when-cross-origin
102 Transfer-Encoding:
103 - chunked
104 Vary:
105 - Accept, Origin
106 X-Content-Type-Options:
107 - nosniff
108 X-Download-Options:
109 - noopen
110 X-Frame-Options:
111 - SAMEORIGIN
112 X-Permitted-Cross-Domain-Policies:
113 - none
114 X-Request-Id:
115 - 91546468-a591-49ad-ac52-f2c5ab510161
116 X-Runtime:
117 - '0.037352'
118 X-XSS-Protection:
119 - 1; mode=block
120 status:
121 code: 200
122 message: OK
123version: 1
diff --git a/tests/test_account.py b/tests/test_account.py
index 6584dbc..ef48d4e 100644
--- a/tests/test_account.py
+++ b/tests/test_account.py
@@ -233,26 +233,9 @@ def test_suggested_tags(api):
233@pytest.mark.vcr() 233@pytest.mark.vcr()
234def test_featured_tags(api): 234def test_featured_tags(api):
235 featured_tag = api.featured_tag_create("ringtones") 235 featured_tag = api.featured_tag_create("ringtones")
236 """try:
237 status = api.status_post("cool free #ringtones")
238 time.sleep(2)
239 236
240 featured_tag = api.featured_tag_create("ringtones") 237@pytest.mark.vcr()
241 assert featured_tag 238def test_account_notes(api, api2):
242 239 relationship = api.account_note_set(api2.account_verify_credentials(), "top ebayer gerne wieder")
243 tag_list = api.featured_tags() 240 assert relationship
244 assert featured_tag.name in list(map(lambda x: x.name, tag_list)) 241 assert relationship.note == "top ebayer gerne wieder"
245
246 api.featured_tag_delete(featured_tag)
247 tag_list = api.featured_tags()
248 assert not featured_tag.name in list(map(lambda x: x.name, tag_list))
249 finally:
250 api.status_delete(status)"""
251
252
253
254
255
256
257
258
Powered by cgit v1.2.3 (git 2.41.0)