From 66524ad4df9dcff3cee3a6d6bfc198e50ce310e1 Mon Sep 17 00:00:00 2001 From: Lorenz Diener Date: Sun, 28 Apr 2019 21:33:15 +0200 Subject: Try to fix the scheduled status test, 2.7 edition --- tests/cassettes/test_scheduled_status.yaml | 56 +++++++++++++++--------------- tests/test_status.py | 3 +- 2 files changed, 30 insertions(+), 29 deletions(-) (limited to 'tests') 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 @@ interactions: - request: - body: scheduled_at=4000-01-01T11%3A33%3A14%2B00%3A00&status=please+ensure+adequate+headroom + body: scheduled_at=4000-01-01T14%3A33%3A14%2B00%3A00&status=please+ensure+adequate+headroom headers: Accept: ['*/*'] Accept-Encoding: ['gzip, deflate'] @@ -12,12 +12,12 @@ interactions: method: POST uri: http://localhost:3000/api/v1/statuses response: - body: {string: '{"id":"20","scheduled_at":"4000-01-01T11:33:14.000Z","params":{"text":"please + body: {string: '{"id":"22","scheduled_at":"4000-01-01T14:33:14.000Z","params":{"text":"please 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":[]}'} headers: Cache-Control: ['max-age=0, private, must-revalidate'] Content-Type: [application/json; charset=utf-8] - ETag: [W/"be361ce0e4f158cb391faf2ebae37c27"] + ETag: [W/"431356517ac1801e2d1509f1a573b8fb"] Referrer-Policy: [strict-origin-when-cross-origin] Transfer-Encoding: [chunked] Vary: ['Accept-Encoding, Origin'] @@ -25,13 +25,13 @@ interactions: X-Download-Options: [noopen] X-Frame-Options: [SAMEORIGIN] X-Permitted-Cross-Domain-Policies: [none] - X-Request-Id: [c0db13da-629d-4da2-a169-8fa198881171] - X-Runtime: ['0.055765'] + X-Request-Id: [3dd7a195-fb64-468f-8bb0-a8c82c6ba5c4] + X-Runtime: ['0.057517'] X-XSS-Protection: [1; mode=block] content-length: ['307'] status: {code: 200, message: OK} - request: - body: scheduled_at=4000-01-01T11%3A23%3A14%2B00%3A00 + body: scheduled_at=4000-01-01T14%3A23%3A14%2B00%3A00 headers: Accept: ['*/*'] Accept-Encoding: ['gzip, deflate'] @@ -41,14 +41,14 @@ interactions: Content-Type: [application/x-www-form-urlencoded] User-Agent: [python-requests/2.18.4] method: PUT - uri: http://localhost:3000/api/v1/scheduled_statuses/20 + uri: http://localhost:3000/api/v1/scheduled_statuses/22 response: - body: {string: '{"id":"20","scheduled_at":"4000-01-01T11:23:14.000Z","params":{"poll":null,"text":"please + body: {string: '{"id":"22","scheduled_at":"4000-01-01T14:23:14.000Z","params":{"poll":null,"text":"please 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":[]}'} headers: Cache-Control: ['max-age=0, private, must-revalidate'] Content-Type: [application/json; charset=utf-8] - ETag: [W/"4d5e61fd2fbc19a61c0a227cf37b0a38"] + ETag: [W/"9f9235f1c4979c255c414e2899ef61da"] Referrer-Policy: [strict-origin-when-cross-origin] Transfer-Encoding: [chunked] Vary: ['Accept-Encoding, Origin'] @@ -56,8 +56,8 @@ interactions: X-Download-Options: [noopen] X-Frame-Options: [SAMEORIGIN] X-Permitted-Cross-Domain-Policies: [none] - X-Request-Id: [5a64d427-0b38-44ee-b7c1-93b488cc9b1a] - X-Runtime: ['0.024226'] + X-Request-Id: [49e8a1d5-8fa9-4d99-968a-52151dc3e7b1] + X-Runtime: ['0.024146'] X-XSS-Protection: [1; mode=block] content-length: ['307'] status: {code: 200, message: OK} @@ -72,13 +72,13 @@ interactions: method: GET uri: http://localhost:3000/api/v1/scheduled_statuses response: - body: {string: '[{"id":"20","scheduled_at":"4000-01-01T11:23:14.000Z","params":{"poll":null,"text":"please + body: {string: '[{"id":"22","scheduled_at":"4000-01-01T14:23:14.000Z","params":{"poll":null,"text":"please 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":[]}]'} headers: Cache-Control: ['max-age=0, private, must-revalidate'] Content-Type: [application/json; charset=utf-8] - ETag: [W/"d917e1a8c871328a3c6b4e031a1e6134"] - Link: ['; rel="prev"'] + ETag: [W/"7049b476e76f735f8a9cbafa4379451a"] + Link: ['; rel="prev"'] Referrer-Policy: [strict-origin-when-cross-origin] Transfer-Encoding: [chunked] Vary: ['Accept-Encoding, Origin'] @@ -86,8 +86,8 @@ interactions: X-Download-Options: [noopen] X-Frame-Options: [SAMEORIGIN] X-Permitted-Cross-Domain-Policies: [none] - X-Request-Id: [2f49987e-3261-4cb7-a8f4-5254e869b163] - X-Runtime: ['0.018487'] + X-Request-Id: [f05135d0-6a73-4520-968b-f206cc892935] + X-Runtime: ['0.017669'] X-XSS-Protection: [1; mode=block] content-length: ['309'] status: {code: 200, message: OK} @@ -100,14 +100,14 @@ interactions: Connection: [keep-alive] User-Agent: [python-requests/2.18.4] method: GET - uri: http://localhost:3000/api/v1/scheduled_statuses/20 + uri: http://localhost:3000/api/v1/scheduled_statuses/22 response: - body: {string: '{"id":"20","scheduled_at":"4000-01-01T11:23:14.000Z","params":{"poll":null,"text":"please + body: {string: '{"id":"22","scheduled_at":"4000-01-01T14:23:14.000Z","params":{"poll":null,"text":"please 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":[]}'} headers: Cache-Control: ['max-age=0, private, must-revalidate'] Content-Type: [application/json; charset=utf-8] - ETag: [W/"4d5e61fd2fbc19a61c0a227cf37b0a38"] + ETag: [W/"9f9235f1c4979c255c414e2899ef61da"] Referrer-Policy: [strict-origin-when-cross-origin] Transfer-Encoding: [chunked] Vary: ['Accept-Encoding, Origin'] @@ -115,8 +115,8 @@ interactions: X-Download-Options: [noopen] X-Frame-Options: [SAMEORIGIN] X-Permitted-Cross-Domain-Policies: [none] - X-Request-Id: [09b621ce-cd75-44b3-8dd6-4ab911631ab8] - X-Runtime: ['0.016953'] + X-Request-Id: [fc7a55bd-b43b-4df4-bd07-f69b8709557b] + X-Runtime: ['0.017029'] X-XSS-Protection: [1; mode=block] content-length: ['307'] status: {code: 200, message: OK} @@ -130,13 +130,13 @@ interactions: Content-Length: ['0'] User-Agent: [python-requests/2.18.4] method: DELETE - uri: http://localhost:3000/api/v1/scheduled_statuses/20 + uri: http://localhost:3000/api/v1/scheduled_statuses/22 response: body: {string: '{}'} headers: Cache-Control: ['max-age=0, private, must-revalidate'] Content-Type: [application/json; charset=utf-8] - ETag: [W/"76b6207dfee28b6931260e1ad1453da4"] + ETag: [W/"b9de64b821db05245efe4f96c8b026b9"] Referrer-Policy: [strict-origin-when-cross-origin] Transfer-Encoding: [chunked] Vary: ['Accept-Encoding, Origin'] @@ -144,8 +144,8 @@ interactions: X-Download-Options: [noopen] X-Frame-Options: [SAMEORIGIN] X-Permitted-Cross-Domain-Policies: [none] - X-Request-Id: [9addca1e-72fb-4fc8-8ffa-2748a2f2471c] - X-Runtime: ['0.026415'] + X-Request-Id: [c4f909ec-b77f-4d78-8402-9fd101d0b475] + X-Runtime: ['0.037066'] X-XSS-Protection: [1; mode=block] content-length: ['2'] status: {code: 200, message: OK} @@ -164,7 +164,7 @@ interactions: headers: Cache-Control: ['max-age=0, private, must-revalidate'] Content-Type: [application/json; charset=utf-8] - ETag: [W/"232a7ade8744af454b200165b5597257"] + ETag: [W/"6bb634643e4bac058e18a20692823c5f"] Referrer-Policy: [strict-origin-when-cross-origin] Transfer-Encoding: [chunked] Vary: ['Accept-Encoding, Origin'] @@ -172,8 +172,8 @@ interactions: X-Download-Options: [noopen] X-Frame-Options: [SAMEORIGIN] X-Permitted-Cross-Domain-Policies: [none] - X-Request-Id: [b9117b47-72f4-4db4-824f-e53c4507555f] - X-Runtime: ['0.014710'] + X-Request-Id: [f672f2a0-5d54-4a11-9187-8e9763c337cf] + X-Runtime: ['0.018850'] X-XSS-Protection: [1; mode=block] content-length: ['2'] 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 @@ import pytest from mastodon.Mastodon import MastodonAPIError, MastodonNotFoundError import datetime +import pytz @pytest.mark.vcr() def test_status(status, api): @@ -130,7 +131,7 @@ def test_status_pin_unpin(status, api): @pytest.mark.vcr(match_on=['path']) def test_scheduled_status(api): - base_time = datetime.datetime(4000, 1, 1, 12, 13, 14) + base_time = datetime.datetime(4000, 1, 1, 12, 13, 14, 0, pytz.timezone("Etc/GMT+2")) the_future = base_time + datetime.timedelta(minutes=20) scheduled_toot = api.status_post("please ensure adequate headroom", scheduled_at=the_future) assert scheduled_toot -- cgit v1.2.3