Document and test focus

pull/139/head
Lorenz Diener 2018-06-04 21:20:43 +02:00
rodzic 362767f911
commit 465981ea9a
5 zmienionych plików z 2880 dodań i 2868 usunięć

Wyświetl plik

@ -409,6 +409,7 @@ Media dicts
# May additionally contain an "fps" field giving a videos frames per second (possibly
# rounded), and a "length" field giving a videos length in a human-readable format.
# Note that a video may have an image as preview.
# May also contain a 'focus' dict.
}
# Metadata dicts (image) - all fields are optional:
@ -429,6 +430,12 @@ Media dicts
'bitrate': # Average bit-rate of the video in bytes per second
}
# Focus Metadata dict:
{
'x': Focus point x coordinate (between -1 and 1)
'y': Focus point x coordinate (between -1 and 1)
}
Card dicts
~~~~~~~~~~
.. _card dict:

Wyświetl plik

@ -5,8 +5,9 @@ import pytest
def test_media_post(api, sensitive):
media = api.media_post(
'tests/image.jpg',
description="John Lennon doing a funny walk")
description="John Lennon doing a funny walk",
focus=(-0.5, 0.3))
assert media
status = api.status_post(
@ -21,6 +22,8 @@ def test_media_post(api, sensitive):
assert status['sensitive'] == sensitive
assert status['media_attachments']
assert status['media_attachments'][0]['description']
assert status['media_attachments'][0]['meta']['focus']['x'] == -0.5
assert status['media_attachments'][0]['meta']['focus']['y'] == 0.3
finally:
api.status_delete(status['id'])