diff options
author | Lorenz Diener <[email protected]> | 2019-04-28 21:24:31 +0200 |
---|---|---|
committer | Lorenz Diener <[email protected]> | 2019-04-28 21:24:31 +0200 |
commit | eb0fa327c4b3b520e243d7b888724512a905347a (patch) | |
tree | 871b9777162c2272ca6808ad9ba9794df09c342c /tests | |
parent | c82b0b19196d5d390419d71e2b45f11ec1c74a05 (diff) | |
download | mastodon.py-eb0fa327c4b3b520e243d7b888724512a905347a.tar.gz |
Add reblog visibility
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cassettes/test_status_reblog_visibility.yaml | 96 | ||||
-rw-r--r-- | tests/test_status.py | 5 |
2 files changed, 101 insertions, 0 deletions
diff --git a/tests/cassettes/test_status_reblog_visibility.yaml b/tests/cassettes/test_status_reblog_visibility.yaml new file mode 100644 index 0000000..500a68d --- /dev/null +++ b/tests/cassettes/test_status_reblog_visibility.yaml | |||
@@ -0,0 +1,96 @@ | |||
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.18.4] | ||
12 | method: POST | ||
13 | uri: http://localhost:3000/api/v1/statuses | ||
14 | response: | ||
15 | body: {string: '{"id":"102005434139190710","created_at":"2019-04-28T19:23:22.764Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102005434139190710","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102005434139190710","replies_count":0,"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":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":1,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
17 | headers: | ||
18 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
19 | Content-Type: [application/json; charset=utf-8] | ||
20 | ETag: [W/"5f9216b37a617266e1e57234796c9452"] | ||
21 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
22 | Transfer-Encoding: [chunked] | ||
23 | Vary: ['Accept-Encoding, Origin'] | ||
24 | X-Content-Type-Options: [nosniff] | ||
25 | X-Download-Options: [noopen] | ||
26 | X-Frame-Options: [SAMEORIGIN] | ||
27 | X-Permitted-Cross-Domain-Policies: [none] | ||
28 | X-Request-Id: [9c86d267-e58f-44e5-a529-26b9ff76fc9e] | ||
29 | X-Runtime: ['0.201113'] | ||
30 | X-XSS-Protection: [1; mode=block] | ||
31 | content-length: ['1235'] | ||
32 | status: {code: 200, message: OK} | ||
33 | - request: | ||
34 | body: visibility=unlisted | ||
35 | headers: | ||
36 | Accept: ['*/*'] | ||
37 | Accept-Encoding: ['gzip, deflate'] | ||
38 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
39 | Connection: [keep-alive] | ||
40 | Content-Length: ['19'] | ||
41 | Content-Type: [application/x-www-form-urlencoded] | ||
42 | User-Agent: [python-requests/2.18.4] | ||
43 | method: POST | ||
44 | uri: http://localhost:3000/api/v1/statuses/102005434139190710/reblog | ||
45 | response: | ||
46 | body: {string: '{"id":"102005434155449471","created_at":"2019-04-28T19:23:23.011Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"unlisted","language":null,"uri":"http://localhost/users/mastodonpy_test/statuses/102005434155449471/activity","content":"\u003cp\u003eRT | ||
47 | \u003cspan class=\"h-card\"\u003e\u003ca href=\"http://localhost/@mastodonpy_test\" | ||
48 | class=\"u-url mention\"\u003e@\u003cspan\u003emastodonpy_test\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e | ||
49 | Toot!\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102005434155449471","replies_count":0,"reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":true,"muted":false,"reblog":{"id":"102005434139190710","created_at":"2019-04-28T19:23:22.764Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":"ja","uri":"http://localhost/users/mastodonpy_test/statuses/102005434139190710","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost/@mastodonpy_test/102005434139190710","replies_count":0,"reblogs_count":1,"favourites_count":0,"favourited":false,"reblogged":true,"muted":false,"pinned":false,"reblog":null,"application":{"name":"Mastodon.py | ||
50 | test suite","website":null},"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":2,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null},"application":null,"account":{"id":"1234567890123456","username":"mastodonpy_test","acct":"mastodonpy_test","display_name":"","locked":true,"bot":false,"created_at":"2019-04-27T20:56:20.155Z","note":"\u003cp\u003e\u003c/p\u003e","url":"http://localhost/@mastodonpy_test","avatar":"http://localhost/avatars/original/missing.png","avatar_static":"http://localhost/avatars/original/missing.png","header":"http://localhost/headers/original/missing.png","header_static":"http://localhost/headers/original/missing.png","followers_count":0,"following_count":0,"statuses_count":2,"emojis":[],"fields":[]},"media_attachments":[],"mentions":[],"tags":[],"emojis":[],"card":null,"poll":null}'} | ||
51 | headers: | ||
52 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
53 | Content-Type: [application/json; charset=utf-8] | ||
54 | ETag: [W/"2959f64592e5d171090e7ddea7694697"] | ||
55 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
56 | Transfer-Encoding: [chunked] | ||
57 | Vary: ['Accept-Encoding, Origin'] | ||
58 | X-Content-Type-Options: [nosniff] | ||
59 | X-Download-Options: [noopen] | ||
60 | X-Frame-Options: [SAMEORIGIN] | ||
61 | X-Permitted-Cross-Domain-Policies: [none] | ||
62 | X-Request-Id: [cf8be3bc-b130-41f2-b113-19d60a7b7f2a] | ||
63 | X-Runtime: ['0.306052'] | ||
64 | X-XSS-Protection: [1; mode=block] | ||
65 | content-length: ['2613'] | ||
66 | status: {code: 200, message: OK} | ||
67 | - request: | ||
68 | body: null | ||
69 | headers: | ||
70 | Accept: ['*/*'] | ||
71 | Accept-Encoding: ['gzip, deflate'] | ||
72 | Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN] | ||
73 | Connection: [keep-alive] | ||
74 | Content-Length: ['0'] | ||
75 | User-Agent: [python-requests/2.18.4] | ||
76 | method: DELETE | ||
77 | uri: http://localhost:3000/api/v1/statuses/102005434139190710 | ||
78 | response: | ||
79 | body: {string: '{}'} | ||
80 | headers: | ||
81 | Cache-Control: ['max-age=0, private, must-revalidate'] | ||
82 | Content-Type: [application/json; charset=utf-8] | ||
83 | ETag: [W/"7f009dc9f14d1cd3a178123556c5e99c"] | ||
84 | Referrer-Policy: [strict-origin-when-cross-origin] | ||
85 | Transfer-Encoding: [chunked] | ||
86 | Vary: ['Accept-Encoding, Origin'] | ||
87 | X-Content-Type-Options: [nosniff] | ||
88 | X-Download-Options: [noopen] | ||
89 | X-Frame-Options: [SAMEORIGIN] | ||
90 | X-Permitted-Cross-Domain-Policies: [none] | ||
91 | X-Request-Id: [11dfaf76-732a-4a29-a1cf-41a526ad3c9a] | ||
92 | X-Runtime: ['0.031563'] | ||
93 | X-XSS-Protection: [1; mode=block] | ||
94 | content-length: ['2'] | ||
95 | status: {code: 200, message: OK} | ||
96 | version: 1 | ||
diff --git a/tests/test_status.py b/tests/test_status.py index 88c59ce..4f6295f 100644 --- a/tests/test_status.py +++ b/tests/test_status.py | |||
@@ -50,6 +50,11 @@ def test_status_reblogged_by(status, api): | |||
50 | assert reblogs | 50 | assert reblogs |
51 | 51 | ||
52 | @pytest.mark.vcr() | 52 | @pytest.mark.vcr() |
53 | def test_status_reblog_visibility(status, api): | ||
54 | reblog_result = api.status_reblog(status['id'], visibility = 'unlisted') | ||
55 | assert reblog_result.visibility == 'unlisted' | ||
56 | |||
57 | @pytest.mark.vcr() | ||
53 | def test_status_favourited_by(status, api): | 58 | def test_status_favourited_by(status, api): |
54 | api.status_favourite(status['id']) | 59 | api.status_favourite(status['id']) |
55 | favourites = api.status_favourited_by(status['id']) | 60 | favourites = api.status_favourited_by(status['id']) |