Test media thumbnails

pull/326/head
Ivan Habunek 2023-03-03 11:43:24 +01:00
rodzic 244502ec0b
commit e2f9a354ac
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: F5F0623FF5EBCB3D
3 zmienionych plików z 33 dodań i 1 usunięć

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -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',

Wyświetl plik

@ -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"))