0
0
mirror of https://github.com/ihabunek/toot.git synced 2025-10-21 19:44:16 -04:00

Remove use of deprecated status.text_url

This commit is contained in:
Ivan Habunek
2022-11-30 08:55:46 +01:00
parent e396768d15
commit 7b4063fddc
5 changed files with 35 additions and 13 deletions

View File

@@ -293,13 +293,14 @@ def test_reblogged_by(mock_get, monkeypatch, capsys):
])
assert out == expected
@mock.patch('toot.http.post')
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',
'text_url': 'https://bigfish.software/345/678',
'url': 'https://bigfish.software/345/678',
'type': 'image',
})

View File

@@ -25,6 +25,7 @@ from toot import CLIENT_NAME, CLIENT_WEBSITE, api, App, User
from toot.console import run_command
from toot.exceptions import ConsoleError, NotFoundError
from toot.utils import get_text
from unittest import mock
# Host name of a test instance to run integration tests against
# DO NOT USE PUBLIC INSTANCES!!!
@@ -181,6 +182,27 @@ def test_media_attachments(app, user, run):
assert a4["description"] == "Test 4"
@mock.patch("toot.utils.multiline_input")
@mock.patch("sys.stdin.read")
def test_media_attachment_without_text(mock_read, mock_ml, app, user, run):
# No status from stdin or readline
mock_read.return_value = ""
mock_ml.return_value = ""
assets_dir = path.realpath(path.join(path.dirname(__file__), "assets"))
media_path = path.join(assets_dir, "test1.png")
out = run("post", "--media", media_path)
status_id = _posted_status_id(out)
status = api.fetch_status(app, user, status_id)
assert status["content"] == ""
[attachment] = status["media_attachments"]
assert attachment["meta"]["original"]["size"] == "50x50"
assert attachment["description"] is None
def test_delete_status(app, user, run):
status = api.post_status(app, user, "foo")