diff options
author | Lorenz Diener <[email protected]> | 2018-06-04 20:55:44 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2018-06-04 20:55:44 +0200 |
commit | 362767f91146271e17f7f10bd976940a1544bd5a (patch) | |
tree | 577dcbdaeb40f34e9036020f8dd916802e0950c5 /tests | |
parent | 0882c91cfc381d30113b50927014a1e83a76733f (diff) | |
download | mastodon.py-362767f91146271e17f7f10bd976940a1544bd5a.tar.gz |
Pinning tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cassettes/test_account_pinned.yaml | 231 | ||||
-rw-r--r-- | tests/cassettes/test_status_pin_unpin.yaml | 116 | ||||
-rw-r--r-- | tests/conftest.py | 6 | ||||
-rw-r--r-- | tests/test_account.py | 10 | ||||
-rw-r--r-- | tests/test_constructor.py | 4 | ||||
-rw-r--r-- | tests/test_instance.py | 2 | ||||
-rw-r--r-- | tests/test_status.py | 8 |
7 files changed, 374 insertions, 3 deletions
diff --git a/tests/cassettes/test_account_pinned.yaml b/tests/cassettes/test_account_pinned.yaml new file mode 100644 index 0000000..a803ef6 --- /dev/null +++ b/tests/cassettes/test_account_pinned.yaml | |||
@@ -0,0 +1,231 @@ | |||
1 | interactions: | ||
2 | - request: | ||
3 | body: status=Toot%21 | ||
4 | headers: | ||
5 | Accept: ['*/*'] | ||
6 | Accept-Encoding: ['gzip, deflate'] | ||
7 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
8 | Connection: [keep-alive] | ||
9 | Content-Length: ['14'] | ||
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/statuses | ||
14 | response: | ||
15 | body: {string: '{"id":"100148083981231904","created_at":"2018-06-04T18:54:48.491Z","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/100148083981231904","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test/100148083981231904","reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":false,"reblog":null,"application":{"name":"Mastodon.py | ||
16 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
17 | Lennon","locked":true,"created_at":"2018-05-07T00:38:05.405Z","note":"\u003cp\u003eI | ||
18 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","avatar_static":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","header":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","header_static":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","followers_count":0,"following_count":0,"statuses_count":5},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'} | ||
19 | headers: | ||
20 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
21 | Content-Type: [application/json; charset=utf-8] | ||
22 | ETag: [W/"27b169f2c3a47c34c96e80742d4d4f53"] | ||
23 | Transfer-Encoding: [chunked] | ||
24 | Vary: ['Accept-Encoding, Origin'] | ||
25 | X-Content-Type-Options: [nosniff] | ||
26 | X-Frame-Options: [SAMEORIGIN] | ||
27 | X-Request-Id: [94dacd68-7f37-4329-a801-3f598e70d14a] | ||
28 | X-Runtime: ['0.210785'] | ||
29 | X-XSS-Protection: [1; mode=block] | ||
30 | content-length: ['1399'] | ||
31 | status: {code: 200, message: OK} | ||
32 | - request: | ||
33 | body: status=Toot%2C+too%21 | ||
34 | headers: | ||
35 | Accept: ['*/*'] | ||
36 | Accept-Encoding: ['gzip, deflate'] | ||
37 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
38 | Connection: [keep-alive] | ||
39 | Content-Length: ['21'] | ||
40 | Content-Type: [application/x-www-form-urlencoded] | ||
41 | User-Agent: [python-requests/2.9.1] | ||
42 | method: POST | ||
43 | uri: http://localhost:3000/api/v1/statuses | ||
44 | response: | ||
45 | body: {string: '{"id":"100148083999835817","created_at":"2018-06-04T18:54:48.795Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"mi","uri":"http://localhost:3000/users/mastodonpy_test/statuses/100148083999835817","content":"\u003cp\u003eToot, | ||
46 | too!\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test/100148083999835817","reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":false,"reblog":null,"application":{"name":"Mastodon.py | ||
47 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
48 | Lennon","locked":true,"created_at":"2018-05-07T00:38:05.405Z","note":"\u003cp\u003eI | ||
49 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","avatar_static":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","header":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","header_static":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","followers_count":0,"following_count":0,"statuses_count":6},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'} | ||
50 | headers: | ||
51 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
52 | Content-Type: [application/json; charset=utf-8] | ||
53 | ETag: [W/"f8eb615a2b076b4d31bb7c96fd907bd7"] | ||
54 | Transfer-Encoding: [chunked] | ||
55 | Vary: ['Accept-Encoding, Origin'] | ||
56 | X-Content-Type-Options: [nosniff] | ||
57 | X-Frame-Options: [SAMEORIGIN] | ||
58 | X-Request-Id: [5d5d8954-754c-4410-a964-75ad0c2ca3f1] | ||
59 | X-Runtime: ['0.296913'] | ||
60 | X-XSS-Protection: [1; mode=block] | ||
61 | content-length: ['1404'] | ||
62 | status: {code: 200, message: OK} | ||
63 | - request: | ||
64 | body: null | ||
65 | headers: | ||
66 | Accept: ['*/*'] | ||
67 | Accept-Encoding: ['gzip, deflate'] | ||
68 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
69 | Connection: [keep-alive] | ||
70 | Content-Length: ['0'] | ||
71 | User-Agent: [python-requests/2.9.1] | ||
72 | method: POST | ||
73 | uri: http://localhost:3000/api/v1/statuses/100148083981231904/pin | ||
74 | response: | ||
75 | body: {string: '{"id":"100148083981231904","created_at":"2018-06-04T18:54:48.491Z","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/100148083981231904","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test/100148083981231904","reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":true,"reblog":null,"application":{"name":"Mastodon.py | ||
76 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
77 | Lennon","locked":true,"created_at":"2018-05-07T00:38:05.405Z","note":"\u003cp\u003eI | ||
78 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","avatar_static":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","header":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","header_static":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","followers_count":0,"following_count":0,"statuses_count":6},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'} | ||
79 | headers: | ||
80 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
81 | Content-Type: [application/json; charset=utf-8] | ||
82 | ETag: [W/"3069d241974170b0fdf5638f101c1d14"] | ||
83 | Transfer-Encoding: [chunked] | ||
84 | Vary: ['Accept-Encoding, Origin'] | ||
85 | X-Content-Type-Options: [nosniff] | ||
86 | X-Frame-Options: [SAMEORIGIN] | ||
87 | X-Request-Id: [91f5a2ce-5896-4879-80c6-a5fc318d8957] | ||
88 | X-Runtime: ['0.128018'] | ||
89 | X-XSS-Protection: [1; mode=block] | ||
90 | content-length: ['1398'] | ||
91 | status: {code: 200, message: OK} | ||
92 | - request: | ||
93 | body: null | ||
94 | headers: | ||
95 | Accept: ['*/*'] | ||
96 | Accept-Encoding: ['gzip, deflate'] | ||
97 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
98 | Connection: [keep-alive] | ||
99 | User-Agent: [python-requests/2.9.1] | ||
100 | method: GET | ||
101 | uri: http://localhost:3000/api/v1/accounts/verify_credentials | ||
102 | response: | ||
103 | body: {string: '{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
104 | Lennon","locked":true,"created_at":"2018-05-07T00:38:05.405Z","note":"\u003cp\u003eI | ||
105 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","avatar_static":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","header":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","header_static":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","followers_count":0,"following_count":0,"statuses_count":6,"source":{"privacy":"public","sensitive":false,"note":"I | ||
106 | walk funny"}}'} | ||
107 | headers: | ||
108 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
109 | Content-Type: [application/json; charset=utf-8] | ||
110 | ETag: [W/"0426e9ed5782090a9f08f3fe041e73e5"] | ||
111 | Transfer-Encoding: [chunked] | ||
112 | Vary: ['Accept-Encoding, Origin'] | ||
113 | X-Content-Type-Options: [nosniff] | ||
114 | X-Frame-Options: [SAMEORIGIN] | ||
115 | X-Request-Id: [19835760-298b-4cda-8b00-321025061f97] | ||
116 | X-Runtime: ['0.028631'] | ||
117 | X-XSS-Protection: [1; mode=block] | ||
118 | content-length: ['833'] | ||
119 | status: {code: 200, message: OK} | ||
120 | - request: | ||
121 | body: null | ||
122 | headers: | ||
123 | Accept: ['*/*'] | ||
124 | Accept-Encoding: ['gzip, deflate'] | ||
125 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
126 | Connection: [keep-alive] | ||
127 | User-Agent: [python-requests/2.9.1] | ||
128 | method: GET | ||
129 | uri: http://localhost:3000/api/v1/accounts/1234567890123456/statuses?pinned=True | ||
130 | response: | ||
131 | body: {string: '[{"id":"100148083981231904","created_at":"2018-06-04T18:54:48.491Z","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/100148083981231904","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test/100148083981231904","reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":true,"reblog":null,"application":{"name":"Mastodon.py | ||
132 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
133 | Lennon","locked":true,"created_at":"2018-05-07T00:38:05.405Z","note":"\u003cp\u003eI | ||
134 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","avatar_static":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","header":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","header_static":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","followers_count":0,"following_count":0,"statuses_count":6},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}]'} | ||
135 | headers: | ||
136 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
137 | Content-Type: [application/json; charset=utf-8] | ||
138 | ETag: [W/"164c9bc09aa3b6f2851768a66047b329"] | ||
139 | Link: ['<http://localhost:3000/api/v1/accounts/1234567890123456/statuses?since_id=100148083981231904>; | ||
140 | rel="prev"'] | ||
141 | Transfer-Encoding: [chunked] | ||
142 | Vary: ['Accept-Encoding, Origin'] | ||
143 | X-Content-Type-Options: [nosniff] | ||
144 | X-Frame-Options: [SAMEORIGIN] | ||
145 | X-Request-Id: [222b6664-b99e-48e0-8f20-5aad2764e032] | ||
146 | X-Runtime: ['0.055145'] | ||
147 | X-XSS-Protection: [1; mode=block] | ||
148 | content-length: ['1400'] | ||
149 | status: {code: 200, message: OK} | ||
150 | - request: | ||
151 | body: null | ||
152 | headers: | ||
153 | Accept: ['*/*'] | ||
154 | Accept-Encoding: ['gzip, deflate'] | ||
155 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
156 | Connection: [keep-alive] | ||
157 | Content-Length: ['0'] | ||
158 | User-Agent: [python-requests/2.9.1] | ||
159 | method: POST | ||
160 | uri: http://localhost:3000/api/v1/statuses/100148083981231904/unpin | ||
161 | response: | ||
162 | body: {string: '{"id":"100148083981231904","created_at":"2018-06-04T18:54:48.491Z","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/100148083981231904","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test/100148083981231904","reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":false,"reblog":null,"application":{"name":"Mastodon.py | ||
163 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
164 | Lennon","locked":true,"created_at":"2018-05-07T00:38:05.405Z","note":"\u003cp\u003eI | ||
165 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","avatar_static":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","header":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","header_static":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","followers_count":0,"following_count":0,"statuses_count":6},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'} | ||
166 | headers: | ||
167 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
168 | Content-Type: [application/json; charset=utf-8] | ||
169 | ETag: [W/"271e3f2fb752c467b8e7670a490f8c89"] | ||
170 | Transfer-Encoding: [chunked] | ||
171 | Vary: ['Accept-Encoding, Origin'] | ||
172 | X-Content-Type-Options: [nosniff] | ||
173 | X-Frame-Options: [SAMEORIGIN] | ||
174 | X-Request-Id: [d8e811f8-f682-4c21-a414-394f31b90886] | ||
175 | X-Runtime: ['0.074775'] | ||
176 | X-XSS-Protection: [1; mode=block] | ||
177 | content-length: ['1399'] | ||
178 | status: {code: 200, message: OK} | ||
179 | - request: | ||
180 | body: null | ||
181 | headers: | ||
182 | Accept: ['*/*'] | ||
183 | Accept-Encoding: ['gzip, deflate'] | ||
184 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
185 | Connection: [keep-alive] | ||
186 | Content-Length: ['0'] | ||
187 | User-Agent: [python-requests/2.9.1] | ||
188 | method: DELETE | ||
189 | uri: http://localhost:3000/api/v1/statuses/100148083999835817 | ||
190 | response: | ||
191 | body: {string: '{}'} | ||
192 | headers: | ||
193 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
194 | Content-Type: [application/json; charset=utf-8] | ||
195 | ETag: [W/"5448afda8ed9c69797f461b0b52bef34"] | ||
196 | Transfer-Encoding: [chunked] | ||
197 | Vary: ['Accept-Encoding, Origin'] | ||
198 | X-Content-Type-Options: [nosniff] | ||
199 | X-Frame-Options: [SAMEORIGIN] | ||
200 | X-Request-Id: [a950980c-ebcf-4b43-8f9d-489068a0b006] | ||
201 | X-Runtime: ['0.034879'] | ||
202 | X-XSS-Protection: [1; mode=block] | ||
203 | content-length: ['2'] | ||
204 | status: {code: 200, message: OK} | ||
205 | - request: | ||
206 | body: null | ||
207 | headers: | ||
208 | Accept: ['*/*'] | ||
209 | Accept-Encoding: ['gzip, deflate'] | ||
210 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
211 | Connection: [keep-alive] | ||
212 | Content-Length: ['0'] | ||
213 | User-Agent: [python-requests/2.9.1] | ||
214 | method: DELETE | ||
215 | uri: http://localhost:3000/api/v1/statuses/100148083981231904 | ||
216 | response: | ||
217 | body: {string: '{}'} | ||
218 | headers: | ||
219 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
220 | Content-Type: [application/json; charset=utf-8] | ||
221 | ETag: [W/"5448afda8ed9c69797f461b0b52bef34"] | ||
222 | Transfer-Encoding: [chunked] | ||
223 | Vary: ['Accept-Encoding, Origin'] | ||
224 | X-Content-Type-Options: [nosniff] | ||
225 | X-Frame-Options: [SAMEORIGIN] | ||
226 | X-Request-Id: [b8a1de16-05df-4caa-8dd9-414d3d0a36d4] | ||
227 | X-Runtime: ['0.094459'] | ||
228 | X-XSS-Protection: [1; mode=block] | ||
229 | content-length: ['2'] | ||
230 | status: {code: 200, message: OK} | ||
231 | version: 1 | ||
diff --git a/tests/cassettes/test_status_pin_unpin.yaml b/tests/cassettes/test_status_pin_unpin.yaml new file mode 100644 index 0000000..116681b --- /dev/null +++ b/tests/cassettes/test_status_pin_unpin.yaml | |||
@@ -0,0 +1,116 @@ | |||
1 | interactions: | ||
2 | - request: | ||
3 | body: status=Toot%21 | ||
4 | headers: | ||
5 | Accept: ['*/*'] | ||
6 | Accept-Encoding: ['gzip, deflate'] | ||
7 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
8 | Connection: [keep-alive] | ||
9 | Content-Length: ['14'] | ||
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/statuses | ||
14 | response: | ||
15 | body: {string: '{"id":"100148044136641620","created_at":"2018-06-04T18:44:40.693Z","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/100148044136641620","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test/100148044136641620","reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":false,"reblog":null,"application":{"name":"Mastodon.py | ||
16 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
17 | Lennon","locked":true,"created_at":"2018-05-07T00:38:05.405Z","note":"\u003cp\u003eI | ||
18 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","avatar_static":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","header":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","header_static":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","followers_count":0,"following_count":0,"statuses_count":5},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'} | ||
19 | headers: | ||
20 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
21 | Content-Type: [application/json; charset=utf-8] | ||
22 | ETag: [W/"de530492b63d03f8014765dfefb58aec"] | ||
23 | Transfer-Encoding: [chunked] | ||
24 | Vary: ['Accept-Encoding, Origin'] | ||
25 | X-Content-Type-Options: [nosniff] | ||
26 | X-Frame-Options: [SAMEORIGIN] | ||
27 | X-Request-Id: [fb394353-7fd5-4df4-9325-cd8b848b1d41] | ||
28 | X-Runtime: ['0.644297'] | ||
29 | X-XSS-Protection: [1; mode=block] | ||
30 | content-length: ['1399'] | ||
31 | status: {code: 200, message: OK} | ||
32 | - request: | ||
33 | body: null | ||
34 | headers: | ||
35 | Accept: ['*/*'] | ||
36 | Accept-Encoding: ['gzip, deflate'] | ||
37 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
38 | Connection: [keep-alive] | ||
39 | Content-Length: ['0'] | ||
40 | User-Agent: [python-requests/2.9.1] | ||
41 | method: POST | ||
42 | uri: http://localhost:3000/api/v1/statuses/100148044136641620/pin | ||
43 | response: | ||
44 | body: {string: '{"id":"100148044136641620","created_at":"2018-06-04T18:44:40.693Z","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/100148044136641620","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test/100148044136641620","reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":true,"reblog":null,"application":{"name":"Mastodon.py | ||
45 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
46 | Lennon","locked":true,"created_at":"2018-05-07T00:38:05.405Z","note":"\u003cp\u003eI | ||
47 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","avatar_static":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","header":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","header_static":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","followers_count":0,"following_count":0,"statuses_count":5},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'} | ||
48 | headers: | ||
49 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
50 | Content-Type: [application/json; charset=utf-8] | ||
51 | ETag: [W/"5fd67eeb141fb09e42623a6165d262d4"] | ||
52 | Transfer-Encoding: [chunked] | ||
53 | Vary: ['Accept-Encoding, Origin'] | ||
54 | X-Content-Type-Options: [nosniff] | ||
55 | X-Frame-Options: [SAMEORIGIN] | ||
56 | X-Request-Id: [b022a70b-3902-4b7a-aa46-6536cda62141] | ||
57 | X-Runtime: ['0.523419'] | ||
58 | X-XSS-Protection: [1; mode=block] | ||
59 | content-length: ['1398'] | ||
60 | status: {code: 200, message: OK} | ||
61 | - request: | ||
62 | body: null | ||
63 | headers: | ||
64 | Accept: ['*/*'] | ||
65 | Accept-Encoding: ['gzip, deflate'] | ||
66 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
67 | Connection: [keep-alive] | ||
68 | Content-Length: ['0'] | ||
69 | User-Agent: [python-requests/2.9.1] | ||
70 | method: POST | ||
71 | uri: http://localhost:3000/api/v1/statuses/100148044136641620/unpin | ||
72 | response: | ||
73 | body: {string: '{"id":"100148044136641620","created_at":"2018-06-04T18:44:40.693Z","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/100148044136641620","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test/100148044136641620","reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":false,"reblog":null,"application":{"name":"Mastodon.py | ||
74 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"John | ||
75 | Lennon","locked":true,"created_at":"2018-05-07T00:38:05.405Z","note":"\u003cp\u003eI | ||
76 | walk funny\u003c/p\u003e","url":"http://localhost:3000/@mastodonpy_test","avatar":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","avatar_static":"http://localhost:3000/system/accounts/avatars/123/456/789/012/345/original/mastodonpyupload_.jpe","header":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","header_static":"http://localhost:3000/system/accounts/headers/123/456/789/012/345/original/mastodonpyupload_.jpe","followers_count":0,"following_count":0,"statuses_count":5},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'} | ||
77 | headers: | ||
78 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
79 | Content-Type: [application/json; charset=utf-8] | ||
80 | ETag: [W/"de530492b63d03f8014765dfefb58aec"] | ||
81 | Transfer-Encoding: [chunked] | ||
82 | Vary: ['Accept-Encoding, Origin'] | ||
83 | X-Content-Type-Options: [nosniff] | ||
84 | X-Frame-Options: [SAMEORIGIN] | ||
85 | X-Request-Id: [e25b5197-5dbc-4081-af76-613189ee5ce2] | ||
86 | X-Runtime: ['0.197095'] | ||
87 | X-XSS-Protection: [1; mode=block] | ||
88 | content-length: ['1399'] | ||
89 | status: {code: 200, message: OK} | ||
90 | - request: | ||
91 | body: null | ||
92 | headers: | ||
93 | Accept: ['*/*'] | ||
94 | Accept-Encoding: ['gzip, deflate'] | ||
95 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
96 | Connection: [keep-alive] | ||
97 | Content-Length: ['0'] | ||
98 | User-Agent: [python-requests/2.9.1] | ||
99 | method: DELETE | ||
100 | uri: http://localhost:3000/api/v1/statuses/100148044136641620 | ||
101 | response: | ||
102 | body: {string: '{}'} | ||
103 | headers: | ||
104 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
105 | Content-Type: [application/json; charset=utf-8] | ||
106 | ETag: [W/"8a3f21770b7f7baf86839a319201f71c"] | ||
107 | Transfer-Encoding: [chunked] | ||
108 | Vary: ['Accept-Encoding, Origin'] | ||
109 | X-Content-Type-Options: [nosniff] | ||
110 | X-Frame-Options: [SAMEORIGIN] | ||
111 | X-Request-Id: [829c8268-0b7f-4495-a9bc-6326c73399b3] | ||
112 | X-Runtime: ['0.134719'] | ||
113 | X-XSS-Protection: [1; mode=block] | ||
114 | content-length: ['2'] | ||
115 | status: {code: 200, message: OK} | ||
116 | version: 1 | ||
diff --git a/tests/conftest.py b/tests/conftest.py index a1dc161..b472eed 100644 --- a/tests/conftest.py +++ b/tests/conftest.py | |||
@@ -23,7 +23,6 @@ def api_low_version(): | |||
23 | def api2(): | 23 | def api2(): |
24 | return _api(access_token='__MASTODON_PY_TEST_ACCESS_TOKEN_2') | 24 | return _api(access_token='__MASTODON_PY_TEST_ACCESS_TOKEN_2') |
25 | 25 | ||
26 | |||
27 | @pytest.fixture | 26 | @pytest.fixture |
28 | def api_anonymous(): | 27 | def api_anonymous(): |
29 | return _api(access_token=None) | 28 | return _api(access_token=None) |
@@ -34,6 +33,11 @@ def status(api): | |||
34 | yield _status | 33 | yield _status |
35 | api.status_delete(_status['id']) | 34 | api.status_delete(_status['id']) |
36 | 35 | ||
36 | @pytest.fixture() | ||
37 | def status2(api): | ||
38 | _status = api.status_post('Toot, too!') | ||
39 | yield _status | ||
40 | api.status_delete(_status['id']) | ||
37 | 41 | ||
38 | @pytest.fixture() | 42 | @pytest.fixture() |
39 | def vcr_config(): | 43 | def vcr_config(): |
diff --git a/tests/test_account.py b/tests/test_account.py index 2716ad1..3befdd5 100644 --- a/tests/test_account.py +++ b/tests/test_account.py | |||
@@ -112,3 +112,13 @@ def test_account_update_credentials_no_avatar(api): | |||
112 | header = image, | 112 | header = image, |
113 | header_mime_type = "image/jpeg") | 113 | header_mime_type = "image/jpeg") |
114 | assert account | 114 | assert account |
115 | |||
116 | @pytest.mark.vcr() | ||
117 | def test_account_pinned(status, status2, api): | ||
118 | try: | ||
119 | status = api.status_pin(status['id']) | ||
120 | pinned = api.account_statuses(api.account_verify_credentials(), pinned = True) | ||
121 | assert status in pinned | ||
122 | assert not status2 in pinned | ||
123 | finally: | ||
124 | api.status_unpin(status['id']) \ No newline at end of file | ||
diff --git a/tests/test_constructor.py b/tests/test_constructor.py index 950845a..1512939 100644 --- a/tests/test_constructor.py +++ b/tests/test_constructor.py | |||
@@ -38,4 +38,6 @@ def test_verify_version(api): | |||
38 | assert api.verify_minimum_version("2.4.3") == False | 38 | assert api.verify_minimum_version("2.4.3") == False |
39 | assert api.verify_minimum_version("3.3.3") == False | 39 | assert api.verify_minimum_version("3.3.3") == False |
40 | assert api.verify_minimum_version("1.0.0") == True | 40 | assert api.verify_minimum_version("1.0.0") == True |
41 | \ No newline at end of file | 41 | |
42 | def test_supported_version(api): | ||
43 | assert Mastodon.get_supported_version() \ No newline at end of file | ||
diff --git a/tests/test_instance.py b/tests/test_instance.py index 199e654..0eebc57 100644 --- a/tests/test_instance.py +++ b/tests/test_instance.py | |||
@@ -31,4 +31,4 @@ def test_low_version(api_low_version): | |||
31 | 31 | ||
32 | @pytest.mark.vcr() | 32 | @pytest.mark.vcr() |
33 | def test_emoji(api): | 33 | def test_emoji(api): |
34 | assert len(api.custom_emojis()) == 0 \ No newline at end of file | 34 | assert len(api.custom_emojis()) == 0 |
diff --git a/tests/test_status.py b/tests/test_status.py index 95390b3..d36c000 100644 --- a/tests/test_status.py +++ b/tests/test_status.py | |||
@@ -104,3 +104,11 @@ def test_status_mute_unmute(status, api): | |||
104 | 104 | ||
105 | status = api.status_unmute(status['id']) | 105 | status = api.status_unmute(status['id']) |
106 | assert not status['muted'] | 106 | assert not status['muted'] |
107 | |||
108 | @pytest.mark.vcr() | ||
109 | def test_status_pin_unpin(status, api): | ||
110 | status = api.status_pin(status['id']) | ||
111 | assert status['pinned'] | ||
112 | |||
113 | status = api.status_unpin(status['id']) | ||
114 | assert not status['pinned'] | ||