aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cassettes/test_scheduled_status.yaml56
-rw-r--r--tests/test_status.py3
2 files changed, 30 insertions, 29 deletions
diff --git a/tests/cassettes/test_scheduled_status.yaml b/tests/cassettes/test_scheduled_status.yaml
index 5dbe2e9..53bc397 100644
--- a/tests/cassettes/test_scheduled_status.yaml
+++ b/tests/cassettes/test_scheduled_status.yaml
@@ -1,6 +1,6 @@
1interactions: 1interactions:
2- request: 2- request:
3 body: scheduled_at=4000-01-01T11%3A33%3A14%2B00%3A00&status=please+ensure+adequate+headroom 3 body: scheduled_at=4000-01-01T14%3A33%3A14%2B00%3A00&status=please+ensure+adequate+headroom
4 headers: 4 headers:
5 Accept: ['*/*'] 5 Accept: ['*/*']
6 Accept-Encoding: ['gzip, deflate'] 6 Accept-Encoding: ['gzip, deflate']
@@ -12,12 +12,12 @@ interactions:
12 method: POST 12 method: POST
13 uri: http://localhost:3000/api/v1/statuses 13 uri: http://localhost:3000/api/v1/statuses
14 response: 14 response:
15 body: {string: '{"id":"20","scheduled_at":"4000-01-01T11:33:14.000Z","params":{"text":"please 15 body: {string: '{"id":"22","scheduled_at":"4000-01-01T14:33:14.000Z","params":{"text":"please
16 ensure adequate headroom","media_ids":null,"sensitive":null,"spoiler_text":null,"visibility":null,"scheduled_at":null,"poll":null,"idempotency":null,"in_reply_to_id":null,"application_id":1234567890123456},"media_attachments":[]}'} 16 ensure adequate headroom","media_ids":null,"sensitive":null,"spoiler_text":null,"visibility":null,"scheduled_at":null,"poll":null,"idempotency":null,"in_reply_to_id":null,"application_id":1234567890123456},"media_attachments":[]}'}
17 headers: 17 headers:
18 Cache-Control: ['max-age=0, private, must-revalidate'] 18 Cache-Control: ['max-age=0, private, must-revalidate']
19 Content-Type: [application/json; charset=utf-8] 19 Content-Type: [application/json; charset=utf-8]
20 ETag: [W/"be361ce0e4f158cb391faf2ebae37c27"] 20 ETag: [W/"431356517ac1801e2d1509f1a573b8fb"]
21 Referrer-Policy: [strict-origin-when-cross-origin] 21 Referrer-Policy: [strict-origin-when-cross-origin]
22 Transfer-Encoding: [chunked] 22 Transfer-Encoding: [chunked]
23 Vary: ['Accept-Encoding, Origin'] 23 Vary: ['Accept-Encoding, Origin']
@@ -25,13 +25,13 @@ interactions:
25 X-Download-Options: [noopen] 25 X-Download-Options: [noopen]
26 X-Frame-Options: [SAMEORIGIN] 26 X-Frame-Options: [SAMEORIGIN]
27 X-Permitted-Cross-Domain-Policies: [none] 27 X-Permitted-Cross-Domain-Policies: [none]
28 X-Request-Id: [c0db13da-629d-4da2-a169-8fa198881171] 28 X-Request-Id: [3dd7a195-fb64-468f-8bb0-a8c82c6ba5c4]
29 X-Runtime: ['0.055765'] 29 X-Runtime: ['0.057517']
30 X-XSS-Protection: [1; mode=block] 30 X-XSS-Protection: [1; mode=block]
31 content-length: ['307'] 31 content-length: ['307']
32 status: {code: 200, message: OK} 32 status: {code: 200, message: OK}
33- request: 33- request:
34 body: scheduled_at=4000-01-01T11%3A23%3A14%2B00%3A00 34 body: scheduled_at=4000-01-01T14%3A23%3A14%2B00%3A00
35 headers: 35 headers:
36 Accept: ['*/*'] 36 Accept: ['*/*']
37 Accept-Encoding: ['gzip, deflate'] 37 Accept-Encoding: ['gzip, deflate']
@@ -41,14 +41,14 @@ interactions:
41 Content-Type: [application/x-www-form-urlencoded] 41 Content-Type: [application/x-www-form-urlencoded]
42 User-Agent: [python-requests/2.18.4] 42 User-Agent: [python-requests/2.18.4]
43 method: PUT 43 method: PUT
44 uri: http://localhost:3000/api/v1/scheduled_statuses/20 44 uri: http://localhost:3000/api/v1/scheduled_statuses/22
45 response: 45 response:
46 body: {string: '{"id":"20","scheduled_at":"4000-01-01T11:23:14.000Z","params":{"poll":null,"text":"please 46 body: {string: '{"id":"22","scheduled_at":"4000-01-01T14:23:14.000Z","params":{"poll":null,"text":"please
47 ensure adequate headroom","media_ids":null,"sensitive":null,"visibility":null,"idempotency":null,"scheduled_at":null,"spoiler_text":null,"application_id":1234567890123456,"in_reply_to_id":null},"media_attachments":[]}'} 47 ensure adequate headroom","media_ids":null,"sensitive":null,"visibility":null,"idempotency":null,"scheduled_at":null,"spoiler_text":null,"application_id":1234567890123456,"in_reply_to_id":null},"media_attachments":[]}'}
48 headers: 48 headers:
49 Cache-Control: ['max-age=0, private, must-revalidate'] 49 Cache-Control: ['max-age=0, private, must-revalidate']
50 Content-Type: [application/json; charset=utf-8] 50 Content-Type: [application/json; charset=utf-8]
51 ETag: [W/"4d5e61fd2fbc19a61c0a227cf37b0a38"] 51 ETag: [W/"9f9235f1c4979c255c414e2899ef61da"]
52 Referrer-Policy: [strict-origin-when-cross-origin] 52 Referrer-Policy: [strict-origin-when-cross-origin]
53 Transfer-Encoding: [chunked] 53 Transfer-Encoding: [chunked]
54 Vary: ['Accept-Encoding, Origin'] 54 Vary: ['Accept-Encoding, Origin']
@@ -56,8 +56,8 @@ interactions:
56 X-Download-Options: [noopen] 56 X-Download-Options: [noopen]
57 X-Frame-Options: [SAMEORIGIN] 57 X-Frame-Options: [SAMEORIGIN]
58 X-Permitted-Cross-Domain-Policies: [none] 58 X-Permitted-Cross-Domain-Policies: [none]
59 X-Request-Id: [5a64d427-0b38-44ee-b7c1-93b488cc9b1a] 59 X-Request-Id: [49e8a1d5-8fa9-4d99-968a-52151dc3e7b1]
60 X-Runtime: ['0.024226'] 60 X-Runtime: ['0.024146']
61 X-XSS-Protection: [1; mode=block] 61 X-XSS-Protection: [1; mode=block]
62 content-length: ['307'] 62 content-length: ['307']
63 status: {code: 200, message: OK} 63 status: {code: 200, message: OK}
@@ -72,13 +72,13 @@ interactions:
72 method: GET 72 method: GET
73 uri: http://localhost:3000/api/v1/scheduled_statuses 73 uri: http://localhost:3000/api/v1/scheduled_statuses
74 response: 74 response:
75 body: {string: '[{"id":"20","scheduled_at":"4000-01-01T11:23:14.000Z","params":{"poll":null,"text":"please 75 body: {string: '[{"id":"22","scheduled_at":"4000-01-01T14:23:14.000Z","params":{"poll":null,"text":"please
76 ensure adequate headroom","media_ids":null,"sensitive":null,"visibility":null,"idempotency":null,"scheduled_at":null,"spoiler_text":null,"application_id":1234567890123456,"in_reply_to_id":null},"media_attachments":[]}]'} 76 ensure adequate headroom","media_ids":null,"sensitive":null,"visibility":null,"idempotency":null,"scheduled_at":null,"spoiler_text":null,"application_id":1234567890123456,"in_reply_to_id":null},"media_attachments":[]}]'}
77 headers: 77 headers:
78 Cache-Control: ['max-age=0, private, must-revalidate'] 78 Cache-Control: ['max-age=0, private, must-revalidate']
79 Content-Type: [application/json; charset=utf-8] 79 Content-Type: [application/json; charset=utf-8]
80 ETag: [W/"d917e1a8c871328a3c6b4e031a1e6134"] 80 ETag: [W/"7049b476e76f735f8a9cbafa4379451a"]
81 Link: ['<http://localhost:3000/api/v1/scheduled_statuses?min_id=20>; rel="prev"'] 81 Link: ['<http://localhost:3000/api/v1/scheduled_statuses?min_id=22>; rel="prev"']
82 Referrer-Policy: [strict-origin-when-cross-origin] 82 Referrer-Policy: [strict-origin-when-cross-origin]
83 Transfer-Encoding: [chunked] 83 Transfer-Encoding: [chunked]
84 Vary: ['Accept-Encoding, Origin'] 84 Vary: ['Accept-Encoding, Origin']
@@ -86,8 +86,8 @@ interactions:
86 X-Download-Options: [noopen] 86 X-Download-Options: [noopen]
87 X-Frame-Options: [SAMEORIGIN] 87 X-Frame-Options: [SAMEORIGIN]
88 X-Permitted-Cross-Domain-Policies: [none] 88 X-Permitted-Cross-Domain-Policies: [none]
89 X-Request-Id: [2f49987e-3261-4cb7-a8f4-5254e869b163] 89 X-Request-Id: [f05135d0-6a73-4520-968b-f206cc892935]
90 X-Runtime: ['0.018487'] 90 X-Runtime: ['0.017669']
91 X-XSS-Protection: [1; mode=block] 91 X-XSS-Protection: [1; mode=block]
92 content-length: ['309'] 92 content-length: ['309']
93 status: {code: 200, message: OK} 93 status: {code: 200, message: OK}
@@ -100,14 +100,14 @@ interactions:
100 Connection: [keep-alive] 100 Connection: [keep-alive]
101 User-Agent: [python-requests/2.18.4] 101 User-Agent: [python-requests/2.18.4]
102 method: GET 102 method: GET
103 uri: http://localhost:3000/api/v1/scheduled_statuses/20 103 uri: http://localhost:3000/api/v1/scheduled_statuses/22
104 response: 104 response:
105 body: {string: '{"id":"20","scheduled_at":"4000-01-01T11:23:14.000Z","params":{"poll":null,"text":"please 105 body: {string: '{"id":"22","scheduled_at":"4000-01-01T14:23:14.000Z","params":{"poll":null,"text":"please
106 ensure adequate headroom","media_ids":null,"sensitive":null,"visibility":null,"idempotency":null,"scheduled_at":null,"spoiler_text":null,"application_id":1234567890123456,"in_reply_to_id":null},"media_attachments":[]}'} 106 ensure adequate headroom","media_ids":null,"sensitive":null,"visibility":null,"idempotency":null,"scheduled_at":null,"spoiler_text":null,"application_id":1234567890123456,"in_reply_to_id":null},"media_attachments":[]}'}
107 headers: 107 headers:
108 Cache-Control: ['max-age=0, private, must-revalidate'] 108 Cache-Control: ['max-age=0, private, must-revalidate']
109 Content-Type: [application/json; charset=utf-8] 109 Content-Type: [application/json; charset=utf-8]
110 ETag: [W/"4d5e61fd2fbc19a61c0a227cf37b0a38"] 110 ETag: [W/"9f9235f1c4979c255c414e2899ef61da"]
111 Referrer-Policy: [strict-origin-when-cross-origin] 111 Referrer-Policy: [strict-origin-when-cross-origin]
112 Transfer-Encoding: [chunked] 112 Transfer-Encoding: [chunked]
113 Vary: ['Accept-Encoding, Origin'] 113 Vary: ['Accept-Encoding, Origin']
@@ -115,8 +115,8 @@ interactions:
115 X-Download-Options: [noopen] 115 X-Download-Options: [noopen]
116 X-Frame-Options: [SAMEORIGIN] 116 X-Frame-Options: [SAMEORIGIN]
117 X-Permitted-Cross-Domain-Policies: [none] 117 X-Permitted-Cross-Domain-Policies: [none]
118 X-Request-Id: [09b621ce-cd75-44b3-8dd6-4ab911631ab8] 118 X-Request-Id: [fc7a55bd-b43b-4df4-bd07-f69b8709557b]
119 X-Runtime: ['0.016953'] 119 X-Runtime: ['0.017029']
120 X-XSS-Protection: [1; mode=block] 120 X-XSS-Protection: [1; mode=block]
121 content-length: ['307'] 121 content-length: ['307']
122 status: {code: 200, message: OK} 122 status: {code: 200, message: OK}
@@ -130,13 +130,13 @@ interactions:
130 Content-Length: ['0'] 130 Content-Length: ['0']
131 User-Agent: [python-requests/2.18.4] 131 User-Agent: [python-requests/2.18.4]
132 method: DELETE 132 method: DELETE
133 uri: http://localhost:3000/api/v1/scheduled_statuses/20 133 uri: http://localhost:3000/api/v1/scheduled_statuses/22
134 response: 134 response:
135 body: {string: '{}'} 135 body: {string: '{}'}
136 headers: 136 headers:
137 Cache-Control: ['max-age=0, private, must-revalidate'] 137 Cache-Control: ['max-age=0, private, must-revalidate']
138 Content-Type: [application/json; charset=utf-8] 138 Content-Type: [application/json; charset=utf-8]
139 ETag: [W/"76b6207dfee28b6931260e1ad1453da4"] 139 ETag: [W/"b9de64b821db05245efe4f96c8b026b9"]
140 Referrer-Policy: [strict-origin-when-cross-origin] 140 Referrer-Policy: [strict-origin-when-cross-origin]
141 Transfer-Encoding: [chunked] 141 Transfer-Encoding: [chunked]
142 Vary: ['Accept-Encoding, Origin'] 142 Vary: ['Accept-Encoding, Origin']
@@ -144,8 +144,8 @@ interactions:
144 X-Download-Options: [noopen] 144 X-Download-Options: [noopen]
145 X-Frame-Options: [SAMEORIGIN] 145 X-Frame-Options: [SAMEORIGIN]
146 X-Permitted-Cross-Domain-Policies: [none] 146 X-Permitted-Cross-Domain-Policies: [none]
147 X-Request-Id: [9addca1e-72fb-4fc8-8ffa-2748a2f2471c] 147 X-Request-Id: [c4f909ec-b77f-4d78-8402-9fd101d0b475]
148 X-Runtime: ['0.026415'] 148 X-Runtime: ['0.037066']
149 X-XSS-Protection: [1; mode=block] 149 X-XSS-Protection: [1; mode=block]
150 content-length: ['2'] 150 content-length: ['2']
151 status: {code: 200, message: OK} 151 status: {code: 200, message: OK}
@@ -164,7 +164,7 @@ interactions:
164 headers: 164 headers:
165 Cache-Control: ['max-age=0, private, must-revalidate'] 165 Cache-Control: ['max-age=0, private, must-revalidate']
166 Content-Type: [application/json; charset=utf-8] 166 Content-Type: [application/json; charset=utf-8]
167 ETag: [W/"232a7ade8744af454b200165b5597257"] 167 ETag: [W/"6bb634643e4bac058e18a20692823c5f"]
168 Referrer-Policy: [strict-origin-when-cross-origin] 168 Referrer-Policy: [strict-origin-when-cross-origin]
169 Transfer-Encoding: [chunked] 169 Transfer-Encoding: [chunked]
170 Vary: ['Accept-Encoding, Origin'] 170 Vary: ['Accept-Encoding, Origin']
@@ -172,8 +172,8 @@ interactions:
172 X-Download-Options: [noopen] 172 X-Download-Options: [noopen]
173 X-Frame-Options: [SAMEORIGIN] 173 X-Frame-Options: [SAMEORIGIN]
174 X-Permitted-Cross-Domain-Policies: [none] 174 X-Permitted-Cross-Domain-Policies: [none]
175 X-Request-Id: [b9117b47-72f4-4db4-824f-e53c4507555f] 175 X-Request-Id: [f672f2a0-5d54-4a11-9187-8e9763c337cf]
176 X-Runtime: ['0.014710'] 176 X-Runtime: ['0.018850']
177 X-XSS-Protection: [1; mode=block] 177 X-XSS-Protection: [1; mode=block]
178 content-length: ['2'] 178 content-length: ['2']
179 status: {code: 200, message: OK} 179 status: {code: 200, message: OK}
diff --git a/tests/test_status.py b/tests/test_status.py
index 4f6295f..ef27f9c 100644
--- a/tests/test_status.py
+++ b/tests/test_status.py
@@ -1,6 +1,7 @@
1import pytest 1import pytest
2from mastodon.Mastodon import MastodonAPIError, MastodonNotFoundError 2from mastodon.Mastodon import MastodonAPIError, MastodonNotFoundError
3import datetime 3import datetime
4import pytz
4 5
5@pytest.mark.vcr() 6@pytest.mark.vcr()
6def test_status(status, api): 7def test_status(status, api):
@@ -130,7 +131,7 @@ def test_status_pin_unpin(status, api):
130 131
131@pytest.mark.vcr(match_on=['path']) 132@pytest.mark.vcr(match_on=['path'])
132def test_scheduled_status(api): 133def test_scheduled_status(api):
133 base_time = datetime.datetime(4000, 1, 1, 12, 13, 14) 134 base_time = datetime.datetime(4000, 1, 1, 12, 13, 14, 0, pytz.timezone("Etc/GMT+2"))
134 the_future = base_time + datetime.timedelta(minutes=20) 135 the_future = base_time + datetime.timedelta(minutes=20)
135 scheduled_toot = api.status_post("please ensure adequate headroom", scheduled_at=the_future) 136 scheduled_toot = api.status_post("please ensure adequate headroom", scheduled_at=the_future)
136 assert scheduled_toot 137 assert scheduled_toot
Powered by cgit v1.2.3 (git 2.41.0)