aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorcodl <[email protected]>2017-11-27 21:36:34 +0100
committercodl <[email protected]>2017-11-27 21:36:34 +0100
commit26eb1004bba411345b8f8bb1beb72b6a9efbb954 (patch)
treec038cd835d2890ef7aa46ebe4eac887e3d00144f /tests
parent9ee84a8dcb9b1a4eebec417b94070f8caade4ae3 (diff)
downloadmastodon.py-26eb1004bba411345b8f8bb1beb72b6a9efbb954.tar.gz
add tests for reading statuses
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_status.yaml84
-rw-r--r--tests/cassettes/test_status_context.yaml82
-rw-r--r--tests/cassettes/test_status_favourited_by.yaml113
-rw-r--r--tests/cassettes/test_status_missing.yaml26
-rw-r--r--tests/cassettes/test_status_reblogged_by.yaml117
-rw-r--r--tests/test_status.py35
6 files changed, 457 insertions, 0 deletions
diff --git a/tests/cassettes/test_status.yaml b/tests/cassettes/test_status.yaml
new file mode 100644
index 0000000..fe67d40
--- /dev/null
+++ b/tests/cassettes/test_status.yaml
@@ -0,0 +1,84 @@
1interactions:
2- request:
3 body: visibility=&status=Toot%21
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
8 Connection: [keep-alive]
9 Content-Length: ['26']
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":"99078227803851460","created_at":"2017-11-27T20:16:18.856Z","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/99078227803851460","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@admin/99078227803851460","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":"1","username":"admin","acct":"admin","display_name":"codltest","locked":false,"created_at":"2017-07-01T17:09:15.621Z","note":"\u003cp\u003ehello
17 :)\u003c/p\u003e","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.png","avatar_static":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.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":25},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'}
18 headers:
19 Cache-Control: ['max-age=0, private, must-revalidate']
20 Content-Type: [application/json; charset=utf-8]
21 ETag: [W/"105413bda7a8ac356817f2476653fcd4"]
22 Transfer-Encoding: [chunked]
23 Vary: ['Accept-Encoding, Origin']
24 X-Content-Type-Options: [nosniff]
25 X-Frame-Options: [SAMEORIGIN]
26 X-Request-Id: [d1dadaa8-40c5-4156-b3a2-86c0adfacded]
27 X-Runtime: ['0.330809']
28 X-XSS-Protection: [1; mode=block]
29 content-length: ['1216']
30 status: {code: 200, message: OK}
31- request:
32 body: null
33 headers:
34 Accept: ['*/*']
35 Accept-Encoding: ['gzip, deflate']
36 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
37 Connection: [keep-alive]
38 User-Agent: [python-requests/2.18.4]
39 method: GET
40 uri: http://localhost:3000/api/v1/statuses/99078227803851460
41 response:
42 body: {string: '{"id":"99078227803851460","created_at":"2017-11-27T20:16:18.856Z","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/99078227803851460","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@admin/99078227803851460","reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":false,"muted":false,"pinned":false,"reblog":null,"application":{"name":"Mastodon.py
43 test suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"codltest","locked":false,"created_at":"2017-07-01T17:09:15.621Z","note":"\u003cp\u003ehello
44 :)\u003c/p\u003e","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.png","avatar_static":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.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":25},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'}
45 headers:
46 Cache-Control: ['max-age=0, private, must-revalidate']
47 Content-Type: [application/json; charset=utf-8]
48 ETag: [W/"105febb770e9589b1a7d4bdb7e1b20c6"]
49 Transfer-Encoding: [chunked]
50 Vary: ['Accept-Encoding, Origin']
51 X-Content-Type-Options: [nosniff]
52 X-Frame-Options: [SAMEORIGIN]
53 X-Request-Id: [20478e3f-3f4c-4a0f-96e5-dc52d26abe1b]
54 X-Runtime: ['0.045349']
55 X-XSS-Protection: [1; mode=block]
56 content-length: ['1216']
57 status: {code: 200, message: OK}
58- request:
59 body: null
60 headers:
61 Accept: ['*/*']
62 Accept-Encoding: ['gzip, deflate']
63 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
64 Connection: [keep-alive]
65 Content-Length: ['0']
66 User-Agent: [python-requests/2.18.4]
67 method: DELETE
68 uri: http://localhost:3000/api/v1/statuses/99078227803851460
69 response:
70 body: {string: '{}'}
71 headers:
72 Cache-Control: ['max-age=0, private, must-revalidate']
73 Content-Type: [application/json; charset=utf-8]
74 ETag: [W/"526314cd6a3b1d6abeba01ee05dddd2d"]
75 Transfer-Encoding: [chunked]
76 Vary: ['Accept-Encoding, Origin']
77 X-Content-Type-Options: [nosniff]
78 X-Frame-Options: [SAMEORIGIN]
79 X-Request-Id: [94177baf-dd41-4c83-9b09-53498299cfc6]
80 X-Runtime: ['0.069073']
81 X-XSS-Protection: [1; mode=block]
82 content-length: ['2']
83 status: {code: 200, message: OK}
84version: 1
diff --git a/tests/cassettes/test_status_context.yaml b/tests/cassettes/test_status_context.yaml
new file mode 100644
index 0000000..6161265
--- /dev/null
+++ b/tests/cassettes/test_status_context.yaml
@@ -0,0 +1,82 @@
1interactions:
2- request:
3 body: visibility=&status=Toot%21
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
8 Connection: [keep-alive]
9 Content-Length: ['26']
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":"99078286000146172","created_at":"2017-11-27T20:31:06.756Z","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/99078286000146172","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@admin/99078286000146172","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":"1","username":"admin","acct":"admin","display_name":"codltest","locked":false,"created_at":"2017-07-01T17:09:15.621Z","note":"\u003cp\u003ehello
17 :)\u003c/p\u003e","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.png","avatar_static":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.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":30},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'}
18 headers:
19 Cache-Control: ['max-age=0, private, must-revalidate']
20 Content-Type: [application/json; charset=utf-8]
21 ETag: [W/"32bcedab6f2d448afcaaf36dd6975a40"]
22 Transfer-Encoding: [chunked]
23 Vary: ['Accept-Encoding, Origin']
24 X-Content-Type-Options: [nosniff]
25 X-Frame-Options: [SAMEORIGIN]
26 X-Request-Id: [6f33406c-76cf-4b55-b929-1a24d7ae4c8c]
27 X-Runtime: ['0.066145']
28 X-XSS-Protection: [1; mode=block]
29 content-length: ['1216']
30 status: {code: 200, message: OK}
31- request:
32 body: null
33 headers:
34 Accept: ['*/*']
35 Accept-Encoding: ['gzip, deflate']
36 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
37 Connection: [keep-alive]
38 User-Agent: [python-requests/2.18.4]
39 method: GET
40 uri: http://localhost:3000/api/v1/statuses/99078286000146172/context
41 response:
42 body: {string: '{"ancestors":[],"descendants":[]}'}
43 headers:
44 Cache-Control: ['max-age=0, private, must-revalidate']
45 Content-Type: [application/json; charset=utf-8]
46 ETag: [W/"7dc057a490e67a6fa22489310bb62e8b"]
47 Transfer-Encoding: [chunked]
48 Vary: ['Accept-Encoding, Origin']
49 X-Content-Type-Options: [nosniff]
50 X-Frame-Options: [SAMEORIGIN]
51 X-Request-Id: [2df55c1c-b7cf-4871-b980-d67ce90e3339]
52 X-Runtime: ['0.025829']
53 X-XSS-Protection: [1; mode=block]
54 content-length: ['33']
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_TOKEN]
62 Connection: [keep-alive]
63 Content-Length: ['0']
64 User-Agent: [python-requests/2.18.4]
65 method: DELETE
66 uri: http://localhost:3000/api/v1/statuses/99078286000146172
67 response:
68 body: {string: '{}'}
69 headers:
70 Cache-Control: ['max-age=0, private, must-revalidate']
71 Content-Type: [application/json; charset=utf-8]
72 ETag: [W/"30073ff23149286bada1e173795ba825"]
73 Transfer-Encoding: [chunked]
74 Vary: ['Accept-Encoding, Origin']
75 X-Content-Type-Options: [nosniff]
76 X-Frame-Options: [SAMEORIGIN]
77 X-Request-Id: [d66090f4-5726-4428-9526-758d93cb6853]
78 X-Runtime: ['0.023273']
79 X-XSS-Protection: [1; mode=block]
80 content-length: ['2']
81 status: {code: 200, message: OK}
82version: 1
diff --git a/tests/cassettes/test_status_favourited_by.yaml b/tests/cassettes/test_status_favourited_by.yaml
new file mode 100644
index 0000000..dcbd885
--- /dev/null
+++ b/tests/cassettes/test_status_favourited_by.yaml
@@ -0,0 +1,113 @@
1interactions:
2- request:
3 body: visibility=&status=Toot%21
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
8 Connection: [keep-alive]
9 Content-Length: ['26']
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":"99078298123973280","created_at":"2017-11-27T20:34:11.751Z","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/99078298123973280","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@admin/99078298123973280","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":"1","username":"admin","acct":"admin","display_name":"codltest","locked":false,"created_at":"2017-07-01T17:09:15.621Z","note":"\u003cp\u003ehello
17 :)\u003c/p\u003e","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.png","avatar_static":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.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":30},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'}
18 headers:
19 Cache-Control: ['max-age=0, private, must-revalidate']
20 Content-Type: [application/json; charset=utf-8]
21 ETag: [W/"4a47402024e134227ee8b72a22d4b901"]
22 Transfer-Encoding: [chunked]
23 Vary: ['Accept-Encoding, Origin']
24 X-Content-Type-Options: [nosniff]
25 X-Frame-Options: [SAMEORIGIN]
26 X-Request-Id: [1a345117-0e72-4ba2-8bdf-f5cc59ec619a]
27 X-Runtime: ['0.069381']
28 X-XSS-Protection: [1; mode=block]
29 content-length: ['1216']
30 status: {code: 200, message: OK}
31- request:
32 body: null
33 headers:
34 Accept: ['*/*']
35 Accept-Encoding: ['gzip, deflate']
36 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
37 Connection: [keep-alive]
38 Content-Length: ['0']
39 User-Agent: [python-requests/2.18.4]
40 method: POST
41 uri: http://localhost:3000/api/v1/statuses/99078298123973280/favourite
42 response:
43 body: {string: '{"id":"99078298123973280","created_at":"2017-11-27T20:34:11.751Z","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/99078298123973280","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@admin/99078298123973280","reblogs_count":0,"favourites_count":1,"favourited":true,"reblogged":false,"muted":false,"pinned":false,"reblog":null,"application":{"name":"Mastodon.py
44 test suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"codltest","locked":false,"created_at":"2017-07-01T17:09:15.621Z","note":"\u003cp\u003ehello
45 :)\u003c/p\u003e","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.png","avatar_static":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.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":30},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'}
46 headers:
47 Cache-Control: ['max-age=0, private, must-revalidate']
48 Content-Type: [application/json; charset=utf-8]
49 ETag: [W/"9f753a85dd76d2442d3fecb6f1393292"]
50 Transfer-Encoding: [chunked]
51 Vary: ['Accept-Encoding, Origin']
52 X-Content-Type-Options: [nosniff]
53 X-Frame-Options: [SAMEORIGIN]
54 X-Request-Id: [5e398471-6144-4017-8925-aa6ec9fd4822]
55 X-Runtime: ['0.132356']
56 X-XSS-Protection: [1; mode=block]
57 content-length: ['1215']
58 status: {code: 200, message: OK}
59- request:
60 body: null
61 headers:
62 Accept: ['*/*']
63 Accept-Encoding: ['gzip, deflate']
64 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
65 Connection: [keep-alive]
66 User-Agent: [python-requests/2.18.4]
67 method: GET
68 uri: http://localhost:3000/api/v1/statuses/99078298123973280/favourited_by
69 response:
70 body: {string: '[{"id":"1","username":"admin","acct":"admin","display_name":"codltest","locked":false,"created_at":"2017-07-01T17:09:15.621Z","note":"\u003cp\u003ehello
71 :)\u003c/p\u003e","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.png","avatar_static":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.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":30}]'}
72 headers:
73 Cache-Control: ['max-age=0, private, must-revalidate']
74 Content-Type: [application/json; charset=utf-8]
75 ETag: [W/"d77d417096a37f1e2ba7055b3876b91a"]
76 Link: ['<http://localhost:3000/api/v1/statuses/99078298123973280/favourited_by?since_id=7>;
77 rel="prev"']
78 Transfer-Encoding: [chunked]
79 Vary: ['Accept-Encoding, Origin']
80 X-Content-Type-Options: [nosniff]
81 X-Frame-Options: [SAMEORIGIN]
82 X-Request-Id: [09216a49-d4a7-4879-bea8-f3af3b62f1a7]
83 X-Runtime: ['0.030298']
84 X-XSS-Protection: [1; mode=block]
85 content-length: ['605']
86 status: {code: 200, message: OK}
87- request:
88 body: null
89 headers:
90 Accept: ['*/*']
91 Accept-Encoding: ['gzip, deflate']
92 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
93 Connection: [keep-alive]
94 Content-Length: ['0']
95 User-Agent: [python-requests/2.18.4]
96 method: DELETE
97 uri: http://localhost:3000/api/v1/statuses/99078298123973280
98 response:
99 body: {string: '{}'}
100 headers:
101 Cache-Control: ['max-age=0, private, must-revalidate']
102 Content-Type: [application/json; charset=utf-8]
103 ETag: [W/"8e595899be8bf13c6c2f388b7cb03820"]
104 Transfer-Encoding: [chunked]
105 Vary: ['Accept-Encoding, Origin']
106 X-Content-Type-Options: [nosniff]
107 X-Frame-Options: [SAMEORIGIN]
108 X-Request-Id: [6bdaf9b5-f87a-46fc-b17b-7b0d531cf3fc]
109 X-Runtime: ['0.020800']
110 X-XSS-Protection: [1; mode=block]
111 content-length: ['2']
112 status: {code: 200, message: OK}
113version: 1
diff --git a/tests/cassettes/test_status_missing.yaml b/tests/cassettes/test_status_missing.yaml
new file mode 100644
index 0000000..e591af5
--- /dev/null
+++ b/tests/cassettes/test_status_missing.yaml
@@ -0,0 +1,26 @@
1interactions:
2- request:
3 body: null
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
8 Connection: [keep-alive]
9 User-Agent: [python-requests/2.18.4]
10 method: GET
11 uri: http://localhost:3000/api/v1/statuses/0
12 response:
13 body: {string: '{"error":"Record not found"}'}
14 headers:
15 Cache-Control: [no-cache]
16 Content-Type: [application/json; charset=utf-8]
17 Transfer-Encoding: [chunked]
18 Vary: ['Accept-Encoding, Origin']
19 X-Content-Type-Options: [nosniff]
20 X-Frame-Options: [SAMEORIGIN]
21 X-Request-Id: [5778b7cc-7f26-4887-96a3-9f7ce70b060b]
22 X-Runtime: ['0.019627']
23 X-XSS-Protection: [1; mode=block]
24 content-length: ['28']
25 status: {code: 404, message: Not Found}
26version: 1
diff --git a/tests/cassettes/test_status_reblogged_by.yaml b/tests/cassettes/test_status_reblogged_by.yaml
new file mode 100644
index 0000000..2593310
--- /dev/null
+++ b/tests/cassettes/test_status_reblogged_by.yaml
@@ -0,0 +1,117 @@
1interactions:
2- request:
3 body: visibility=&status=Toot%21
4 headers:
5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate']
7 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
8 Connection: [keep-alive]
9 Content-Length: ['26']
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":"99078301652627743","created_at":"2017-11-27T20:35:05.594Z","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/99078301652627743","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@admin/99078301652627743","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":"1","username":"admin","acct":"admin","display_name":"codltest","locked":false,"created_at":"2017-07-01T17:09:15.621Z","note":"\u003cp\u003ehello
17 :)\u003c/p\u003e","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.png","avatar_static":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.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":30},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]}'}
18 headers:
19 Cache-Control: ['max-age=0, private, must-revalidate']
20 Content-Type: [application/json; charset=utf-8]
21 ETag: [W/"6762cd1d5cd499b62d26016756906336"]
22 Transfer-Encoding: [chunked]
23 Vary: ['Accept-Encoding, Origin']
24 X-Content-Type-Options: [nosniff]
25 X-Frame-Options: [SAMEORIGIN]
26 X-Request-Id: [41db9823-c509-4705-87ee-bf0dd0319a7a]
27 X-Runtime: ['0.060444']
28 X-XSS-Protection: [1; mode=block]
29 content-length: ['1216']
30 status: {code: 200, message: OK}
31- request:
32 body: null
33 headers:
34 Accept: ['*/*']
35 Accept-Encoding: ['gzip, deflate']
36 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
37 Connection: [keep-alive]
38 Content-Length: ['0']
39 User-Agent: [python-requests/2.18.4]
40 method: POST
41 uri: http://localhost:3000/api/v1/statuses/99078301652627743/reblog
42 response:
43 body: {string: '{"id":"99078301658914547","created_at":"2017-11-27T20:35:05.702Z","in_reply_to_id":null,"in_reply_to_account_id":null,"sensitive":false,"spoiler_text":"","visibility":"public","language":null,"uri":"http://localhost:3000/users/admin/statuses/99078301658914547/activity","content":"\u003cp\u003eRT
44 \u003cspan class=\"h-card\"\u003e\u003ca href=\"http://localhost:3000/@admin\"
45 class=\"u-url mention\"\u003e@\u003cspan\u003eadmin\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e
46 Toot!\u003c/p\u003e","url":"http://localhost:3000/@admin/99078301658914547","reblogs_count":0,"favourites_count":0,"favourited":false,"reblogged":true,"muted":false,"reblog":{"id":"99078301652627743","created_at":"2017-11-27T20:35:05.594Z","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/99078301652627743","content":"\u003cp\u003eToot!\u003c/p\u003e","url":"http://localhost:3000/@admin/99078301652627743","reblogs_count":1,"favourites_count":0,"favourited":false,"reblogged":true,"muted":false,"pinned":false,"reblog":null,"application":{"name":"Mastodon.py
47 test suite","website":null},"account":{"id":"1","username":"admin","acct":"admin","display_name":"codltest","locked":false,"created_at":"2017-07-01T17:09:15.621Z","note":"\u003cp\u003ehello
48 :)\u003c/p\u003e","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.png","avatar_static":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.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":30},"media_attachments":[],"mentions":[],"tags":[],"emojis":[]},"application":null,"account":{"id":"1","username":"admin","acct":"admin","display_name":"codltest","locked":false,"created_at":"2017-07-01T17:09:15.621Z","note":"\u003cp\u003ehello
49 :)\u003c/p\u003e","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.png","avatar_static":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.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":31},"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/"3e81c80ff16984de9f8bc45b51e9ef92"]
54 Transfer-Encoding: [chunked]
55 Vary: ['Accept-Encoding, Origin']
56 X-Content-Type-Options: [nosniff]
57 X-Frame-Options: [SAMEORIGIN]
58 X-Request-Id: [f2d6b6ac-6a16-4627-a267-a0d01316ff1a]
59 X-Runtime: ['0.440215']
60 X-XSS-Protection: [1; mode=block]
61 content-length: ['2558']
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_TOKEN]
69 Connection: [keep-alive]
70 User-Agent: [python-requests/2.18.4]
71 method: GET
72 uri: http://localhost:3000/api/v1/statuses/99078301652627743/reblogged_by
73 response:
74 body: {string: '[{"id":"1","username":"admin","acct":"admin","display_name":"codltest","locked":false,"created_at":"2017-07-01T17:09:15.621Z","note":"\u003cp\u003ehello
75 :)\u003c/p\u003e","url":"http://localhost:3000/@admin","avatar":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.png","avatar_static":"http://localhost:3000/system/accounts/avatars/000/000/001/original/99b4c443463de195.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":31}]'}
76 headers:
77 Cache-Control: ['max-age=0, private, must-revalidate']
78 Content-Type: [application/json; charset=utf-8]
79 ETag: [W/"1c51dd204563ba1e7038fa269b4e4d78"]
80 Link: ['<http://localhost:3000/api/v1/statuses/99078301652627743/reblogged_by?since_id=99078301658914547>;
81 rel="prev"']
82 Transfer-Encoding: [chunked]
83 Vary: ['Accept-Encoding, Origin']
84 X-Content-Type-Options: [nosniff]
85 X-Frame-Options: [SAMEORIGIN]
86 X-Request-Id: [76780692-33c7-4340-ae20-6d1a44f9c320]
87 X-Runtime: ['0.023444']
88 X-XSS-Protection: [1; mode=block]
89 content-length: ['605']
90 status: {code: 200, message: OK}
91- request:
92 body: null
93 headers:
94 Accept: ['*/*']
95 Accept-Encoding: ['gzip, deflate']
96 Authorization: [Bearer __MASTODON_PY_TEST_TOKEN]
97 Connection: [keep-alive]
98 Content-Length: ['0']
99 User-Agent: [python-requests/2.18.4]
100 method: DELETE
101 uri: http://localhost:3000/api/v1/statuses/99078301652627743
102 response:
103 body: {string: '{}'}
104 headers:
105 Cache-Control: ['max-age=0, private, must-revalidate']
106 Content-Type: [application/json; charset=utf-8]
107 ETag: [W/"7a5627e90e879ff1f76896b7864271e2"]
108 Transfer-Encoding: [chunked]
109 Vary: ['Accept-Encoding, Origin']
110 X-Content-Type-Options: [nosniff]
111 X-Frame-Options: [SAMEORIGIN]
112 X-Request-Id: [6427c02d-f464-4004-95d1-7b4b52e1cc57]
113 X-Runtime: ['0.016306']
114 X-XSS-Protection: [1; mode=block]
115 content-length: ['2']
116 status: {code: 200, message: OK}
117version: 1
diff --git a/tests/test_status.py b/tests/test_status.py
new file mode 100644
index 0000000..971940a
--- /dev/null
+++ b/tests/test_status.py
@@ -0,0 +1,35 @@
1import pytest
2from mastodon.Mastodon import MastodonAPIError
3
4@pytest.mark.vcr()
5def test_status(status, api):
6 status2 = api.status(status['id'])
7 assert status2 == status
8
9@pytest.mark.vcr()
10def test_status_missing(api):
11 with pytest.raises(MastodonAPIError):
12 api.status(0)
13
14@pytest.mark.skip(reason="Doesn't look like mastodon will make a card for an url that doesn't have a TLD, and relying on some external website being reachable to make a card of is messy :/")
15def test_status_card(api):
16 status = api.status_post("http://localhost:3000")
17 card = api.status_card(status['id'])
18 assert card
19
20@pytest.mark.vcr()
21def test_status_context(status, api):
22 context = api.status_context(status['id'])
23 assert context
24
25@pytest.mark.vcr()
26def test_status_reblogged_by(status, api):
27 api.status_reblog(status['id'])
28 reblogs = api.status_reblogged_by(status['id'])
29 assert reblogs
30
31@pytest.mark.vcr()
32def test_status_favourited_by(status, api):
33 api.status_favourite(status['id'])
34 favourites = api.status_favourited_by(status['id'])
35 assert favourites
Powered by cgit v1.2.3 (git 2.41.0)