Fix tests, again

This commit is contained in:
Lorenz Diener 2019-04-28 19:46:20 +02:00
pare 1cbf923494
commit ee4549acd0
S'han modificat 2 arxius amb 33 adicions i 32 eliminacions

Veure arxiu

@ -1,23 +1,23 @@
interactions:
- request:
body: scheduled_at=2019-04-28T17%3A55%3A56.132387%2B00%3A00&status=please+ensure+adequate+headroom
body: scheduled_at=4000-01-01T11%3A33%3A14%2B00%3A00&status=please+ensure+adequate+headroom
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
Connection: [keep-alive]
Content-Length: ['92']
Content-Length: ['85']
Content-Type: [application/x-www-form-urlencoded]
User-Agent: [python-requests/2.18.4]
method: POST
uri: http://localhost:3000/api/v1/statuses
response:
body: {string: '{"id":"15","scheduled_at":"2019-04-28T17:55:56.132Z","params":{"text":"please
body: {string: '{"id":"18","scheduled_at":"4000-01-01T11: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/"d9085bd3f4bda89b707e0d17e0c25606"]
ETag: [W/"55a21b75b918b4af7fdb4b8d90f7d6e7"]
Referrer-Policy: [strict-origin-when-cross-origin]
Transfer-Encoding: [chunked]
Vary: ['Accept-Encoding, Origin']
@ -25,30 +25,30 @@ interactions:
X-Download-Options: [noopen]
X-Frame-Options: [SAMEORIGIN]
X-Permitted-Cross-Domain-Policies: [none]
X-Request-Id: [e3c02c5e-8bd8-4e7e-a85e-20729f54fe3a]
X-Runtime: ['0.045715']
X-Request-Id: [0a550963-ff3c-46a1-b8b5-5e40dd64c746]
X-Runtime: ['0.042131']
X-XSS-Protection: [1; mode=block]
content-length: ['307']
status: {code: 200, message: OK}
- request:
body: scheduled_at=2019-04-28T17%3A45%3A56.195854%2B00%3A00
body: scheduled_at=4000-01-01T11%3A23%3A14%2B00%3A00
headers:
Accept: ['*/*']
Accept-Encoding: ['gzip, deflate']
Authorization: [Bearer __MASTODON_PY_TEST_ACCESS_TOKEN]
Connection: [keep-alive]
Content-Length: ['53']
Content-Length: ['46']
Content-Type: [application/x-www-form-urlencoded]
User-Agent: [python-requests/2.18.4]
method: PUT
uri: http://localhost:3000/api/v1/scheduled_statuses/15
uri: http://localhost:3000/api/v1/scheduled_statuses/18
response:
body: {string: '{"id":"15","scheduled_at":"2019-04-28T17:45:56.195Z","params":{"poll":null,"text":"please
body: {string: '{"id":"18","scheduled_at":"4000-01-01T11: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/"d21355711617bb379ce78df652b0db2f"]
ETag: [W/"4211b1c063163578d72e0d9fee015aac"]
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: [209c6297-c6b8-4c24-909a-9fec28b3b84a]
X-Runtime: ['0.023350']
X-Request-Id: [00ce2af1-000d-40fc-9765-9661b4fda8a5]
X-Runtime: ['0.023685']
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":"15","scheduled_at":"2019-04-28T17:45:56.195Z","params":{"poll":null,"text":"please
body: {string: '[{"id":"18","scheduled_at":"4000-01-01T11: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/"138781baa8c10ef9dbbc79f4b0de8fde"]
Link: ['<http://localhost:3000/api/v1/scheduled_statuses?min_id=15>; rel="prev"']
ETag: [W/"214cbc9aaa46dbb18c2d5a1437d145d5"]
Link: ['<http://localhost:3000/api/v1/scheduled_statuses?min_id=18>; 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: [0a077bac-40fc-450f-8c55-3a611f587dcf]
X-Runtime: ['0.018360']
X-Request-Id: [9790aeb5-05f9-4d77-87bb-05e7add83909]
X-Runtime: ['0.017555']
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/15
uri: http://localhost:3000/api/v1/scheduled_statuses/18
response:
body: {string: '{"id":"15","scheduled_at":"2019-04-28T17:45:56.195Z","params":{"poll":null,"text":"please
body: {string: '{"id":"18","scheduled_at":"4000-01-01T11: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/"d21355711617bb379ce78df652b0db2f"]
ETag: [W/"4211b1c063163578d72e0d9fee015aac"]
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: [b4114f7e-4da9-4e0b-ae67-3a4f74f2ef98]
X-Runtime: ['0.017521']
X-Request-Id: [720a388c-96a2-4159-951b-5e24012646be]
X-Runtime: ['0.015976']
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/15
uri: http://localhost:3000/api/v1/scheduled_statuses/18
response:
body: {string: '{}'}
headers:
Cache-Control: ['max-age=0, private, must-revalidate']
Content-Type: [application/json; charset=utf-8]
ETag: [W/"827009f7d29340dc4283f20343805141"]
ETag: [W/"a97c68bcd1ca704122f54447e96fcb7a"]
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: [59ee7082-f753-4527-b2f8-ce856067fee6]
X-Runtime: ['0.026622']
X-Request-Id: [b57c0e70-97bf-4777-8272-e0d06799291d]
X-Runtime: ['0.025188']
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/"432588bf7e5e8b3c9a1fa09d4823b9e1"]
ETag: [W/"a3f1c7eff68af7234bcf2a8d4233d0c1"]
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: [b35d8cb9-37b9-493f-9f27-03607a0f9b6e]
X-Runtime: ['0.015168']
X-Request-Id: [e1152c40-5d88-410a-bd73-cb0c7dbc3f92]
X-Runtime: ['0.014370']
X-XSS-Protection: [1; mode=block]
content-length: ['2']
status: {code: 200, message: OK}

Veure arxiu

@ -125,11 +125,12 @@ def test_status_pin_unpin(status, api):
@pytest.mark.vcr()
def test_scheduled_status(api):
the_future = datetime.datetime.now() + datetime.timedelta(minutes=20)
base_time = datetime.datetime(4000, 1, 1, 12, 13, 14)
the_future = base_time + datetime.timedelta(minutes=20)
scheduled_toot = api.status_post("please ensure adequate headroom", scheduled_at=the_future)
assert scheduled_toot
the_immediate_future = datetime.datetime.now() + datetime.timedelta(minutes=10)
the_immediate_future = base_time + datetime.timedelta(minutes=10)
scheduled_toot_2 = api.scheduled_status_update(scheduled_toot, the_immediate_future)
assert scheduled_toot_2
assert scheduled_toot_2.id == scheduled_toot.id