mirror of
https://github.com/ihabunek/toot.git
synced 2025-02-02 15:07:51 -05:00
Test media thumbnails
This commit is contained in:
parent
244502ec0b
commit
e2f9a354ac
BIN
tests/assets/small.webm
Normal file
BIN
tests/assets/small.webm
Normal file
Binary file not shown.
@ -292,7 +292,6 @@ def test_reblogged_by(mock_get, monkeypatch, capsys):
|
||||
def test_upload(mock_post, capsys):
|
||||
mock_post.return_value = MockResponse({
|
||||
'id': 123,
|
||||
'url': 'https://bigfish.software/123/456',
|
||||
'preview_url': 'https://bigfish.software/789/012',
|
||||
'url': 'https://bigfish.software/345/678',
|
||||
'type': 'image',
|
||||
|
@ -207,6 +207,39 @@ def test_post_language(app, user, run):
|
||||
assert status["language"] == "zh"
|
||||
|
||||
|
||||
def test_media_thumbnail(app, user, run):
|
||||
assets_dir = path.realpath(path.join(path.dirname(__file__), "assets"))
|
||||
|
||||
video_path = path.join(assets_dir, "small.webm")
|
||||
thumbnail_path = path.join(assets_dir, "test1.png")
|
||||
|
||||
out = run(
|
||||
"post",
|
||||
"--media", video_path,
|
||||
"--thumbnail", thumbnail_path,
|
||||
"--description", "foo",
|
||||
"some text"
|
||||
)
|
||||
|
||||
status_id = _posted_status_id(out)
|
||||
status = api.fetch_status(app, user, status_id)
|
||||
[media] = status["media_attachments"]
|
||||
|
||||
assert media["description"] == "foo"
|
||||
assert media["type"] == "video"
|
||||
assert media["url"].endswith(".mp4")
|
||||
assert media["preview_url"].endswith(".png")
|
||||
|
||||
# Video properties
|
||||
assert media["meta"]["original"]["duration"] == 5.58
|
||||
assert media["meta"]["original"]["height"] == 320
|
||||
assert media["meta"]["original"]["width"] == 560
|
||||
|
||||
# Thumbnail properties
|
||||
assert media["meta"]["small"]["height"] == 50
|
||||
assert media["meta"]["small"]["width"] == 50
|
||||
|
||||
|
||||
def test_media_attachments(app, user, run):
|
||||
assets_dir = path.realpath(path.join(path.dirname(__file__), "assets"))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user