aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2018-05-06 15:42:38 +0200
committerLorenz Diener <[email protected]>2018-05-06 15:42:38 +0200
commitba2fccc1cf0957387f616da64c20e329eba95263 (patch)
tree3a213922cd66f04ce526c349ff56724f9b2d56e8 /tests
parentbb92f76e61063bbe59868659fb42824d3649c7b2 (diff)
downloadmastodon.py-ba2fccc1cf0957387f616da64c20e329eba95263.tar.gz
Add lists tests and fix a bug
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_list_add_remove_account.yaml367
-rw-r--r--tests/cassettes/test_list_by_account.yaml184
-rw-r--r--tests/cassettes/test_list_create.yaml80
-rw-r--r--tests/cassettes/test_list_timeline.yaml244
-rw-r--r--tests/cassettes/test_list_update.yaml157
-rw-r--r--tests/test_lists.py61
6 files changed, 1093 insertions, 0 deletions
diff --git a/tests/cassettes/test_list_add_remove_account.yaml b/tests/cassettes/test_list_add_remove_account.yaml
new file mode 100644
index 0000000..f0b0ba7
--- /dev/null
+++ b/tests/cassettes/test_list_add_remove_account.yaml
@@ -0,0 +1,367 @@
1interactions:
2- request:
3 body: title=ham+burglars
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
8 Connection: [keep-alive]
9 Content-Length: ['18']
10 Content-Type: [application/x-www-form-urlencoded]
11 User-Agent: [python-requests/2.9.1]
12 method: POST
13 uri: http://localhost:3000/api/v1/lists
14 response:
15 body: {string: '{"id":"23","title":"ham burglars"}'}
16 headers:
17 Cache-Control: ['max-age=0, private, must-revalidate']
18 Content-Type: [application/json; charset=utf-8]
19 ETag: [W/"0bcee380026306b4b8a9913243ef8d50"]
20 Transfer-Encoding: [chunked]
21 Vary: ['Accept-Encoding, Origin']
22 X-Content-Type-Options: [nosniff]
23 X-Frame-Options: [SAMEORIGIN]
24 X-Request-Id: [259f3b2e-1a4a-469d-82da-c2c604c4a950]
25 X-Runtime: ['0.056062']
26 X-XSS-Protection: [1; mode=block]
27 content-length: ['34']
28 status: {code: 200, message: OK}
29- request:
30 body: null
31 headers:
32 Accept: ['*/*']
33 Accept-Encoding: ['gzip, deflate']
34 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2]
35 Connection: [keep-alive]
36 User-Agent: [python-requests/2.9.1]
37 method: GET
38 uri: http://localhost:3000/api/v1/accounts/verify_credentials
39 response:
40 body: {string: '{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"created_at":"2018-04-17T21:40:55.626Z","note":"\u003cp\u003e\u003c/p\u003e","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":51,"source":{"privacy":"public","sensitive":false,"note":""}}'}
41 headers:
42 Cache-Control: ['max-age=0, private, must-revalidate']
43 Content-Type: [application/json; charset=utf-8]
44 ETag: [W/"52597edacbe583a8c705f06e18236329"]
45 Transfer-Encoding: [chunked]
46 Vary: ['Accept-Encoding, Origin']
47 X-Content-Type-Options: [nosniff]
48 X-Frame-Options: [SAMEORIGIN]
49 X-Request-Id: [2d436ac6-f2f9-4b2c-882e-8700462f1360]
50 X-Runtime: ['0.071364']
51 X-XSS-Protection: [1; mode=block]
52 content-length: ['571']
53 status: {code: 200, message: OK}
54- request:
55 body: null
56 headers:
57 Accept: ['*/*']
58 Accept-Encoding: ['gzip, deflate']
59 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
60 Connection: [keep-alive]
61 Content-Length: ['0']
62 User-Agent: [python-requests/2.9.1]
63 method: POST
64 uri: http://localhost:3000/api/v1/accounts/1/follow
65 response:
66 body: {string: '{"id":"1","following":true,"showing_reblogs":false,"followed_by":false,"blocking":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false}'}
67 headers:
68 Cache-Control: ['max-age=0, private, must-revalidate']
69 Content-Type: [application/json; charset=utf-8]
70 ETag: [W/"98c147556f83bd7b26490f2eac449592"]
71 Transfer-Encoding: [chunked]
72 Vary: ['Accept-Encoding, Origin']
73 X-Content-Type-Options: [nosniff]
74 X-Frame-Options: [SAMEORIGIN]
75 X-Request-Id: [79ef47dd-e003-4d92-b6ba-dfb51011822f]
76 X-Runtime: ['0.099480']
77 X-XSS-Protection: [1; mode=block]
78 content-length: ['174']
79 status: {code: 200, message: OK}
80- request:
81 body: account_ids%5B%5D=1
82 headers:
83 Accept: ['*/*']
84 Accept-Encoding: ['gzip, deflate']
85 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
86 Connection: [keep-alive]
87 Content-Length: ['19']
88 Content-Type: [application/x-www-form-urlencoded]
89 User-Agent: [python-requests/2.9.1]
90 method: POST
91 uri: http://localhost:3000/api/v1/lists/23/accounts
92 response:
93 body: {string: '{}'}
94 headers:
95 Cache-Control: ['max-age=0, private, must-revalidate']
96 Content-Type: [application/json; charset=utf-8]
97 ETag: [W/"ee6751ce2dc32e165dd24aca071f6eed"]
98 Transfer-Encoding: [chunked]
99 Vary: ['Accept-Encoding, Origin']
100 X-Content-Type-Options: [nosniff]
101 X-Frame-Options: [SAMEORIGIN]
102 X-Request-Id: [0a67c0e2-3839-4c48-9d71-6a2a2e53f493]
103 X-Runtime: ['0.064774']
104 X-XSS-Protection: [1; mode=block]
105 content-length: ['2']
106 status: {code: 200, message: OK}
107- request:
108 body: null
109 headers:
110 Accept: ['*/*']
111 Accept-Encoding: ['gzip, deflate']
112 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
113 Connection: [keep-alive]
114 User-Agent: [python-requests/2.9.1]
115 method: GET
116 uri: http://localhost:3000/api/v1/lists/23/accounts
117 response:
118 body: {string: '[{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"created_at":"2018-04-17T21:40:55.626Z","note":"\u003cp\u003e\u003c/p\u003e","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":51}]'}
119 headers:
120 Cache-Control: ['max-age=0, private, must-revalidate']
121 Content-Type: [application/json; charset=utf-8]
122 ETag: [W/"4d3af392a570a5835fef368719dd8061"]
123 Link: ['<http://localhost:3000/api/v1/lists/23/accounts?since_id=1>; rel="prev"']
124 Transfer-Encoding: [chunked]
125 Vary: ['Accept-Encoding, Origin']
126 X-Content-Type-Options: [nosniff]
127 X-Frame-Options: [SAMEORIGIN]
128 X-Request-Id: [8fe7676a-8ba8-4eb9-bd43-63889ea9c192]
129 X-Runtime: ['0.052742']
130 X-XSS-Protection: [1; mode=block]
131 content-length: ['515']
132 status: {code: 200, message: OK}
133- request:
134 body: null
135 headers:
136 Accept: ['*/*']
137 Accept-Encoding: ['gzip, deflate']
138 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
139 Connection: [keep-alive]
140 Content-Length: ['0']
141 User-Agent: [python-requests/2.9.1]
142 method: POST
143 uri: http://localhost:3000/api/v1/accounts/1/unfollow
144 response:
145 body: {string: '{"id":"1","following":false,"showing_reblogs":false,"followed_by":false,"blocking":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false}'}
146 headers:
147 Cache-Control: ['max-age=0, private, must-revalidate']
148 Content-Type: [application/json; charset=utf-8]
149 ETag: [W/"1e5f6a4b23911d5c2aeb66f774492a0b"]
150 Transfer-Encoding: [chunked]
151 Vary: ['Accept-Encoding, Origin']
152 X-Content-Type-Options: [nosniff]
153 X-Frame-Options: [SAMEORIGIN]
154 X-Request-Id: [f9e46470-cfe8-4d23-bbf8-d909a0c9502a]
155 X-Runtime: ['0.086559']
156 X-XSS-Protection: [1; mode=block]
157 content-length: ['175']
158 status: {code: 200, message: OK}
159- request:
160 body: null
161 headers:
162 Accept: ['*/*']
163 Accept-Encoding: ['gzip, deflate']
164 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
165 Connection: [keep-alive]
166 User-Agent: [python-requests/2.9.1]
167 method: GET
168 uri: http://localhost:3000/api/v1/lists/23/accounts
169 response:
170 body: {string: '[]'}
171 headers:
172 Cache-Control: ['max-age=0, private, must-revalidate']
173 Content-Type: [application/json; charset=utf-8]
174 ETag: [W/"7762a54b770895c411eb3e681494e743"]
175 Transfer-Encoding: [chunked]
176 Vary: ['Accept-Encoding, Origin']
177 X-Content-Type-Options: [nosniff]
178 X-Frame-Options: [SAMEORIGIN]
179 X-Request-Id: [500b6154-3bdb-4cbb-bb99-e87072552943]
180 X-Runtime: ['0.057220']
181 X-XSS-Protection: [1; mode=block]
182 content-length: ['2']
183 status: {code: 200, message: OK}
184- request:
185 body: null
186 headers:
187 Accept: ['*/*']
188 Accept-Encoding: ['gzip, deflate']
189 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
190 Connection: [keep-alive]
191 Content-Length: ['0']
192 User-Agent: [python-requests/2.9.1]
193 method: POST
194 uri: http://localhost:3000/api/v1/accounts/1/follow
195 response:
196 body: {string: '{"id":"1","following":true,"showing_reblogs":false,"followed_by":false,"blocking":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false}'}
197 headers:
198 Cache-Control: ['max-age=0, private, must-revalidate']
199 Content-Type: [application/json; charset=utf-8]
200 ETag: [W/"98c147556f83bd7b26490f2eac449592"]
201 Transfer-Encoding: [chunked]
202 Vary: ['Accept-Encoding, Origin']
203 X-Content-Type-Options: [nosniff]
204 X-Frame-Options: [SAMEORIGIN]
205 X-Request-Id: [1f5d47f3-591f-4e91-bd77-0942c45caedb]
206 X-Runtime: ['0.081679']
207 X-XSS-Protection: [1; mode=block]
208 content-length: ['174']
209 status: {code: 200, message: OK}
210- request:
211 body: account_ids%5B%5D=1
212 headers:
213 Accept: ['*/*']
214 Accept-Encoding: ['gzip, deflate']
215 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
216 Connection: [keep-alive]
217 Content-Length: ['19']
218 Content-Type: [application/x-www-form-urlencoded]
219 User-Agent: [python-requests/2.9.1]
220 method: POST
221 uri: http://localhost:3000/api/v1/lists/23/accounts
222 response:
223 body: {string: '{}'}
224 headers:
225 Cache-Control: ['max-age=0, private, must-revalidate']
226 Content-Type: [application/json; charset=utf-8]
227 ETag: [W/"ee6751ce2dc32e165dd24aca071f6eed"]
228 Transfer-Encoding: [chunked]
229 Vary: ['Accept-Encoding, Origin']
230 X-Content-Type-Options: [nosniff]
231 X-Frame-Options: [SAMEORIGIN]
232 X-Request-Id: [0f8bc3a7-c8fe-444b-b994-485c98cbda0a]
233 X-Runtime: ['0.064982']
234 X-XSS-Protection: [1; mode=block]
235 content-length: ['2']
236 status: {code: 200, message: OK}
237- request:
238 body: null
239 headers:
240 Accept: ['*/*']
241 Accept-Encoding: ['gzip, deflate']
242 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
243 Connection: [keep-alive]
244 User-Agent: [python-requests/2.9.1]
245 method: GET
246 uri: http://localhost:3000/api/v1/lists/23/accounts
247 response:
248 body: {string: '[{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"created_at":"2018-04-17T21:40:55.626Z","note":"\u003cp\u003e\u003c/p\u003e","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":51}]'}
249 headers:
250 Cache-Control: ['max-age=0, private, must-revalidate']
251 Content-Type: [application/json; charset=utf-8]
252 ETag: [W/"b9836e2f0226339c225639e9cc22ede9"]
253 Link: ['<http://localhost:3000/api/v1/lists/23/accounts?since_id=1>; rel="prev"']
254 Transfer-Encoding: [chunked]
255 Vary: ['Accept-Encoding, Origin']
256 X-Content-Type-Options: [nosniff]
257 X-Frame-Options: [SAMEORIGIN]
258 X-Request-Id: [794c2f5c-3edd-4b24-b8e3-bf9b26c021df]
259 X-Runtime: ['0.048936']
260 X-XSS-Protection: [1; mode=block]
261 content-length: ['515']
262 status: {code: 200, message: OK}
263- request:
264 body: account_ids%5B%5D=1
265 headers:
266 Accept: ['*/*']
267 Accept-Encoding: ['gzip, deflate']
268 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
269 Connection: [keep-alive]
270 Content-Length: ['19']
271 Content-Type: [application/x-www-form-urlencoded]
272 User-Agent: [python-requests/2.9.1]
273 method: DELETE
274 uri: http://localhost:3000/api/v1/lists/23/accounts
275 response:
276 body: {string: '{}'}
277 headers:
278 Cache-Control: ['max-age=0, private, must-revalidate']
279 Content-Type: [application/json; charset=utf-8]
280 ETag: [W/"7d75201dffe84268b8e3844d4dc96e56"]
281 Transfer-Encoding: [chunked]
282 Vary: ['Accept-Encoding, Origin']
283 X-Content-Type-Options: [nosniff]
284 X-Frame-Options: [SAMEORIGIN]
285 X-Request-Id: [5b9c340c-9df5-4875-a754-9bd36a6398d2]
286 X-Runtime: ['0.054353']
287 X-XSS-Protection: [1; mode=block]
288 content-length: ['2']
289 status: {code: 200, message: OK}
290- request:
291 body: null
292 headers:
293 Accept: ['*/*']
294 Accept-Encoding: ['gzip, deflate']
295 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
296 Connection: [keep-alive]
297 User-Agent: [python-requests/2.9.1]
298 method: GET
299 uri: http://localhost:3000/api/v1/lists/23/accounts
300 response:
301 body: {string: '[]'}
302 headers:
303 Cache-Control: ['max-age=0, private, must-revalidate']
304 Content-Type: [application/json; charset=utf-8]
305 ETag: [W/"d136973c02e6e12b3280a000929bdfab"]
306 Transfer-Encoding: [chunked]
307 Vary: ['Accept-Encoding, Origin']
308 X-Content-Type-Options: [nosniff]
309 X-Frame-Options: [SAMEORIGIN]
310 X-Request-Id: [6cc121cd-cc66-4795-b9cd-8272b89166ff]
311 X-Runtime: ['0.050224']
312 X-XSS-Protection: [1; mode=block]
313 content-length: ['2']
314 status: {code: 200, message: OK}
315- request:
316 body: null
317 headers:
318 Accept: ['*/*']
319 Accept-Encoding: ['gzip, deflate']
320 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
321 Connection: [keep-alive]
322 Content-Length: ['0']
323 User-Agent: [python-requests/2.9.1]
324 method: POST
325 uri: http://localhost:3000/api/v1/accounts/1/unfollow
326 response:
327 body: {string: '{"id":"1","following":false,"showing_reblogs":false,"followed_by":false,"blocking":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false}'}
328 headers:
329 Cache-Control: ['max-age=0, private, must-revalidate']
330 Content-Type: [application/json; charset=utf-8]
331 ETag: [W/"b2c35ec6363918f9324f60b9ce18ad00"]
332 Transfer-Encoding: [chunked]
333 Vary: ['Accept-Encoding, Origin']
334 X-Content-Type-Options: [nosniff]
335 X-Frame-Options: [SAMEORIGIN]
336 X-Request-Id: [32c56b5c-a75f-45a3-a7fc-cf048dca9ce2]
337 X-Runtime: ['0.053228']
338 X-XSS-Protection: [1; mode=block]
339 content-length: ['175']
340 status: {code: 200, message: OK}
341- request:
342 body: null
343 headers:
344 Accept: ['*/*']
345 Accept-Encoding: ['gzip, deflate']
346 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
347 Connection: [keep-alive]
348 Content-Length: ['0']
349 User-Agent: [python-requests/2.9.1]
350 method: DELETE
351 uri: http://localhost:3000/api/v1/lists/23
352 response:
353 body: {string: '{}'}
354 headers:
355 Cache-Control: ['max-age=0, private, must-revalidate']
356 Content-Type: [application/json; charset=utf-8]
357 ETag: [W/"7d75201dffe84268b8e3844d4dc96e56"]
358 Transfer-Encoding: [chunked]
359 Vary: ['Accept-Encoding, Origin']
360 X-Content-Type-Options: [nosniff]
361 X-Frame-Options: [SAMEORIGIN]
362 X-Request-Id: [6f82b353-ca11-4c04-bd5c-36c02e050462]
363 X-Runtime: ['0.032468']
364 X-XSS-Protection: [1; mode=block]
365 content-length: ['2']
366 status: {code: 200, message: OK}
367version: 1
diff --git a/tests/cassettes/test_list_by_account.yaml b/tests/cassettes/test_list_by_account.yaml
new file mode 100644
index 0000000..d07bfb7
--- /dev/null
+++ b/tests/cassettes/test_list_by_account.yaml
@@ -0,0 +1,184 @@
1interactions:
2- request:
3 body: title=ham+burglars
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
8 Connection: [keep-alive]
9 Content-Length: ['18']
10 Content-Type: [application/x-www-form-urlencoded]
11 User-Agent: [python-requests/2.9.1]
12 method: POST
13 uri: http://localhost:3000/api/v1/lists
14 response:
15 body: {string: '{"id":"24","title":"ham burglars"}'}
16 headers:
17 Cache-Control: ['max-age=0, private, must-revalidate']
18 Content-Type: [application/json; charset=utf-8]
19 ETag: [W/"be955eaf8be280515d5ba0ba9ecb1a50"]
20 Transfer-Encoding: [chunked]
21 Vary: ['Accept-Encoding, Origin']
22 X-Content-Type-Options: [nosniff]
23 X-Frame-Options: [SAMEORIGIN]
24 X-Request-Id: [672adb20-033a-4630-82f4-4646ce737155]
25 X-Runtime: ['0.055324']
26 X-XSS-Protection: [1; mode=block]
27 content-length: ['34']
28 status: {code: 200, message: OK}
29- request:
30 body: null
31 headers:
32 Accept: ['*/*']
33 Accept-Encoding: ['gzip, deflate']
34 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2]
35 Connection: [keep-alive]
36 User-Agent: [python-requests/2.9.1]
37 method: GET
38 uri: http://localhost:3000/api/v1/accounts/verify_credentials
39 response:
40 body: {string: '{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"created_at":"2018-04-17T21:40:55.626Z","note":"\u003cp\u003e\u003c/p\u003e","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":51,"source":{"privacy":"public","sensitive":false,"note":""}}'}
41 headers:
42 Cache-Control: ['max-age=0, private, must-revalidate']
43 Content-Type: [application/json; charset=utf-8]
44 ETag: [W/"691f6bd96e64ff4fe001604d8861d949"]
45 Transfer-Encoding: [chunked]
46 Vary: ['Accept-Encoding, Origin']
47 X-Content-Type-Options: [nosniff]
48 X-Frame-Options: [SAMEORIGIN]
49 X-Request-Id: [d9788143-6fa1-4353-ab46-a4a157265615]
50 X-Runtime: ['0.059023']
51 X-XSS-Protection: [1; mode=block]
52 content-length: ['571']
53 status: {code: 200, message: OK}
54- request:
55 body: null
56 headers:
57 Accept: ['*/*']
58 Accept-Encoding: ['gzip, deflate']
59 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
60 Connection: [keep-alive]
61 Content-Length: ['0']
62 User-Agent: [python-requests/2.9.1]
63 method: POST
64 uri: http://localhost:3000/api/v1/accounts/1/follow
65 response:
66 body: {string: '{"id":"1","following":true,"showing_reblogs":false,"followed_by":false,"blocking":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false}'}
67 headers:
68 Cache-Control: ['max-age=0, private, must-revalidate']
69 Content-Type: [application/json; charset=utf-8]
70 ETag: [W/"f91b05337597468badfd19f87dd3fe7d"]
71 Transfer-Encoding: [chunked]
72 Vary: ['Accept-Encoding, Origin']
73 X-Content-Type-Options: [nosniff]
74 X-Frame-Options: [SAMEORIGIN]
75 X-Request-Id: [3d70f64d-6d49-403e-b666-a266faa93132]
76 X-Runtime: ['0.107833']
77 X-XSS-Protection: [1; mode=block]
78 content-length: ['174']
79 status: {code: 200, message: OK}
80- request:
81 body: account_ids%5B%5D=1
82 headers:
83 Accept: ['*/*']
84 Accept-Encoding: ['gzip, deflate']
85 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
86 Connection: [keep-alive]
87 Content-Length: ['19']
88 Content-Type: [application/x-www-form-urlencoded]
89 User-Agent: [python-requests/2.9.1]
90 method: POST
91 uri: http://localhost:3000/api/v1/lists/24/accounts
92 response:
93 body: {string: '{}'}
94 headers:
95 Cache-Control: ['max-age=0, private, must-revalidate']
96 Content-Type: [application/json; charset=utf-8]
97 ETag: [W/"7d75201dffe84268b8e3844d4dc96e56"]
98 Transfer-Encoding: [chunked]
99 Vary: ['Accept-Encoding, Origin']
100 X-Content-Type-Options: [nosniff]
101 X-Frame-Options: [SAMEORIGIN]
102 X-Request-Id: [75a29c9f-5126-4cb7-b446-b8cbc7800408]
103 X-Runtime: ['0.069586']
104 X-XSS-Protection: [1; mode=block]
105 content-length: ['2']
106 status: {code: 200, message: OK}
107- request:
108 body: null
109 headers:
110 Accept: ['*/*']
111 Accept-Encoding: ['gzip, deflate']
112 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
113 Connection: [keep-alive]
114 User-Agent: [python-requests/2.9.1]
115 method: GET
116 uri: http://localhost:3000/api/v1/accounts/1/lists
117 response:
118 body: {string: '[{"id":"24","title":"ham burglars"}]'}
119 headers:
120 Cache-Control: ['max-age=0, private, must-revalidate']
121 Content-Type: [application/json; charset=utf-8]
122 ETag: [W/"47f8168c1f7a8f3d8ff54544f88564d8"]
123 Transfer-Encoding: [chunked]
124 Vary: ['Accept-Encoding, Origin']
125 X-Content-Type-Options: [nosniff]
126 X-Frame-Options: [SAMEORIGIN]
127 X-Request-Id: [afb958a3-8002-4cc1-abbf-907d69032264]
128 X-Runtime: ['0.040643']
129 X-XSS-Protection: [1; mode=block]
130 content-length: ['36']
131 status: {code: 200, message: OK}
132- request:
133 body: null
134 headers:
135 Accept: ['*/*']
136 Accept-Encoding: ['gzip, deflate']
137 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
138 Connection: [keep-alive]
139 Content-Length: ['0']
140 User-Agent: [python-requests/2.9.1]
141 method: POST
142 uri: http://localhost:3000/api/v1/accounts/1/unfollow
143 response:
144 body: {string: '{"id":"1","following":false,"showing_reblogs":false,"followed_by":false,"blocking":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false}'}
145 headers:
146 Cache-Control: ['max-age=0, private, must-revalidate']
147 Content-Type: [application/json; charset=utf-8]
148 ETag: [W/"b2c35ec6363918f9324f60b9ce18ad00"]
149 Transfer-Encoding: [chunked]
150 Vary: ['Accept-Encoding, Origin']
151 X-Content-Type-Options: [nosniff]
152 X-Frame-Options: [SAMEORIGIN]
153 X-Request-Id: [0d09fa82-d5b4-440c-b5aa-4f995cbd452a]
154 X-Runtime: ['0.097106']
155 X-XSS-Protection: [1; mode=block]
156 content-length: ['175']
157 status: {code: 200, message: OK}
158- request:
159 body: null
160 headers:
161 Accept: ['*/*']
162 Accept-Encoding: ['gzip, deflate']
163 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
164 Connection: [keep-alive]
165 Content-Length: ['0']
166 User-Agent: [python-requests/2.9.1]
167 method: DELETE
168 uri: http://localhost:3000/api/v1/lists/24
169 response:
170 body: {string: '{}'}
171 headers:
172 Cache-Control: ['max-age=0, private, must-revalidate']
173 Content-Type: [application/json; charset=utf-8]
174 ETag: [W/"7d75201dffe84268b8e3844d4dc96e56"]
175 Transfer-Encoding: [chunked]
176 Vary: ['Accept-Encoding, Origin']
177 X-Content-Type-Options: [nosniff]
178 X-Frame-Options: [SAMEORIGIN]
179 X-Request-Id: [5918aefb-8fa2-465f-b513-5ef9f4036a88]
180 X-Runtime: ['0.063303']
181 X-XSS-Protection: [1; mode=block]
182 content-length: ['2']
183 status: {code: 200, message: OK}
184version: 1
diff --git a/tests/cassettes/test_list_create.yaml b/tests/cassettes/test_list_create.yaml
new file mode 100644
index 0000000..41c9d50
--- /dev/null
+++ b/tests/cassettes/test_list_create.yaml
@@ -0,0 +1,80 @@
1interactions:
2- request:
3 body: title=ham+burglars
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
8 Connection: [keep-alive]
9 Content-Length: ['18']
10 Content-Type: [application/x-www-form-urlencoded]
11 User-Agent: [python-requests/2.9.1]
12 method: POST
13 uri: http://localhost:3000/api/v1/lists
14 response:
15 body: {string: '{"id":"21","title":"ham burglars"}'}
16 headers:
17 Cache-Control: ['max-age=0, private, must-revalidate']
18 Content-Type: [application/json; charset=utf-8]
19 ETag: [W/"7a697af6c938508b5253601ebd4dd6e6"]
20 Transfer-Encoding: [chunked]
21 Vary: ['Accept-Encoding, Origin']
22 X-Content-Type-Options: [nosniff]
23 X-Frame-Options: [SAMEORIGIN]
24 X-Request-Id: [ace7486c-8c0b-46ef-8dc2-69719035824f]
25 X-Runtime: ['0.030442']
26 X-XSS-Protection: [1; mode=block]
27 content-length: ['34']
28 status: {code: 200, message: OK}
29- request:
30 body: null
31 headers:
32 Accept: ['*/*']
33 Accept-Encoding: ['gzip, deflate']
34 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
35 Connection: [keep-alive]
36 User-Agent: [python-requests/2.9.1]
37 method: GET
38 uri: http://localhost:3000/api/v1/lists
39 response:
40 body: {string: '[{"id":"1","title":"ham burglars"},{"id":"21","title":"ham burglars"}]'}
41 headers:
42 Cache-Control: ['max-age=0, private, must-revalidate']
43 Content-Type: [application/json; charset=utf-8]
44 ETag: [W/"158cecd920100143aaaaca0e264e3eff"]
45 Transfer-Encoding: [chunked]
46 Vary: ['Accept-Encoding, Origin']
47 X-Content-Type-Options: [nosniff]
48 X-Frame-Options: [SAMEORIGIN]
49 X-Request-Id: [cb76cdf7-a8a4-47ab-b22d-8d605bfcb2e5]
50 X-Runtime: ['0.019989']
51 X-XSS-Protection: [1; mode=block]
52 content-length: ['70']
53 status: {code: 200, message: OK}
54- request:
55 body: null
56 headers:
57 Accept: ['*/*']
58 Accept-Encoding: ['gzip, deflate']
59 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
60 Connection: [keep-alive]
61 Content-Length: ['0']
62 User-Agent: [python-requests/2.9.1]
63 method: DELETE
64 uri: http://localhost:3000/api/v1/lists/21
65 response:
66 body: {string: '{}'}
67 headers:
68 Cache-Control: ['max-age=0, private, must-revalidate']
69 Content-Type: [application/json; charset=utf-8]
70 ETag: [W/"517599317c4db2fd6c980b4f38eaa967"]
71 Transfer-Encoding: [chunked]
72 Vary: ['Accept-Encoding, Origin']
73 X-Content-Type-Options: [nosniff]
74 X-Frame-Options: [SAMEORIGIN]
75 X-Request-Id: [82ba57ca-5026-403f-a024-8b33c87504a2]
76 X-Runtime: ['0.025599']
77 X-XSS-Protection: [1; mode=block]
78 content-length: ['2']
79 status: {code: 200, message: OK}
80version: 1
diff --git a/tests/cassettes/test_list_timeline.yaml b/tests/cassettes/test_list_timeline.yaml
new file mode 100644
index 0000000..ceb2089
--- /dev/null
+++ b/tests/cassettes/test_list_timeline.yaml
@@ -0,0 +1,244 @@
1interactions:
2- request:
3 body: title=ham+burglars
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
8 Connection: [keep-alive]
9 Content-Length: ['18']
10 Content-Type: [application/x-www-form-urlencoded]
11 User-Agent: [python-requests/2.9.1]
12 method: POST
13 uri: http://localhost:3000/api/v1/lists
14 response:
15 body: {string: '{"id":"25","title":"ham burglars"}'}
16 headers:
17 Cache-Control: ['max-age=0, private, must-revalidate']
18 Content-Type: [application/json; charset=utf-8]
19 ETag: [W/"c56ed009e747b046f62c422a4bd0c475"]
20 Transfer-Encoding: [chunked]
21 Vary: ['Accept-Encoding, Origin']
22 X-Content-Type-Options: [nosniff]
23 X-Frame-Options: [SAMEORIGIN]
24 X-Request-Id: [fee67ca2-a91f-4d5e-870d-f94f63fdae01]
25 X-Runtime: ['0.046275']
26 X-XSS-Protection: [1; mode=block]
27 content-length: ['34']
28 status: {code: 200, message: OK}
29- request:
30 body: null
31 headers:
32 Accept: ['*/*']
33 Accept-Encoding: ['gzip, deflate']
34 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2]
35 Connection: [keep-alive]
36 User-Agent: [python-requests/2.9.1]
37 method: GET
38 uri: http://localhost:3000/api/v1/accounts/verify_credentials
39 response:
40 body: {string: '{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"created_at":"2018-04-17T21:40:55.626Z","note":"\u003cp\u003e\u003c/p\u003e","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":51,"source":{"privacy":"public","sensitive":false,"note":""}}'}
41 headers:
42 Cache-Control: ['max-age=0, private, must-revalidate']
43 Content-Type: [application/json; charset=utf-8]
44 ETag: [W/"6f31f5da2f0f9aeec5ce050c8e439288"]
45 Transfer-Encoding: [chunked]
46 Vary: ['Accept-Encoding, Origin']
47 X-Content-Type-Options: [nosniff]
48 X-Frame-Options: [SAMEORIGIN]
49 X-Request-Id: [c7ba1cc0-3315-4847-a0f8-7ca1c8014f53]
50 X-Runtime: ['0.048756']
51 X-XSS-Protection: [1; mode=block]
52 content-length: ['571']
53 status: {code: 200, message: OK}
54- request:
55 body: null
56 headers:
57 Accept: ['*/*']
58 Accept-Encoding: ['gzip, deflate']
59 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
60 Connection: [keep-alive]
61 Content-Length: ['0']
62 User-Agent: [python-requests/2.9.1]
63 method: POST
64 uri: http://localhost:3000/api/v1/accounts/1/follow
65 response:
66 body: {string: '{"id":"1","following":true,"showing_reblogs":false,"followed_by":false,"blocking":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false}'}
67 headers:
68 Cache-Control: ['max-age=0, private, must-revalidate']
69 Content-Type: [application/json; charset=utf-8]
70 ETag: [W/"ff571039e7eccffedf0c3baf0ee5835d"]
71 Transfer-Encoding: [chunked]
72 Vary: ['Accept-Encoding, Origin']
73 X-Content-Type-Options: [nosniff]
74 X-Frame-Options: [SAMEORIGIN]
75 X-Request-Id: [aecd782a-5218-489a-a801-52be98fab5bb]
76 X-Runtime: ['0.137542']
77 X-XSS-Protection: [1; mode=block]
78 content-length: ['174']
79 status: {code: 200, message: OK}
80- request:
81 body: account_ids%5B%5D=1
82 headers:
83 Accept: ['*/*']
84 Accept-Encoding: ['gzip, deflate']
85 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
86 Connection: [keep-alive]
87 Content-Length: ['19']
88 Content-Type: [application/x-www-form-urlencoded]
89 User-Agent: [python-requests/2.9.1]
90 method: POST
91 uri: http://localhost:3000/api/v1/lists/25/accounts
92 response:
93 body: {string: '{}'}
94 headers:
95 Cache-Control: ['max-age=0, private, must-revalidate']
96 Content-Type: [application/json; charset=utf-8]
97 ETag: [W/"1040bdd26362a18b29d5084d0ea80fbc"]
98 Transfer-Encoding: [chunked]
99 Vary: ['Accept-Encoding, Origin']
100 X-Content-Type-Options: [nosniff]
101 X-Frame-Options: [SAMEORIGIN]
102 X-Request-Id: [327011fb-439c-4d25-b568-5f3b2c3f7d54]
103 X-Runtime: ['0.073036']
104 X-XSS-Protection: [1; mode=block]
105 content-length: ['2']
106 status: {code: 200, message: OK}
107- request:
108 body: visibility=public&status=I+have+never+stolen+a+ham+in+my+life.
109 headers:
110 Accept: ['*/*']
111 Accept-Encoding: ['gzip, deflate']
112 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2]
113 Connection: [keep-alive]
114 Content-Length: ['62']
115 Content-Type: [application/x-www-form-urlencoded]
116 User-Agent: [python-requests/2.9.1]
117 method: POST
118 uri: http://localhost:3000/api/v1/statuses
119 response:
120 body: {string: '{"id":"99982642668365711","created_at":"2018-05-06T13:40:54.415Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/99982642668365711","content":"\u003cp\u003eI
121 have never stolen a ham in my life.\u003c/p\u003e","url":"http://localhost:3000/@admin/99982642668365711","reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":false,"reblog":null,"application":{"name":"Mastodon.py
122 test suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"created_at":"2018-04-17T21:40:55.626Z","note":"\u003cp\u003e\u003c/p\u003e","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":52},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'}
123 headers:
124 Cache-Control: ['max-age=0, private, must-revalidate']
125 Content-Type: [application/json; charset=utf-8]
126 ETag: [W/"088ca43a6864bf53d809c7cc6be28fbb"]
127 Transfer-Encoding: [chunked]
128 Vary: ['Accept-Encoding, Origin']
129 X-Content-Type-Options: [nosniff]
130 X-Frame-Options: [SAMEORIGIN]
131 X-Request-Id: [960b252d-e19e-4c3c-ab13-6ca5e82038e1]
132 X-Runtime: ['0.239041']
133 X-XSS-Protection: [1; mode=block]
134 content-length: ['1158']
135 status: {code: 200, message: OK}
136- request:
137 body: null
138 headers:
139 Accept: ['*/*']
140 Accept-Encoding: ['gzip, deflate']
141 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
142 Connection: [keep-alive]
143 User-Agent: [python-requests/2.9.1]
144 method: GET
145 uri: http://localhost:3000/api/v1/timelines/list/25
146 response:
147 body: {string: '[{"id":"99982642668365711","created_at":"2018-05-06T13:40:54.415Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"en","uri":"http://localhost:3000/users/admin/statuses/99982642668365711","content":"\u003cp\u003eI
148 have never stolen a ham in my life.\u003c/p\u003e","url":"http://localhost:3000/@admin/99982642668365711","reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"reblog":null,"application":{"name":"Mastodon.py
149 test suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"","locked":false,"created_at":"2018-04-17T21:40:55.626Z","note":"\u003cp\u003e\u003c/p\u003e","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":52},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}]'}
150 headers:
151 Cache-Control: ['max-age=0, private, must-revalidate']
152 Content-Type: [application/json; charset=utf-8]
153 ETag: [W/"db76a989e40e671ea4344ecdaacebe3d"]
154 Link: ['<http://localhost:3000/api/v1/timelines/list/25?max_id=99982642668365711>;
155 rel="next", <http://localhost:3000/api/v1/timelines/list/25?since_id=99982642668365711>;
156 rel="prev"']
157 Transfer-Encoding: [chunked]
158 Vary: ['Accept-Encoding, Origin']
159 X-Content-Type-Options: [nosniff]
160 X-Frame-Options: [SAMEORIGIN]
161 X-Request-Id: [5bd50e1b-667c-4f56-b363-d576b1a7aab2]
162 X-Runtime: ['0.133037']
163 X-XSS-Protection: [1; mode=block]
164 content-length: ['1145']
165 status: {code: 200, message: OK}
166- request:
167 body: null
168 headers:
169 Accept: ['*/*']
170 Accept-Encoding: ['gzip, deflate']
171 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN_2]
172 Connection: [keep-alive]
173 Content-Length: ['0']
174 User-Agent: [python-requests/2.9.1]
175 method: DELETE
176 uri: http://localhost:3000/api/v1/statuses/99982642668365711
177 response:
178 body: {string: '{}'}
179 headers:
180 Cache-Control: ['max-age=0, private, must-revalidate']
181 Content-Type: [application/json; charset=utf-8]
182 ETag: [W/"1040bdd26362a18b29d5084d0ea80fbc"]
183 Transfer-Encoding: [chunked]
184 Vary: ['Accept-Encoding, Origin']
185 X-Content-Type-Options: [nosniff]
186 X-Frame-Options: [SAMEORIGIN]
187 X-Request-Id: [0aadaf37-9c0a-45e6-ae00-47e47775257f]
188 X-Runtime: ['0.059188']
189 X-XSS-Protection: [1; mode=block]
190 content-length: ['2']
191 status: {code: 200, message: OK}
192- request:
193 body: null
194 headers:
195 Accept: ['*/*']
196 Accept-Encoding: ['gzip, deflate']
197 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
198 Connection: [keep-alive]
199 Content-Length: ['0']
200 User-Agent: [python-requests/2.9.1]
201 method: POST
202 uri: http://localhost:3000/api/v1/accounts/1/unfollow
203 response:
204 body: {string: '{"id":"1","following":false,"showing_reblogs":false,"followed_by":false,"blocking":false,"muting":false,"muting_notifications":false,"requested":false,"domain_blocking":false}'}
205 headers:
206 Cache-Control: ['max-age=0, private, must-revalidate']
207 Content-Type: [application/json; charset=utf-8]
208 ETag: [W/"a1b7df866f4cd9bb23dfdc00a0f40042"]
209 Transfer-Encoding: [chunked]
210 Vary: ['Accept-Encoding, Origin']
211 X-Content-Type-Options: [nosniff]
212 X-Frame-Options: [SAMEORIGIN]
213 X-Request-Id: [eb36fc4f-98cb-430f-ad5c-1efb8e41641b]
214 X-Runtime: ['0.124516']
215 X-XSS-Protection: [1; mode=block]
216 content-length: ['175']
217 status: {code: 200, message: OK}
218- request:
219 body: null
220 headers:
221 Accept: ['*/*']
222 Accept-Encoding: ['gzip, deflate']
223 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
224 Connection: [keep-alive]
225 Content-Length: ['0']
226 User-Agent: [python-requests/2.9.1]
227 method: DELETE
228 uri: http://localhost:3000/api/v1/lists/25
229 response:
230 body: {string: '{}'}
231 headers:
232 Cache-Control: ['max-age=0, private, must-revalidate']
233 Content-Type: [application/json; charset=utf-8]
234 ETag: [W/"fb2e8895e367561e01e27ebb11075fd3"]
235 Transfer-Encoding: [chunked]
236 Vary: ['Accept-Encoding, Origin']
237 X-Content-Type-Options: [nosniff]
238 X-Frame-Options: [SAMEORIGIN]
239 X-Request-Id: [24816eab-335e-4282-92f9-e202b71824f7]
240 X-Runtime: ['0.041613']
241 X-XSS-Protection: [1; mode=block]
242 content-length: ['2']
243 status: {code: 200, message: OK}
244version: 1
diff --git a/tests/cassettes/test_list_update.yaml b/tests/cassettes/test_list_update.yaml
new file mode 100644
index 0000000..e2c64d6
--- /dev/null
+++ b/tests/cassettes/test_list_update.yaml
@@ -0,0 +1,157 @@
1interactions:
2- request:
3 body: title=ham+burglars
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
8 Connection: [keep-alive]
9 Content-Length: ['18']
10 Content-Type: [application/x-www-form-urlencoded]
11 User-Agent: [python-requests/2.9.1]
12 method: POST
13 uri: http://localhost:3000/api/v1/lists
14 response:
15 body: {string: '{"id":"22","title":"ham burglars"}'}
16 headers:
17 Cache-Control: ['max-age=0, private, must-revalidate']
18 Content-Type: [application/json; charset=utf-8]
19 ETag: [W/"0c98211766a89984581c09197affd90c"]
20 Transfer-Encoding: [chunked]
21 Vary: ['Accept-Encoding, Origin']
22 X-Content-Type-Options: [nosniff]
23 X-Frame-Options: [SAMEORIGIN]
24 X-Request-Id: [fe851633-a39e-4bbd-8ecd-665d08ad9d69]
25 X-Runtime: ['0.046417']
26 X-XSS-Protection: [1; mode=block]
27 content-length: ['34']
28 status: {code: 200, message: OK}
29- request:
30 body: title=fry+kids
31 headers:
32 Accept: ['*/*']
33 Accept-Encoding: ['gzip, deflate']
34 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
35 Connection: [keep-alive]
36 Content-Length: ['14']
37 Content-Type: [application/x-www-form-urlencoded]
38 User-Agent: [python-requests/2.9.1]
39 method: PUT
40 uri: http://localhost:3000/api/v1/lists/22
41 response:
42 body: {string: '{"id":"22","title":"fry kids"}'}
43 headers:
44 Cache-Control: ['max-age=0, private, must-revalidate']
45 Content-Type: [application/json; charset=utf-8]
46 ETag: [W/"6dd7ff39115629170e5815c546666ab8"]
47 Transfer-Encoding: [chunked]
48 Vary: ['Accept-Encoding, Origin']
49 X-Content-Type-Options: [nosniff]
50 X-Frame-Options: [SAMEORIGIN]
51 X-Request-Id: [157f5470-3782-40e4-80ac-ea94f8e3f575]
52 X-Runtime: ['0.051260']
53 X-XSS-Protection: [1; mode=block]
54 content-length: ['30']
55 status: {code: 200, message: OK}
56- request:
57 body: null
58 headers:
59 Accept: ['*/*']
60 Accept-Encoding: ['gzip, deflate']
61 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
62 Connection: [keep-alive]
63 User-Agent: [python-requests/2.9.1]
64 method: GET
65 uri: http://localhost:3000/api/v1/lists
66 response:
67 body: {string: '[{"id":"1","title":"ham burglars"},{"id":"22","title":"fry kids"}]'}
68 headers:
69 Cache-Control: ['max-age=0, private, must-revalidate']
70 Content-Type: [application/json; charset=utf-8]
71 ETag: [W/"3a312ac5c7092d9a90693c236852fdc9"]
72 Transfer-Encoding: [chunked]
73 Vary: ['Accept-Encoding, Origin']
74 X-Content-Type-Options: [nosniff]
75 X-Frame-Options: [SAMEORIGIN]
76 X-Request-Id: [22dae45a-b92a-4ff0-b1a0-50ff690f429a]
77 X-Runtime: ['0.045067']
78 X-XSS-Protection: [1; mode=block]
79 content-length: ['66']
80 status: {code: 200, message: OK}
81- request:
82 body: null
83 headers:
84 Accept: ['*/*']
85 Accept-Encoding: ['gzip, deflate']
86 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
87 Connection: [keep-alive]
88 User-Agent: [python-requests/2.9.1]
89 method: GET
90 uri: http://localhost:3000/api/v1/lists
91 response:
92 body: {string: '[{"id":"1","title":"ham burglars"},{"id":"22","title":"fry kids"}]'}
93 headers:
94 Cache-Control: ['max-age=0, private, must-revalidate']
95 Content-Type: [application/json; charset=utf-8]
96 ETag: [W/"3a312ac5c7092d9a90693c236852fdc9"]
97 Transfer-Encoding: [chunked]
98 Vary: ['Accept-Encoding, Origin']
99 X-Content-Type-Options: [nosniff]
100 X-Frame-Options: [SAMEORIGIN]
101 X-Request-Id: [c4381d47-2ef7-40f8-ae75-ce8996886177]
102 X-Runtime: ['0.036421']
103 X-XSS-Protection: [1; mode=block]
104 content-length: ['66']
105 status: {code: 200, message: OK}
106- request:
107 body: null
108 headers:
109 Accept: ['*/*']
110 Accept-Encoding: ['gzip, deflate']
111 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
112 Connection: [keep-alive]
113 User-Agent: [python-requests/2.9.1]
114 method: GET
115 uri: http://localhost:3000/api/v1/lists/22
116 response:
117 body: {string: '{"id":"22","title":"fry kids"}'}
118 headers:
119 Cache-Control: ['max-age=0, private, must-revalidate']
120 Content-Type: [application/json; charset=utf-8]
121 ETag: [W/"6dd7ff39115629170e5815c546666ab8"]
122 Transfer-Encoding: [chunked]
123 Vary: ['Accept-Encoding, Origin']
124 X-Content-Type-Options: [nosniff]
125 X-Frame-Options: [SAMEORIGIN]
126 X-Request-Id: [3e821cd3-7c44-4e3a-8cdf-9fa498f0bb68]
127 X-Runtime: ['0.020432']
128 X-XSS-Protection: [1; mode=block]
129 content-length: ['30']
130 status: {code: 200, message: OK}
131- request:
132 body: null
133 headers:
134 Accept: ['*/*']
135 Accept-Encoding: ['gzip, deflate']
136 Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
137 Connection: [keep-alive]
138 Content-Length: ['0']
139 User-Agent: [python-requests/2.9.1]
140 method: DELETE
141 uri: http://localhost:3000/api/v1/lists/22
142 response:
143 body: {string: '{}'}
144 headers:
145 Cache-Control: ['max-age=0, private, must-revalidate']
146 Content-Type: [application/json; charset=utf-8]
147 ETag: [W/"ee6751ce2dc32e165dd24aca071f6eed"]
148 Transfer-Encoding: [chunked]
149 Vary: ['Accept-Encoding, Origin']
150 X-Content-Type-Options: [nosniff]
151 X-Frame-Options: [SAMEORIGIN]
152 X-Request-Id: [a8576f90-288b-4271-af8a-9bcabf3e2df9]
153 X-Runtime: ['0.032007']
154 X-XSS-Protection: [1; mode=block]
155 content-length: ['2']
156 status: {code: 200, message: OK}
157version: 1
diff --git a/tests/test_lists.py b/tests/test_lists.py
new file mode 100644
index 0000000..61300c8
--- /dev/null
+++ b/tests/test_lists.py
@@ -0,0 +1,61 @@
1import pytest
2
3@pytest.fixture()
4def mastodon_list(api):
5 mastodon_list = api.list_create('ham burglars')
6 yield mastodon_list
7 api.list_delete(mastodon_list)
8
9@pytest.mark.vcr()
10def test_list_create(api, mastodon_list):
11 assert mastodon_list in api.lists()
12
13@pytest.mark.vcr()
14def test_list_update(api, mastodon_list):
15 mastodon_list_modified = api.list_update(mastodon_list, 'fry kids')
16 assert not mastodon_list in api.lists()
17 assert mastodon_list_modified in api.lists()
18 assert api.list(mastodon_list) == mastodon_list_modified
19
20@pytest.mark.vcr()
21def test_list_add_remove_account(api, api2, mastodon_list):
22 user = api2.account_verify_credentials()
23
24 api.account_follow(user)
25 api.list_accounts_add(mastodon_list, user)
26 assert user.id in map(lambda x: x.id, api.list_accounts(mastodon_list))
27
28 api.account_unfollow(user)
29 assert len(api.list_accounts(mastodon_list)) == 0
30
31 api.account_follow(user)
32 api.list_accounts_add(mastodon_list, user)
33 assert user.id in map(lambda x: x.id, api.list_accounts(mastodon_list))
34
35 api.list_accounts_delete(mastodon_list, user)
36 assert len(api.list_accounts(mastodon_list)) == 0
37
38 api.account_unfollow(user)
39
40@pytest.mark.vcr()
41def test_list_by_account(api, api2, mastodon_list):
42 user = api2.account_verify_credentials()
43
44 api.account_follow(user)
45 api.list_accounts_add(mastodon_list, user)
46 assert mastodon_list in api.account_lists(user)
47 api.account_unfollow(user)
48
49@pytest.mark.vcr()
50def test_list_timeline(api, api2, mastodon_list):
51 user = api2.account_verify_credentials()
52
53 api.account_follow(user)
54 api.list_accounts_add(mastodon_list, user)
55
56 status = api2.status_post("I have never stolen a ham in my life.", visibility="public")
57 assert status.id in map(lambda x: x.id, api.timeline_list(mastodon_list))
58
59 api2.status_delete(status)
60 api.account_unfollow(user)
61 \ No newline at end of file
Powered by cgit v1.2.3 (git 2.41.0)