diff options
-rw-r--r-- | mastodon/Mastodon.py | 14 | ||||
-rw-r--r-- | tests/README.markdown | 2 | ||||
-rw-r--r-- | tests/cassettes/test_bookmarks.yaml | 535 | ||||
-rw-r--r-- | tests/test_bookmarks.py | 5 |
4 files changed, 419 insertions, 137 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 98ac72a..e87599b 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -1633,13 +1633,23 @@ class Mastodon: | |||
1633 | # Reading data: Bookmarks | 1633 | # Reading data: Bookmarks |
1634 | ### | 1634 | ### |
1635 | @api_version("3.1.0", "3.1.0", __DICT_VERSION_STATUS) | 1635 | @api_version("3.1.0", "3.1.0", __DICT_VERSION_STATUS) |
1636 | def bookmarks(self): | 1636 | def bookmarks(self, max_id=None, min_id=None, since_id=None, limit=None): |
1637 | """ | 1637 | """ |
1638 | Get a list of statuses bookmarked by the logged-in user. | 1638 | Get a list of statuses bookmarked by the logged-in user. |
1639 | 1639 | ||
1640 | Returns a list of `toot dicts`_. | 1640 | Returns a list of `toot dicts`_. |
1641 | """ | 1641 | """ |
1642 | return self.__api_request('GET', '/api/v1/bookmarks') | 1642 | if max_id != None: |
1643 | max_id = self.__unpack_id(max_id) | ||
1644 | |||
1645 | if min_id != None: | ||
1646 | min_id = self.__unpack_id(min_id) | ||
1647 | |||
1648 | if since_id != None: | ||
1649 | since_id = self.__unpack_id(since_id) | ||
1650 | |||
1651 | params = self.__generate_params(locals()) | ||
1652 | return self.__api_request('GET', '/api/v1/bookmarks', params) | ||
1643 | 1653 | ||
1644 | ### | 1654 | ### |
1645 | # Writing data: Statuses | 1655 | # Writing data: Statuses |
diff --git a/tests/README.markdown b/tests/README.markdown index 368f4f5..62b5e10 100644 --- a/tests/README.markdown +++ b/tests/README.markdown | |||
@@ -26,7 +26,7 @@ This test suite uses [VCR.py][] to record requests to Mastodon and replay them i | |||
26 | If you want to add or change tests, you will need a Mastodon development server running on `http://localhost:3000`, with the default `admin` user and default password. | 26 | If you want to add or change tests, you will need a Mastodon development server running on `http://localhost:3000`, with the default `admin` user and default password. |
27 | To set this up, follow the development guide and set up the database using "rails db:setup". | 27 | To set this up, follow the development guide and set up the database using "rails db:setup". |
28 | 28 | ||
29 | It also needs a test OAuth app and an additional test user to be set up by applying the provided `setup.sql` to Mastodon's database: | 29 | It also needs a test OAuth app-registriation and an additional test user to be set up by applying the provided `setup.sql` to Mastodon's database: |
30 | 30 | ||
31 | psql -d mastodon_development < tests/setup.sql | 31 | psql -d mastodon_development < tests/setup.sql |
32 | 32 | ||
diff --git a/tests/cassettes/test_bookmarks.yaml b/tests/cassettes/test_bookmarks.yaml index c2bee19..de9c314 100644 --- a/tests/cassettes/test_bookmarks.yaml +++ b/tests/cassettes/test_bookmarks.yaml | |||
@@ -2,174 +2,441 @@ interactions: | |||
2 | - request: | 2 | - request: |
3 | body: status=Toot%21 | 3 | body: status=Toot%21 |
4 | headers: | 4 | headers: |
5 | Accept: ['*/*'] | 5 | Accept: |
6 | Accept-Encoding: ['gzip, deflate'] | 6 | - '*/*' |
7 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | 7 | Accept-Encoding: |
8 | Connection: [keep-alive] | 8 | - gzip, deflate |
9 | Content-Length: ['14'] | 9 | Authorization: |
10 | Content-Type: [application/x-www-form-urlencoded] | 10 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN |
11 | User-Agent: [python-requests/2.18.4] | 11 | Connection: |
12 | - keep-alive | ||
13 | Content-Length: | ||
14 | - '14' | ||
15 | Content-Type: | ||
16 | - application/x-www-form-urlencoded | ||
17 | User-Agent: | ||
18 | - python-requests/2.22.0 | ||
12 | method: POST | 19 | method: POST |
13 | uri: http://localhost:3000/api/v1/statuses | 20 | uri: http://localhost:3000/api/v1/statuses |
14 | response: | 21 | response: |
15 | body: {string: '{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | 22 | body: |
16 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | 23 | string: '{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py |
24 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}' | ||
17 | headers: | 25 | headers: |
18 | Cache-Control: ['no-cache, no-store'] | 26 | Cache-Control: |
19 | Content-Type: [application/json; charset=utf-8] | 27 | - no-store |
20 | Referrer-Policy: [strict-origin-when-cross-origin] | 28 | Content-Security-Policy: |
21 | Transfer-Encoding: [chunked] | 29 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src |
22 | Vary: ['Accept-Encoding, Origin'] | 30 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; |
23 | X-Content-Type-Options: [nosniff] | 31 | style-src ''self'' http://localhost ''nonce-s4DtHaGKm+Sv7S0opGjkuA==''; media-src |
24 | X-Download-Options: [noopen] | 32 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src |
25 | X-Frame-Options: [SAMEORIGIN] | 33 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost |
26 | X-Permitted-Cross-Domain-Policies: [none] | 34 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; |
27 | X-Request-Id: [4c259279-4810-4065-bda7-44fdd2e5e769] | 35 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src |
28 | X-Runtime: ['0.160125'] | 36 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' |
29 | X-XSS-Protection: [1; mode=block] | 37 | Content-Type: |
30 | content-length: ['1320'] | 38 | - application/json; charset=utf-8 |
31 | status: {code: 200, message: OK} | 39 | ETag: |
40 | - W/"16c19c98c5667003bada6cc08d6a9efd" | ||
41 | Referrer-Policy: | ||
42 | - strict-origin-when-cross-origin | ||
43 | Transfer-Encoding: | ||
44 | - chunked | ||
45 | Vary: | ||
46 | - Accept, Accept-Encoding, Origin | ||
47 | X-Content-Type-Options: | ||
48 | - nosniff | ||
49 | X-Download-Options: | ||
50 | - noopen | ||
51 | X-Frame-Options: | ||
52 | - SAMEORIGIN | ||
53 | X-Permitted-Cross-Domain-Policies: | ||
54 | - none | ||
55 | X-RateLimit-Limit: | ||
56 | - '300' | ||
57 | X-RateLimit-Remaining: | ||
58 | - '290' | ||
59 | X-RateLimit-Reset: | ||
60 | - '2022-06-24T15:00:00.156190Z' | ||
61 | X-Request-Id: | ||
62 | - a38516b7-de3e-4c49-9405-0bded1f29145 | ||
63 | X-Runtime: | ||
64 | - '0.047610' | ||
65 | X-XSS-Protection: | ||
66 | - 1; mode=block | ||
67 | content-length: | ||
68 | - '1308' | ||
69 | status: | ||
70 | code: 200 | ||
71 | message: OK | ||
32 | - request: | 72 | - request: |
33 | body: null | 73 | body: null |
34 | headers: | 74 | headers: |
35 | Accept: ['*/*'] | 75 | Accept: |
36 | Accept-Encoding: ['gzip, deflate'] | 76 | - '*/*' |
37 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | 77 | Accept-Encoding: |
38 | Connection: [keep-alive] | 78 | - gzip, deflate |
39 | Content-Length: ['0'] | 79 | Authorization: |
40 | User-Agent: [python-requests/2.18.4] | 80 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN |
81 | Connection: | ||
82 | - keep-alive | ||
83 | Content-Length: | ||
84 | - '0' | ||
85 | User-Agent: | ||
86 | - python-requests/2.22.0 | ||
41 | method: POST | 87 | method: POST |
42 | uri: http://localhost:3000/api/v1/statuses/103704183225122470/bookmark | 88 | uri: http://localhost:3000/api/v1/statuses/108532515807337403/bookmark |
43 | response: | 89 | response: |
44 | body: {string: '{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | 90 | body: |
45 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | 91 | string: '{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py |
92 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}' | ||
46 | headers: | 93 | headers: |
47 | Cache-Control: ['no-cache, no-store'] | 94 | Cache-Control: |
48 | Content-Type: [application/json; charset=utf-8] | 95 | - no-store |
49 | Referrer-Policy: [strict-origin-when-cross-origin] | 96 | Content-Security-Policy: |
50 | Transfer-Encoding: [chunked] | 97 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src |
51 | Vary: ['Accept-Encoding, Origin'] | 98 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; |
52 | X-Content-Type-Options: [nosniff] | 99 | style-src ''self'' http://localhost ''nonce-r/DodIkic+v9H9lAcksQVw==''; media-src |
53 | X-Download-Options: [noopen] | 100 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src |
54 | X-Frame-Options: [SAMEORIGIN] | 101 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost |
55 | X-Permitted-Cross-Domain-Policies: [none] | 102 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; |
56 | X-Request-Id: [a0ef24c0-bc8d-45ef-80af-0737f40f4191] | 103 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src |
57 | X-Runtime: ['0.157864'] | 104 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' |
58 | X-XSS-Protection: [1; mode=block] | 105 | Content-Type: |
59 | content-length: ['1319'] | 106 | - application/json; charset=utf-8 |
60 | status: {code: 200, message: OK} | 107 | ETag: |
108 | - W/"bb1e121980e105d13ea65b61a8fe3f9e" | ||
109 | Referrer-Policy: | ||
110 | - strict-origin-when-cross-origin | ||
111 | Transfer-Encoding: | ||
112 | - chunked | ||
113 | Vary: | ||
114 | - Accept, Accept-Encoding, Origin | ||
115 | X-Content-Type-Options: | ||
116 | - nosniff | ||
117 | X-Download-Options: | ||
118 | - noopen | ||
119 | X-Frame-Options: | ||
120 | - SAMEORIGIN | ||
121 | X-Permitted-Cross-Domain-Policies: | ||
122 | - none | ||
123 | X-Request-Id: | ||
124 | - 4af13637-38f4-41d6-ad47-756de2626bf3 | ||
125 | X-Runtime: | ||
126 | - '0.041993' | ||
127 | X-XSS-Protection: | ||
128 | - 1; mode=block | ||
129 | content-length: | ||
130 | - '1307' | ||
131 | status: | ||
132 | code: 200 | ||
133 | message: OK | ||
61 | - request: | 134 | - request: |
62 | body: null | 135 | body: null |
63 | headers: | 136 | headers: |
64 | Accept: ['*/*'] | 137 | Accept: |
65 | Accept-Encoding: ['gzip, deflate'] | 138 | - '*/*' |
66 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | 139 | Accept-Encoding: |
67 | Connection: [keep-alive] | 140 | - gzip, deflate |
68 | User-Agent: [python-requests/2.18.4] | 141 | Authorization: |
142 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
143 | Connection: | ||
144 | - keep-alive | ||
145 | User-Agent: | ||
146 | - python-requests/2.22.0 | ||
69 | method: GET | 147 | method: GET |
70 | uri: http://localhost:3000/api/v1/bookmarks | 148 | uri: http://localhost:3000/api/v1/bookmarks |
71 | response: | 149 | response: |
72 | body: {string: '[{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | 150 | body: |
73 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]'} | 151 | string: '[{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py |
152 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]' | ||
74 | headers: | 153 | headers: |
75 | Cache-Control: ['no-cache, no-store'] | 154 | Cache-Control: |
76 | Content-Type: [application/json; charset=utf-8] | 155 | - no-store |
77 | Link: ['<http://localhost:3000/api/v1/bookmarks?min_id=2>; rel="prev"'] | 156 | Content-Security-Policy: |
78 | Referrer-Policy: [strict-origin-when-cross-origin] | 157 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src |
79 | Transfer-Encoding: [chunked] | 158 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; |
80 | Vary: ['Accept-Encoding, Origin'] | 159 | style-src ''self'' http://localhost ''nonce-EEFQZtT2hj45UYMa5FifxA==''; media-src |
81 | X-Content-Type-Options: [nosniff] | 160 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src |
82 | X-Download-Options: [noopen] | 161 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost |
83 | X-Frame-Options: [SAMEORIGIN] | 162 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; |
84 | X-Permitted-Cross-Domain-Policies: [none] | 163 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src |
85 | X-Request-Id: [e6548f1e-3d17-46be-aca7-f310783119a8] | 164 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' |
86 | X-Runtime: ['0.075518'] | 165 | Content-Type: |
87 | X-XSS-Protection: [1; mode=block] | 166 | - application/json; charset=utf-8 |
88 | content-length: ['1321'] | 167 | ETag: |
89 | status: {code: 200, message: OK} | 168 | - W/"e28cea671d77758e8cd2652347a030d1" |
169 | Link: | ||
170 | - <http://localhost:3000/api/v1/bookmarks?min_id=11>; rel="prev" | ||
171 | Referrer-Policy: | ||
172 | - strict-origin-when-cross-origin | ||
173 | Transfer-Encoding: | ||
174 | - chunked | ||
175 | Vary: | ||
176 | - Accept, Accept-Encoding, 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-Request-Id: | ||
186 | - 0fe7aaf8-add4-4523-a98f-22608f714cad | ||
187 | X-Runtime: | ||
188 | - '0.036771' | ||
189 | X-XSS-Protection: | ||
190 | - 1; mode=block | ||
191 | content-length: | ||
192 | - '1309' | ||
193 | status: | ||
194 | code: 200 | ||
195 | message: OK | ||
90 | - request: | 196 | - request: |
91 | body: null | 197 | body: null |
92 | headers: | 198 | headers: |
93 | Accept: ['*/*'] | 199 | Accept: |
94 | Accept-Encoding: ['gzip, deflate'] | 200 | - '*/*' |
95 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | 201 | Accept-Encoding: |
96 | Connection: [keep-alive] | 202 | - gzip, deflate |
97 | Content-Length: ['0'] | 203 | Authorization: |
98 | User-Agent: [python-requests/2.18.4] | 204 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN |
205 | Connection: | ||
206 | - keep-alive | ||
207 | User-Agent: | ||
208 | - python-requests/2.22.0 | ||
209 | method: GET | ||
210 | uri: http://localhost:3000/api/v1/bookmarks?limit=1 | ||
211 | response: | ||
212 | body: | ||
213 | string: '[{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":true,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | ||
214 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]' | ||
215 | headers: | ||
216 | Cache-Control: | ||
217 | - no-store | ||
218 | Content-Security-Policy: | ||
219 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src | ||
220 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; | ||
221 | style-src ''self'' http://localhost ''nonce-wzGUumpjXwVRz6YQjB+AhQ==''; media-src | ||
222 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src | ||
223 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost | ||
224 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; | ||
225 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src | ||
226 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' | ||
227 | Content-Type: | ||
228 | - application/json; charset=utf-8 | ||
229 | ETag: | ||
230 | - W/"e28cea671d77758e8cd2652347a030d1" | ||
231 | Link: | ||
232 | - <http://localhost:3000/api/v1/bookmarks?limit=1&max_id=11>; rel="next", <http://localhost:3000/api/v1/bookmarks?limit=1&min_id=11>; | ||
233 | rel="prev" | ||
234 | Referrer-Policy: | ||
235 | - strict-origin-when-cross-origin | ||
236 | Transfer-Encoding: | ||
237 | - chunked | ||
238 | Vary: | ||
239 | - Accept, Accept-Encoding, Origin | ||
240 | X-Content-Type-Options: | ||
241 | - nosniff | ||
242 | X-Download-Options: | ||
243 | - noopen | ||
244 | X-Frame-Options: | ||
245 | - SAMEORIGIN | ||
246 | X-Permitted-Cross-Domain-Policies: | ||
247 | - none | ||
248 | X-Request-Id: | ||
249 | - 7c887921-a7ee-478d-8e68-61359f4eacaf | ||
250 | X-Runtime: | ||
251 | - '0.037690' | ||
252 | X-XSS-Protection: | ||
253 | - 1; mode=block | ||
254 | content-length: | ||
255 | - '1309' | ||
256 | status: | ||
257 | code: 200 | ||
258 | message: OK | ||
259 | - request: | ||
260 | body: null | ||
261 | headers: | ||
262 | Accept: | ||
263 | - '*/*' | ||
264 | Accept-Encoding: | ||
265 | - gzip, deflate | ||
266 | Authorization: | ||
267 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
268 | Connection: | ||
269 | - keep-alive | ||
270 | Content-Length: | ||
271 | - '0' | ||
272 | User-Agent: | ||
273 | - python-requests/2.22.0 | ||
99 | method: POST | 274 | method: POST |
100 | uri: http://localhost:3000/api/v1/statuses/103704183225122470/unbookmark | 275 | uri: http://localhost:3000/api/v1/statuses/108532515807337403/unbookmark |
101 | response: | 276 | response: |
102 | body: {string: '{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py | 277 | body: |
103 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | 278 | string: '{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"content":"\u003cp\u003eToot!\u003c/p\u003e","reblog":null,"application":{"name":"Mastodon.py |
279 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}' | ||
104 | headers: | 280 | headers: |
105 | Cache-Control: ['no-cache, no-store'] | 281 | Cache-Control: |
106 | Content-Type: [application/json; charset=utf-8] | 282 | - no-store |
107 | Referrer-Policy: [strict-origin-when-cross-origin] | 283 | Content-Security-Policy: |
108 | Transfer-Encoding: [chunked] | 284 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src |
109 | Vary: ['Accept-Encoding, Origin'] | 285 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; |
110 | X-Content-Type-Options: [nosniff] | 286 | style-src ''self'' http://localhost ''nonce-x2CjCkxjnkvgJiPtS/CoIg==''; media-src |
111 | X-Download-Options: [noopen] | 287 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src |
112 | X-Frame-Options: [SAMEORIGIN] | 288 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost |
113 | X-Permitted-Cross-Domain-Policies: [none] | 289 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; |
114 | X-Request-Id: [d9792c38-ab1e-46de-9737-704433ad8f94] | 290 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src |
115 | X-Runtime: ['0.095876'] | 291 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' |
116 | X-XSS-Protection: [1; mode=block] | 292 | Content-Type: |
117 | content-length: ['1320'] | 293 | - application/json; charset=utf-8 |
118 | status: {code: 200, message: OK} | 294 | ETag: |
295 | - W/"16c19c98c5667003bada6cc08d6a9efd" | ||
296 | Referrer-Policy: | ||
297 | - strict-origin-when-cross-origin | ||
298 | Transfer-Encoding: | ||
299 | - chunked | ||
300 | Vary: | ||
301 | - Accept, Accept-Encoding, Origin | ||
302 | X-Content-Type-Options: | ||
303 | - nosniff | ||
304 | X-Download-Options: | ||
305 | - noopen | ||
306 | X-Frame-Options: | ||
307 | - SAMEORIGIN | ||
308 | X-Permitted-Cross-Domain-Policies: | ||
309 | - none | ||
310 | X-Request-Id: | ||
311 | - 61142a88-6453-47c6-8230-6b6196efb64c | ||
312 | X-Runtime: | ||
313 | - '0.035340' | ||
314 | X-XSS-Protection: | ||
315 | - 1; mode=block | ||
316 | content-length: | ||
317 | - '1308' | ||
318 | status: | ||
319 | code: 200 | ||
320 | message: OK | ||
119 | - request: | 321 | - request: |
120 | body: null | 322 | body: null |
121 | headers: | 323 | headers: |
122 | Accept: ['*/*'] | 324 | Accept: |
123 | Accept-Encoding: ['gzip, deflate'] | 325 | - '*/*' |
124 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | 326 | Accept-Encoding: |
125 | Connection: [keep-alive] | 327 | - gzip, deflate |
126 | User-Agent: [python-requests/2.18.4] | 328 | Authorization: |
329 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
330 | Connection: | ||
331 | - keep-alive | ||
332 | User-Agent: | ||
333 | - python-requests/2.22.0 | ||
127 | method: GET | 334 | method: GET |
128 | uri: http://localhost:3000/api/v1/bookmarks | 335 | uri: http://localhost:3000/api/v1/bookmarks |
129 | response: | 336 | response: |
130 | body: {string: '[]'} | 337 | body: |
338 | string: '[]' | ||
131 | headers: | 339 | headers: |
132 | Cache-Control: ['no-cache, no-store'] | 340 | Cache-Control: |
133 | Content-Type: [application/json; charset=utf-8] | 341 | - no-store |
134 | Referrer-Policy: [strict-origin-when-cross-origin] | 342 | Content-Security-Policy: |
135 | Transfer-Encoding: [chunked] | 343 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src |
136 | Vary: ['Accept-Encoding, Origin'] | 344 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; |
137 | X-Content-Type-Options: [nosniff] | 345 | style-src ''self'' http://localhost ''nonce-i6oSjmQ5IE8wtOR+vDrGZw==''; media-src |
138 | X-Download-Options: [noopen] | 346 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src |
139 | X-Frame-Options: [SAMEORIGIN] | 347 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost |
140 | X-Permitted-Cross-Domain-Policies: [none] | 348 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; |
141 | X-Request-Id: [8454c5ef-5f23-43b9-89d8-dc1b1605f7ac] | 349 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src |
142 | X-Runtime: ['0.035375'] | 350 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' |
143 | X-XSS-Protection: [1; mode=block] | 351 | Content-Type: |
144 | content-length: ['2'] | 352 | - application/json; charset=utf-8 |
145 | status: {code: 200, message: OK} | 353 | ETag: |
354 | - W/"aaa12070e167024a89ca985596a44579" | ||
355 | Referrer-Policy: | ||
356 | - strict-origin-when-cross-origin | ||
357 | Transfer-Encoding: | ||
358 | - chunked | ||
359 | Vary: | ||
360 | - Accept, Accept-Encoding, Origin | ||
361 | X-Content-Type-Options: | ||
362 | - nosniff | ||
363 | X-Download-Options: | ||
364 | - noopen | ||
365 | X-Frame-Options: | ||
366 | - SAMEORIGIN | ||
367 | X-Permitted-Cross-Domain-Policies: | ||
368 | - none | ||
369 | X-Request-Id: | ||
370 | - 639bbb25-65a5-44eb-a886-d7092f891ecb | ||
371 | X-Runtime: | ||
372 | - '0.014781' | ||
373 | X-XSS-Protection: | ||
374 | - 1; mode=block | ||
375 | content-length: | ||
376 | - '2' | ||
377 | status: | ||
378 | code: 200 | ||
379 | message: OK | ||
146 | - request: | 380 | - request: |
147 | body: null | 381 | body: null |
148 | headers: | 382 | headers: |
149 | Accept: ['*/*'] | 383 | Accept: |
150 | Accept-Encoding: ['gzip, deflate'] | 384 | - '*/*' |
151 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | 385 | Accept-Encoding: |
152 | Connection: [keep-alive] | 386 | - gzip, deflate |
153 | Content-Length: ['0'] | 387 | Authorization: |
154 | User-Agent: [python-requests/2.18.4] | 388 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN |
389 | Connection: | ||
390 | - keep-alive | ||
391 | Content-Length: | ||
392 | - '0' | ||
393 | User-Agent: | ||
394 | - python-requests/2.22.0 | ||
155 | method: DELETE | 395 | method: DELETE |
156 | uri: http://localhost:3000/api/v1/statuses/103704183225122470 | 396 | uri: http://localhost:3000/api/v1/statuses/108532515807337403 |
157 | response: | 397 | response: |
158 | body: {string: '{"id":"103704183225122470","created_at":"2020-02-22T19:37:36.738Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/103704183225122470","url":"http://localhost/@mastodonpy_test/103704183225122470","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot!","reblog":null,"application":{"name":"Mastodon.py | 398 | body: |
159 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":false,"bot":false,"discoverable":false,"group":false,"created_at":"2020-02-22T20:26:54.402Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2020-02-22","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | 399 | string: '{"id":"108532515807337403","created_at":"2022-06-24T12:46:05.129Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/108532515807337403","url":"http://localhost/@mastodonpy_test/108532515807337403","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot!","reblog":null,"application":{"name":"Mastodon.py |
400 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-06-24T00:00:00.000Z","note":"","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":"2022-06-24","emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}' | ||
160 | headers: | 401 | headers: |
161 | Cache-Control: ['no-cache, no-store'] | 402 | Cache-Control: |
162 | Content-Type: [application/json; charset=utf-8] | 403 | - no-store |
163 | Referrer-Policy: [strict-origin-when-cross-origin] | 404 | Content-Security-Policy: |
164 | Transfer-Encoding: [chunked] | 405 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src |
165 | Vary: ['Accept-Encoding, Origin'] | 406 | ''self'' http://localhost; img-src ''self'' https: data: blob: http://localhost; |
166 | X-Content-Type-Options: [nosniff] | 407 | style-src ''self'' http://localhost ''nonce-9ZHC6oHcDEPPkskChbQjOQ==''; media-src |
167 | X-Download-Options: [noopen] | 408 | ''self'' https: data: http://localhost; frame-src ''self'' https:; manifest-src |
168 | X-Frame-Options: [SAMEORIGIN] | 409 | ''self'' http://localhost; connect-src ''self'' data: blob: http://localhost |
169 | X-Permitted-Cross-Domain-Policies: [none] | 410 | http://files.example.com ws://localhost:4000 ws://localhost:3035 http://localhost:3035; |
170 | X-Request-Id: [c222a2ef-6671-4d1c-97be-0a4e2b2f6a14] | 411 | script-src ''self'' ''unsafe-inline'' ''unsafe-eval'' http://localhost; child-src |
171 | X-Runtime: ['0.122283'] | 412 | ''self'' blob: http://localhost; worker-src ''self'' blob: http://localhost' |
172 | X-XSS-Protection: [1; mode=block] | 413 | Content-Type: |
173 | content-length: ['1290'] | 414 | - application/json; charset=utf-8 |
174 | status: {code: 200, message: OK} | 415 | ETag: |
416 | - W/"efc9742f5a2c445d981fd8b15ed77122" | ||
417 | Referrer-Policy: | ||
418 | - strict-origin-when-cross-origin | ||
419 | Transfer-Encoding: | ||
420 | - chunked | ||
421 | Vary: | ||
422 | - Accept, Accept-Encoding, Origin | ||
423 | X-Content-Type-Options: | ||
424 | - nosniff | ||
425 | X-Download-Options: | ||
426 | - noopen | ||
427 | X-Frame-Options: | ||
428 | - SAMEORIGIN | ||
429 | X-Permitted-Cross-Domain-Policies: | ||
430 | - none | ||
431 | X-Request-Id: | ||
432 | - 1ca08d80-70b4-4aa9-abfe-5ca3286f63b8 | ||
433 | X-Runtime: | ||
434 | - '0.037653' | ||
435 | X-XSS-Protection: | ||
436 | - 1; mode=block | ||
437 | content-length: | ||
438 | - '1278' | ||
439 | status: | ||
440 | code: 200 | ||
441 | message: OK | ||
175 | version: 1 | 442 | version: 1 |
diff --git a/tests/test_bookmarks.py b/tests/test_bookmarks.py index a90a43e..e5e0d7c 100644 --- a/tests/test_bookmarks.py +++ b/tests/test_bookmarks.py | |||
@@ -11,6 +11,11 @@ def test_bookmarks(api, status): | |||
11 | assert len(bookmarked_statuses) > 0 | 11 | assert len(bookmarked_statuses) > 0 |
12 | assert status_bookmarked == bookmarked_statuses[0] | 12 | assert status_bookmarked == bookmarked_statuses[0] |
13 | 13 | ||
14 | bookmarked_statuses = api.bookmarks(limit=1) | ||
15 | assert bookmarked_statuses | ||
16 | assert len(bookmarked_statuses) > 0 | ||
17 | assert status_bookmarked == bookmarked_statuses[0] | ||
18 | |||
14 | status_unbookmarked = api.status_unbookmark(status_bookmarked) | 19 | status_unbookmarked = api.status_unbookmark(status_bookmarked) |
15 | assert status_unbookmarked | 20 | assert status_unbookmarked |
16 | assert status_unbookmarked.bookmarked == False | 21 | assert status_unbookmarked.bookmarked == False |