diff options
author | halcy <halcy@ARARAGI-KUN> | 2022-11-17 20:50:23 +0200 |
---|---|---|
committer | halcy <halcy@ARARAGI-KUN> | 2022-11-17 20:50:23 +0200 |
commit | ec0194c643d1a59cae8a6c8137f382db8fb4e0aa (patch) | |
tree | 166f8191c1746d74c10209d4cf3065da7e9992b7 /tests | |
parent | 3ed1cf73999ceef24ea3bf8395855bdde3876573 (diff) | |
download | mastodon.py-ec0194c643d1a59cae8a6c8137f382db8fb4e0aa.tar.gz |
Add additional date based tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cassettes/test_min_max_id.yaml | 380 | ||||
-rw-r--r-- | tests/cassettes/test_min_max_id_datetimes.yaml | 258 | ||||
-rw-r--r-- | tests/test_status.py | 1 | ||||
-rw-r--r-- | tests/test_timeline.py | 33 |
4 files changed, 669 insertions, 3 deletions
diff --git a/tests/cassettes/test_min_max_id.yaml b/tests/cassettes/test_min_max_id.yaml new file mode 100644 index 0000000..b1949a9 --- /dev/null +++ b/tests/cassettes/test_min_max_id.yaml | |||
@@ -0,0 +1,380 @@ | |||
1 | interactions: | ||
2 | - request: | ||
3 | body: status=Toot%21 | ||
4 | headers: | ||
5 | Accept: | ||
6 | - '*/*' | ||
7 | Accept-Encoding: | ||
8 | - gzip, deflate | ||
9 | Authorization: | ||
10 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
11 | Connection: | ||
12 | - keep-alive | ||
13 | Content-Length: | ||
14 | - '14' | ||
15 | Content-Type: | ||
16 | - application/x-www-form-urlencoded | ||
17 | User-Agent: | ||
18 | - tests/v311 | ||
19 | method: POST | ||
20 | uri: http://localhost:3000/api/v1/statuses | ||
21 | response: | ||
22 | body: | ||
23 | string: '{"id":"109360624391698779","created_at":"2022-11-17T18:44:59.338Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109360624391698779","url":"http://localhost:3000/@mastodonpy_test/109360624391698779","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","filtered":[],"reblog":null,"application":{"name":"Mastodon.py | ||
24 | test suite","website":null},"account":{"id":"109337440686176140","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
25 | Lennon","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"\u003cp\u003eI | ||
26 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","avatar_static":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","header":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","header_static":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","followers_count":0,"following_count":0,"statuses_count":5,"last_status_at":"2022-11-17","noindex":false,"emojis":[],"fields":[{"name":"bread","value":"toasty.","verified_at":null},{"name":"lasagna","value":"no!!!","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}' | ||
27 | headers: | ||
28 | Cache-Control: | ||
29 | - no-store | ||
30 | Content-Security-Policy: | ||
31 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src | ||
32 | ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; | ||
33 | style-src ''self'' http://localhost:3000 ''nonce-7PD2M+Hkp95XDeH9AZgP3w==''; | ||
34 | media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' | ||
35 | https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' | ||
36 | data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 | ||
37 | ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline'' | ||
38 | ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000; | ||
39 | worker-src ''self'' blob: http://localhost:3000' | ||
40 | Content-Type: | ||
41 | - application/json; charset=utf-8 | ||
42 | ETag: | ||
43 | - W/"2d9f092633108eeb20b6a7ef4f3d024c" | ||
44 | Referrer-Policy: | ||
45 | - strict-origin-when-cross-origin | ||
46 | Transfer-Encoding: | ||
47 | - chunked | ||
48 | Vary: | ||
49 | - Accept, Origin | ||
50 | X-Content-Type-Options: | ||
51 | - nosniff | ||
52 | X-Download-Options: | ||
53 | - noopen | ||
54 | X-Frame-Options: | ||
55 | - SAMEORIGIN | ||
56 | X-Permitted-Cross-Domain-Policies: | ||
57 | - none | ||
58 | X-RateLimit-Limit: | ||
59 | - '300' | ||
60 | X-RateLimit-Remaining: | ||
61 | - '296' | ||
62 | X-RateLimit-Reset: | ||
63 | - '2022-11-17T21:00:00.359774Z' | ||
64 | X-Request-Id: | ||
65 | - 3f31e32c-f997-4ffd-8fcf-1f3f1192099f | ||
66 | X-Runtime: | ||
67 | - '0.034910' | ||
68 | X-XSS-Protection: | ||
69 | - 1; mode=block | ||
70 | status: | ||
71 | code: 200 | ||
72 | message: OK | ||
73 | - request: | ||
74 | body: null | ||
75 | headers: | ||
76 | Accept: | ||
77 | - '*/*' | ||
78 | Accept-Encoding: | ||
79 | - gzip, deflate | ||
80 | Authorization: | ||
81 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
82 | Connection: | ||
83 | - keep-alive | ||
84 | User-Agent: | ||
85 | - tests/v311 | ||
86 | method: GET | ||
87 | uri: http://localhost:3000/api/v1/timelines/home?max_id=109360624391699779&min_id=109360624391697779 | ||
88 | response: | ||
89 | body: | ||
90 | string: '[{"id":"109360624391698779","created_at":"2022-11-17T18:44:59.338Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109360624391698779","url":"http://localhost:3000/@mastodonpy_test/109360624391698779","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","filtered":[],"reblog":null,"application":{"name":"Mastodon.py | ||
91 | test suite","website":null},"account":{"id":"109337440686176140","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
92 | Lennon","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"\u003cp\u003eI | ||
93 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","avatar_static":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","header":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","header_static":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","followers_count":0,"following_count":0,"statuses_count":5,"last_status_at":"2022-11-17","noindex":false,"emojis":[],"fields":[{"name":"bread","value":"toasty.","verified_at":null},{"name":"lasagna","value":"no!!!","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]' | ||
94 | headers: | ||
95 | Cache-Control: | ||
96 | - no-store | ||
97 | Content-Security-Policy: | ||
98 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src | ||
99 | ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; | ||
100 | style-src ''self'' http://localhost:3000 ''nonce-umQnh4dgArZ6+HlN/t/4Pw==''; | ||
101 | media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' | ||
102 | https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' | ||
103 | data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 | ||
104 | ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline'' | ||
105 | ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000; | ||
106 | worker-src ''self'' blob: http://localhost:3000' | ||
107 | Content-Type: | ||
108 | - application/json; charset=utf-8 | ||
109 | ETag: | ||
110 | - W/"0b77977458c172ecb6e2e478bb4e72ef" | ||
111 | Link: | ||
112 | - <http://localhost:3000/api/v1/timelines/home?max_id=109360624391698779>; rel="next", | ||
113 | <http://localhost:3000/api/v1/timelines/home?min_id=109360624391698779>; rel="prev" | ||
114 | Referrer-Policy: | ||
115 | - strict-origin-when-cross-origin | ||
116 | Transfer-Encoding: | ||
117 | - chunked | ||
118 | Vary: | ||
119 | - Accept, Origin | ||
120 | X-Content-Type-Options: | ||
121 | - nosniff | ||
122 | X-Download-Options: | ||
123 | - noopen | ||
124 | X-Frame-Options: | ||
125 | - SAMEORIGIN | ||
126 | X-Permitted-Cross-Domain-Policies: | ||
127 | - none | ||
128 | X-Request-Id: | ||
129 | - 4495596f-301b-4548-bf2c-da58c0f54648 | ||
130 | X-Runtime: | ||
131 | - '0.023698' | ||
132 | X-XSS-Protection: | ||
133 | - 1; mode=block | ||
134 | status: | ||
135 | code: 200 | ||
136 | message: OK | ||
137 | - request: | ||
138 | body: null | ||
139 | headers: | ||
140 | Accept: | ||
141 | - '*/*' | ||
142 | Accept-Encoding: | ||
143 | - gzip, deflate | ||
144 | Authorization: | ||
145 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
146 | Connection: | ||
147 | - keep-alive | ||
148 | User-Agent: | ||
149 | - tests/v311 | ||
150 | method: GET | ||
151 | uri: http://localhost:3000/api/v1/timelines/home?max_id=109360624391697779&min_id=109360624391696779 | ||
152 | response: | ||
153 | body: | ||
154 | string: '[]' | ||
155 | headers: | ||
156 | Cache-Control: | ||
157 | - no-store | ||
158 | Content-Security-Policy: | ||
159 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src | ||
160 | ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; | ||
161 | style-src ''self'' http://localhost:3000 ''nonce-LKd/t0vn1hppJoYDXrs2kg==''; | ||
162 | media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' | ||
163 | https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' | ||
164 | data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 | ||
165 | ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline'' | ||
166 | ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000; | ||
167 | worker-src ''self'' blob: http://localhost:3000' | ||
168 | Content-Type: | ||
169 | - application/json; charset=utf-8 | ||
170 | ETag: | ||
171 | - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5" | ||
172 | Referrer-Policy: | ||
173 | - strict-origin-when-cross-origin | ||
174 | Transfer-Encoding: | ||
175 | - chunked | ||
176 | Vary: | ||
177 | - Accept, Origin | ||
178 | X-Content-Type-Options: | ||
179 | - nosniff | ||
180 | X-Download-Options: | ||
181 | - noopen | ||
182 | X-Frame-Options: | ||
183 | - SAMEORIGIN | ||
184 | X-Permitted-Cross-Domain-Policies: | ||
185 | - none | ||
186 | X-Request-Id: | ||
187 | - c5b96c1a-3666-4ec8-9cc4-49b36f97834d | ||
188 | X-Runtime: | ||
189 | - '0.008873' | ||
190 | X-XSS-Protection: | ||
191 | - 1; mode=block | ||
192 | status: | ||
193 | code: 200 | ||
194 | message: OK | ||
195 | - request: | ||
196 | body: null | ||
197 | headers: | ||
198 | Accept: | ||
199 | - '*/*' | ||
200 | Accept-Encoding: | ||
201 | - gzip, deflate | ||
202 | Authorization: | ||
203 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
204 | Connection: | ||
205 | - keep-alive | ||
206 | User-Agent: | ||
207 | - tests/v311 | ||
208 | method: GET | ||
209 | uri: http://localhost:3000/api/v1/timelines/home?max_id=109360624391700779&min_id=109360624391699779 | ||
210 | response: | ||
211 | body: | ||
212 | string: '[]' | ||
213 | headers: | ||
214 | Cache-Control: | ||
215 | - no-store | ||
216 | Content-Security-Policy: | ||
217 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src | ||
218 | ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; | ||
219 | style-src ''self'' http://localhost:3000 ''nonce-EEvW2QLUJQyIbCr57KowNg==''; | ||
220 | media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' | ||
221 | https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' | ||
222 | data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 | ||
223 | ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline'' | ||
224 | ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000; | ||
225 | worker-src ''self'' blob: http://localhost:3000' | ||
226 | Content-Type: | ||
227 | - application/json; charset=utf-8 | ||
228 | ETag: | ||
229 | - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5" | ||
230 | Referrer-Policy: | ||
231 | - strict-origin-when-cross-origin | ||
232 | Transfer-Encoding: | ||
233 | - chunked | ||
234 | Vary: | ||
235 | - Accept, Origin | ||
236 | X-Content-Type-Options: | ||
237 | - nosniff | ||
238 | X-Download-Options: | ||
239 | - noopen | ||
240 | X-Frame-Options: | ||
241 | - SAMEORIGIN | ||
242 | X-Permitted-Cross-Domain-Policies: | ||
243 | - none | ||
244 | X-Request-Id: | ||
245 | - 546884c6-bc00-470b-a9ee-d317c4f79e81 | ||
246 | X-Runtime: | ||
247 | - '0.014835' | ||
248 | X-XSS-Protection: | ||
249 | - 1; mode=block | ||
250 | status: | ||
251 | code: 200 | ||
252 | message: OK | ||
253 | - request: | ||
254 | body: null | ||
255 | headers: | ||
256 | Accept: | ||
257 | - '*/*' | ||
258 | Accept-Encoding: | ||
259 | - gzip, deflate | ||
260 | Authorization: | ||
261 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
262 | Connection: | ||
263 | - keep-alive | ||
264 | User-Agent: | ||
265 | - tests/v311 | ||
266 | method: GET | ||
267 | uri: http://localhost:3000/api/v1/timelines/home?since_id=109360624391697779 | ||
268 | response: | ||
269 | body: | ||
270 | string: '[{"id":"109360624391698779","created_at":"2022-11-17T18:44:59.338Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109360624391698779","url":"http://localhost:3000/@mastodonpy_test/109360624391698779","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","filtered":[],"reblog":null,"application":{"name":"Mastodon.py | ||
271 | test suite","website":null},"account":{"id":"109337440686176140","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
272 | Lennon","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"\u003cp\u003eI | ||
273 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","avatar_static":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","header":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","header_static":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","followers_count":0,"following_count":0,"statuses_count":5,"last_status_at":"2022-11-17","noindex":false,"emojis":[],"fields":[{"name":"bread","value":"toasty.","verified_at":null},{"name":"lasagna","value":"no!!!","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]' | ||
274 | headers: | ||
275 | Cache-Control: | ||
276 | - no-store | ||
277 | Content-Security-Policy: | ||
278 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src | ||
279 | ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; | ||
280 | style-src ''self'' http://localhost:3000 ''nonce-TrtSCm4YT9F4uLUXIY0vRQ==''; | ||
281 | media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' | ||
282 | https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' | ||
283 | data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 | ||
284 | ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline'' | ||
285 | ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000; | ||
286 | worker-src ''self'' blob: http://localhost:3000' | ||
287 | Content-Type: | ||
288 | - application/json; charset=utf-8 | ||
289 | ETag: | ||
290 | - W/"0b77977458c172ecb6e2e478bb4e72ef" | ||
291 | Link: | ||
292 | - <http://localhost:3000/api/v1/timelines/home?max_id=109360624391698779>; rel="next", | ||
293 | <http://localhost:3000/api/v1/timelines/home?min_id=109360624391698779>; rel="prev" | ||
294 | Referrer-Policy: | ||
295 | - strict-origin-when-cross-origin | ||
296 | Transfer-Encoding: | ||
297 | - chunked | ||
298 | Vary: | ||
299 | - Accept, Origin | ||
300 | X-Content-Type-Options: | ||
301 | - nosniff | ||
302 | X-Download-Options: | ||
303 | - noopen | ||
304 | X-Frame-Options: | ||
305 | - SAMEORIGIN | ||
306 | X-Permitted-Cross-Domain-Policies: | ||
307 | - none | ||
308 | X-Request-Id: | ||
309 | - 3c07ed0c-0ad0-420d-a9c0-11241532a871 | ||
310 | X-Runtime: | ||
311 | - '0.022015' | ||
312 | X-XSS-Protection: | ||
313 | - 1; mode=block | ||
314 | status: | ||
315 | code: 200 | ||
316 | message: OK | ||
317 | - request: | ||
318 | body: null | ||
319 | headers: | ||
320 | Accept: | ||
321 | - '*/*' | ||
322 | Accept-Encoding: | ||
323 | - gzip, deflate | ||
324 | Authorization: | ||
325 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
326 | Connection: | ||
327 | - keep-alive | ||
328 | Content-Length: | ||
329 | - '0' | ||
330 | User-Agent: | ||
331 | - tests/v311 | ||
332 | method: DELETE | ||
333 | uri: http://localhost:3000/api/v1/statuses/109360624391698779 | ||
334 | response: | ||
335 | body: | ||
336 | string: '{"id":"109360624391698779","created_at":"2022-11-17T18:44:59.338Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109360624391698779","url":"http://localhost:3000/@mastodonpy_test/109360624391698779","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot!","filtered":[],"reblog":null,"application":{"name":"Mastodon.py | ||
337 | test suite","website":null},"account":{"id":"109337440686176140","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
338 | Lennon","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"\u003cp\u003eI | ||
339 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","avatar_static":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","header":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","header_static":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","followers_count":0,"following_count":0,"statuses_count":4,"last_status_at":"2022-11-17","noindex":false,"emojis":[],"fields":[{"name":"bread","value":"toasty.","verified_at":null},{"name":"lasagna","value":"no!!!","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}' | ||
340 | headers: | ||
341 | Cache-Control: | ||
342 | - no-store | ||
343 | Content-Security-Policy: | ||
344 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src | ||
345 | ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; | ||
346 | style-src ''self'' http://localhost:3000 ''nonce-F52TsVgzZ1BnlZJlObRroA==''; | ||
347 | media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' | ||
348 | https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' | ||
349 | data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 | ||
350 | ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline'' | ||
351 | ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000; | ||
352 | worker-src ''self'' blob: http://localhost:3000' | ||
353 | Content-Type: | ||
354 | - application/json; charset=utf-8 | ||
355 | ETag: | ||
356 | - W/"ef04810fa607c99488439f6543a03280" | ||
357 | Referrer-Policy: | ||
358 | - strict-origin-when-cross-origin | ||
359 | Transfer-Encoding: | ||
360 | - chunked | ||
361 | Vary: | ||
362 | - Accept, Origin | ||
363 | X-Content-Type-Options: | ||
364 | - nosniff | ||
365 | X-Download-Options: | ||
366 | - noopen | ||
367 | X-Frame-Options: | ||
368 | - SAMEORIGIN | ||
369 | X-Permitted-Cross-Domain-Policies: | ||
370 | - none | ||
371 | X-Request-Id: | ||
372 | - 70d72698-5250-4d2b-811f-d46a23d643e4 | ||
373 | X-Runtime: | ||
374 | - '0.035722' | ||
375 | X-XSS-Protection: | ||
376 | - 1; mode=block | ||
377 | status: | ||
378 | code: 200 | ||
379 | message: OK | ||
380 | version: 1 | ||
diff --git a/tests/cassettes/test_min_max_id_datetimes.yaml b/tests/cassettes/test_min_max_id_datetimes.yaml new file mode 100644 index 0000000..51414f0 --- /dev/null +++ b/tests/cassettes/test_min_max_id_datetimes.yaml | |||
@@ -0,0 +1,258 @@ | |||
1 | interactions: | ||
2 | - request: | ||
3 | body: status=Toot%21 | ||
4 | headers: | ||
5 | Accept: | ||
6 | - '*/*' | ||
7 | Accept-Encoding: | ||
8 | - gzip, deflate | ||
9 | Authorization: | ||
10 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
11 | Connection: | ||
12 | - keep-alive | ||
13 | Content-Length: | ||
14 | - '14' | ||
15 | Content-Type: | ||
16 | - application/x-www-form-urlencoded | ||
17 | User-Agent: | ||
18 | - tests/v311 | ||
19 | method: POST | ||
20 | uri: http://localhost:3000/api/v1/statuses | ||
21 | response: | ||
22 | body: | ||
23 | string: '{"id":"109360644459818976","created_at":"2022-11-17T18:50:05.553Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109360644459818976","url":"http://localhost:3000/@mastodonpy_test/109360644459818976","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","filtered":[],"reblog":null,"application":{"name":"Mastodon.py | ||
24 | test suite","website":null},"account":{"id":"109337440686176140","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
25 | Lennon","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"\u003cp\u003eI | ||
26 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","avatar_static":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","header":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","header_static":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","followers_count":0,"following_count":0,"statuses_count":5,"last_status_at":"2022-11-17","noindex":false,"emojis":[],"fields":[{"name":"bread","value":"toasty.","verified_at":null},{"name":"lasagna","value":"no!!!","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}' | ||
27 | headers: | ||
28 | Cache-Control: | ||
29 | - no-store | ||
30 | Content-Security-Policy: | ||
31 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src | ||
32 | ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; | ||
33 | style-src ''self'' http://localhost:3000 ''nonce-GNnrTSvg1wDIabQ3kjtGyQ==''; | ||
34 | media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' | ||
35 | https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' | ||
36 | data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 | ||
37 | ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline'' | ||
38 | ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000; | ||
39 | worker-src ''self'' blob: http://localhost:3000' | ||
40 | Content-Type: | ||
41 | - application/json; charset=utf-8 | ||
42 | ETag: | ||
43 | - W/"58511b0f15d0c3ac192c75655d58aca2" | ||
44 | Referrer-Policy: | ||
45 | - strict-origin-when-cross-origin | ||
46 | Transfer-Encoding: | ||
47 | - chunked | ||
48 | Vary: | ||
49 | - Accept, Origin | ||
50 | X-Content-Type-Options: | ||
51 | - nosniff | ||
52 | X-Download-Options: | ||
53 | - noopen | ||
54 | X-Frame-Options: | ||
55 | - SAMEORIGIN | ||
56 | X-Permitted-Cross-Domain-Policies: | ||
57 | - none | ||
58 | X-RateLimit-Limit: | ||
59 | - '300' | ||
60 | X-RateLimit-Remaining: | ||
61 | - '294' | ||
62 | X-RateLimit-Reset: | ||
63 | - '2022-11-17T21:00:00.626208Z' | ||
64 | X-Request-Id: | ||
65 | - 07b95dd9-1b8c-403d-84d7-9086e3d1f875 | ||
66 | X-Runtime: | ||
67 | - '0.103956' | ||
68 | X-XSS-Protection: | ||
69 | - 1; mode=block | ||
70 | status: | ||
71 | code: 200 | ||
72 | message: OK | ||
73 | - request: | ||
74 | body: null | ||
75 | headers: | ||
76 | Accept: | ||
77 | - '*/*' | ||
78 | Accept-Encoding: | ||
79 | - gzip, deflate | ||
80 | Authorization: | ||
81 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
82 | Connection: | ||
83 | - keep-alive | ||
84 | User-Agent: | ||
85 | - tests/v311 | ||
86 | method: GET | ||
87 | uri: http://localhost:3000/api/v1/timelines/home?max_id=109360645734400000&min_id=109360643112960000 | ||
88 | response: | ||
89 | body: | ||
90 | string: '[{"id":"109360644459818976","created_at":"2022-11-17T18:50:05.553Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109360644459818976","url":"http://localhost:3000/@mastodonpy_test/109360644459818976","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","filtered":[],"reblog":null,"application":{"name":"Mastodon.py | ||
91 | test suite","website":null},"account":{"id":"109337440686176140","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
92 | Lennon","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"\u003cp\u003eI | ||
93 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","avatar_static":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","header":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","header_static":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","followers_count":0,"following_count":0,"statuses_count":5,"last_status_at":"2022-11-17","noindex":false,"emojis":[],"fields":[{"name":"bread","value":"toasty.","verified_at":null},{"name":"lasagna","value":"no!!!","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}]' | ||
94 | headers: | ||
95 | Cache-Control: | ||
96 | - no-store | ||
97 | Content-Security-Policy: | ||
98 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src | ||
99 | ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; | ||
100 | style-src ''self'' http://localhost:3000 ''nonce-S6/DmjeVOHI/8no8CZqoEA==''; | ||
101 | media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' | ||
102 | https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' | ||
103 | data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 | ||
104 | ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline'' | ||
105 | ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000; | ||
106 | worker-src ''self'' blob: http://localhost:3000' | ||
107 | Content-Type: | ||
108 | - application/json; charset=utf-8 | ||
109 | ETag: | ||
110 | - W/"86a06105a5e70f233a95eea2721f69ee" | ||
111 | Link: | ||
112 | - <http://localhost:3000/api/v1/timelines/home?max_id=109360644459818976>; rel="next", | ||
113 | <http://localhost:3000/api/v1/timelines/home?min_id=109360644459818976>; rel="prev" | ||
114 | Referrer-Policy: | ||
115 | - strict-origin-when-cross-origin | ||
116 | Transfer-Encoding: | ||
117 | - chunked | ||
118 | Vary: | ||
119 | - Accept, Origin | ||
120 | X-Content-Type-Options: | ||
121 | - nosniff | ||
122 | X-Download-Options: | ||
123 | - noopen | ||
124 | X-Frame-Options: | ||
125 | - SAMEORIGIN | ||
126 | X-Permitted-Cross-Domain-Policies: | ||
127 | - none | ||
128 | X-Request-Id: | ||
129 | - 738b28f0-169a-49b8-89bf-97dfc60608c8 | ||
130 | X-Runtime: | ||
131 | - '0.029525' | ||
132 | X-XSS-Protection: | ||
133 | - 1; mode=block | ||
134 | status: | ||
135 | code: 200 | ||
136 | message: OK | ||
137 | - request: | ||
138 | body: null | ||
139 | headers: | ||
140 | Accept: | ||
141 | - '*/*' | ||
142 | Accept-Encoding: | ||
143 | - gzip, deflate | ||
144 | Authorization: | ||
145 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
146 | Connection: | ||
147 | - keep-alive | ||
148 | User-Agent: | ||
149 | - tests/v311 | ||
150 | method: GET | ||
151 | uri: http://localhost:3000/api/v1/timelines/home?max_id=109360647045120000&min_id=109360645734400000 | ||
152 | response: | ||
153 | body: | ||
154 | string: '[]' | ||
155 | headers: | ||
156 | Cache-Control: | ||
157 | - no-store | ||
158 | Content-Security-Policy: | ||
159 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src | ||
160 | ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; | ||
161 | style-src ''self'' http://localhost:3000 ''nonce-V/vKOm6+nPmC5SpFFwp80w==''; | ||
162 | media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' | ||
163 | https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' | ||
164 | data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 | ||
165 | ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline'' | ||
166 | ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000; | ||
167 | worker-src ''self'' blob: http://localhost:3000' | ||
168 | Content-Type: | ||
169 | - application/json; charset=utf-8 | ||
170 | ETag: | ||
171 | - W/"4f53cda18c2baa0c0354bb5f9a3ecbe5" | ||
172 | Referrer-Policy: | ||
173 | - strict-origin-when-cross-origin | ||
174 | Transfer-Encoding: | ||
175 | - chunked | ||
176 | Vary: | ||
177 | - Accept, Origin | ||
178 | X-Content-Type-Options: | ||
179 | - nosniff | ||
180 | X-Download-Options: | ||
181 | - noopen | ||
182 | X-Frame-Options: | ||
183 | - SAMEORIGIN | ||
184 | X-Permitted-Cross-Domain-Policies: | ||
185 | - none | ||
186 | X-Request-Id: | ||
187 | - e7c84272-bb28-42ca-a59e-cce7539844ad | ||
188 | X-Runtime: | ||
189 | - '0.009517' | ||
190 | X-XSS-Protection: | ||
191 | - 1; mode=block | ||
192 | status: | ||
193 | code: 200 | ||
194 | message: OK | ||
195 | - request: | ||
196 | body: null | ||
197 | headers: | ||
198 | Accept: | ||
199 | - '*/*' | ||
200 | Accept-Encoding: | ||
201 | - gzip, deflate | ||
202 | Authorization: | ||
203 | - Bearer __MASTODON_PY_TEST_ACCESS_TOKEN | ||
204 | Connection: | ||
205 | - keep-alive | ||
206 | Content-Length: | ||
207 | - '0' | ||
208 | User-Agent: | ||
209 | - tests/v311 | ||
210 | method: DELETE | ||
211 | uri: http://localhost:3000/api/v1/statuses/109360644459818976 | ||
212 | response: | ||
213 | body: | ||
214 | string: '{"id":"109360644459818976","created_at":"2022-11-17T18:50:05.553Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost:3000/users/mastodonpy_test/statuses/109360644459818976","url":"http://localhost:3000/@mastodonpy_test/109360644459818976","replies_count":0,"reblogs_count":0,"favourites_count":0,"edited_at":null,"favourited":false,"reblogged":false,"muted":false,"bookmarked":false,"pinned":false,"text":"Toot!","filtered":[],"reblog":null,"application":{"name":"Mastodon.py | ||
215 | test suite","website":null},"account":{"id":"109337440686176140","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
216 | Lennon","locked":true,"bot":false,"discoverable":null,"group":false,"created_at":"2022-11-13T00:00:00.000Z","note":"\u003cp\u003eI | ||
217 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","avatar_static":"http://localhost:3000/system/accounts/avatars/109/337/440/686/176/140/original/d6cd9a5a5e65da30.jpg","header":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","header_static":"http://localhost:3000/system/accounts/headers/109/337/440/686/176/140/original/2b7760a42692fbde.jpg","followers_count":0,"following_count":0,"statuses_count":4,"last_status_at":"2022-11-17","noindex":false,"emojis":[],"fields":[{"name":"bread","value":"toasty.","verified_at":null},{"name":"lasagna","value":"no!!!","verified_at":null}]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}' | ||
218 | headers: | ||
219 | Cache-Control: | ||
220 | - no-store | ||
221 | Content-Security-Policy: | ||
222 | - 'base-uri ''none''; default-src ''none''; frame-ancestors ''none''; font-src | ||
223 | ''self'' http://localhost:3000; img-src ''self'' https: data: blob: http://localhost:3000; | ||
224 | style-src ''self'' http://localhost:3000 ''nonce-+b0YxTzjfZxXGiiUjfZehw==''; | ||
225 | media-src ''self'' https: data: http://localhost:3000; frame-src ''self'' | ||
226 | https:; manifest-src ''self'' http://localhost:3000; connect-src ''self'' | ||
227 | data: blob: http://localhost:3000 http://localhost:3000 ws://localhost:4000 | ||
228 | ws://localhost:3035 http://localhost:3035; script-src ''self'' ''unsafe-inline'' | ||
229 | ''unsafe-eval'' http://localhost:3000; child-src ''self'' blob: http://localhost:3000; | ||
230 | worker-src ''self'' blob: http://localhost:3000' | ||
231 | Content-Type: | ||
232 | - application/json; charset=utf-8 | ||
233 | ETag: | ||
234 | - W/"02008e45c6ebce96f6e4e9ec2354008b" | ||
235 | Referrer-Policy: | ||
236 | - strict-origin-when-cross-origin | ||
237 | Transfer-Encoding: | ||
238 | - chunked | ||
239 | Vary: | ||
240 | - Accept, Origin | ||
241 | X-Content-Type-Options: | ||
242 | - nosniff | ||
243 | X-Download-Options: | ||
244 | - noopen | ||
245 | X-Frame-Options: | ||
246 | - SAMEORIGIN | ||
247 | X-Permitted-Cross-Domain-Policies: | ||
248 | - none | ||
249 | X-Request-Id: | ||
250 | - 0eed8861-4f33-4cbc-85c4-cc45f270a344 | ||
251 | X-Runtime: | ||
252 | - '0.036224' | ||
253 | X-XSS-Protection: | ||
254 | - 1; mode=block | ||
255 | status: | ||
256 | code: 200 | ||
257 | message: OK | ||
258 | version: 1 | ||
diff --git a/tests/test_status.py b/tests/test_status.py index 91b07fb..dff9812 100644 --- a/tests/test_status.py +++ b/tests/test_status.py | |||
@@ -179,3 +179,4 @@ def test_scheduled_status(api): | |||
179 | scheduled_toot_list_3 = api.scheduled_statuses() | 179 | scheduled_toot_list_3 = api.scheduled_statuses() |
180 | assert scheduled_toot_4.id in map(lambda x: x.id, statuses) | 180 | assert scheduled_toot_4.id in map(lambda x: x.id, statuses) |
181 | assert not scheduled_toot_4.id in map(lambda x: x.id, scheduled_toot_list_3) | 181 | assert not scheduled_toot_4.id in map(lambda x: x.id, scheduled_toot_list_3) |
182 | \ No newline at end of file | ||
diff --git a/tests/test_timeline.py b/tests/test_timeline.py index 3e6fe22..fbeae8e 100644 --- a/tests/test_timeline.py +++ b/tests/test_timeline.py | |||
@@ -1,8 +1,7 @@ | |||
1 | import pytest | 1 | import pytest |
2 | import time | 2 | import time |
3 | from mastodon.Mastodon import MastodonAPIError,\ | 3 | from mastodon.Mastodon import MastodonAPIError, MastodonIllegalArgumentError, MastodonUnauthorizedError |
4 | MastodonIllegalArgumentError,\ | 4 | import datetime |
5 | MastodonUnauthorizedError | ||
6 | 5 | ||
7 | @pytest.mark.vcr() | 6 | @pytest.mark.vcr() |
8 | def test_public_tl_anonymous(api_anonymous, status3): | 7 | def test_public_tl_anonymous(api_anonymous, status3): |
@@ -61,3 +60,31 @@ def test_conversations(api, api2): | |||
61 | assert account.id in map(lambda x: x.accounts[0].id, conversations) | 60 | assert account.id in map(lambda x: x.accounts[0].id, conversations) |
62 | assert conversations[0].unread == True | 61 | assert conversations[0].unread == True |
63 | assert conversations2[0].unread == False | 62 | assert conversations2[0].unread == False |
63 | |||
64 | @pytest.mark.vcr() | ||
65 | def test_min_max_id(api, status): | ||
66 | time.sleep(3) | ||
67 | tl = api.timeline_home(min_id = status.id - 1000, max_id = status.id + 1000) | ||
68 | assert status['id'] in map(lambda st: st['id'], tl) | ||
69 | |||
70 | tl = api.timeline_home(min_id = status.id - 2000, max_id = status.id - 1000) | ||
71 | assert not status['id'] in map(lambda st: st['id'], tl) | ||
72 | |||
73 | tl = api.timeline_home(min_id = status.id + 1000, max_id = status.id + 2000) | ||
74 | assert not status['id'] in map(lambda st: st['id'], tl) | ||
75 | |||
76 | tl = api.timeline_home(since_id = status.id - 1000) | ||
77 | assert status['id'] in map(lambda st: st['id'], tl) | ||
78 | |||
79 | @pytest.mark.vcr() | ||
80 | def test_min_max_id_datetimes(api, status): | ||
81 | the_past = datetime.datetime.now() - datetime.timedelta(seconds=20) | ||
82 | the_future = datetime.datetime.now() + datetime.timedelta(seconds=20) | ||
83 | the_far_future = datetime.datetime.now() + datetime.timedelta(seconds=40) | ||
84 | |||
85 | time.sleep(3) | ||
86 | tl = api.timeline_home(min_id = the_past, max_id = the_future) | ||
87 | assert status['id'] in map(lambda st: st['id'], tl) | ||
88 | |||
89 | tl = api.timeline_home(min_id = the_future, max_id = the_far_future) | ||
90 | assert not status['id'] in map(lambda st: st['id'], tl) | ||