Fix several tests when running on Pleroma
This commit is contained in:
parent
3e828c05d9
commit
40e7a6f3a1
1 changed files with 17 additions and 11 deletions
|
@ -25,7 +25,6 @@ from os import path
|
|||
from toot import CLIENT_NAME, CLIENT_WEBSITE, api, App, User
|
||||
from toot.console import run_command
|
||||
from toot.exceptions import ConsoleError, NotFoundError
|
||||
from toot.tui.utils import parse_datetime
|
||||
from toot.utils import get_text
|
||||
from unittest import mock
|
||||
|
||||
|
@ -131,13 +130,15 @@ def test_post(app, user, run):
|
|||
|
||||
status = api.fetch_status(app, user, status_id)
|
||||
assert text == get_text(status["content"])
|
||||
assert status["account"]["acct"] == user.username
|
||||
assert status["application"]["name"] == CLIENT_NAME
|
||||
assert status["application"]["website"] == CLIENT_WEBSITE
|
||||
assert status["visibility"] == "public"
|
||||
assert status["sensitive"] is False
|
||||
assert status["spoiler_text"] == ""
|
||||
|
||||
# Pleroma doesn't return the application
|
||||
if status["application"]:
|
||||
assert status["application"]["name"] == CLIENT_NAME
|
||||
assert status["application"]["website"] == CLIENT_WEBSITE
|
||||
|
||||
|
||||
def test_post_visibility(app, user, run):
|
||||
for visibility in ["public", "unlisted", "private", "direct"]:
|
||||
|
@ -217,10 +218,12 @@ def test_media_attachments(app, user, run):
|
|||
|
||||
[a1, a2, a3, a4] = status["media_attachments"]
|
||||
|
||||
assert a1["meta"]["original"]["size"] == "50x50"
|
||||
assert a2["meta"]["original"]["size"] == "50x60"
|
||||
assert a3["meta"]["original"]["size"] == "50x70"
|
||||
assert a4["meta"]["original"]["size"] == "50x80"
|
||||
# Pleroma doesn't send metadata
|
||||
if "meta" in a1:
|
||||
assert a1["meta"]["original"]["size"] == "50x50"
|
||||
assert a2["meta"]["original"]["size"] == "50x60"
|
||||
assert a3["meta"]["original"]["size"] == "50x70"
|
||||
assert a4["meta"]["original"]["size"] == "50x80"
|
||||
|
||||
assert a1["description"] == "Test 1"
|
||||
assert a2["description"] == "Test 2"
|
||||
|
@ -245,8 +248,11 @@ def test_media_attachment_without_text(mock_read, mock_ml, app, user, run):
|
|||
assert status["content"] == ""
|
||||
|
||||
[attachment] = status["media_attachments"]
|
||||
assert attachment["meta"]["original"]["size"] == "50x50"
|
||||
assert attachment["description"] is None
|
||||
assert not attachment["description"]
|
||||
|
||||
# Pleroma doesn't send metadata
|
||||
if "meta" in attachment:
|
||||
assert attachment["meta"]["original"]["size"] == "50x50"
|
||||
|
||||
|
||||
def test_delete_status(app, user, run):
|
||||
|
@ -418,7 +424,7 @@ def strip_ansi(string):
|
|||
|
||||
|
||||
def _posted_status_id(out):
|
||||
pattern = re.compile(r"Toot posted: http://([^/]+)/@([^/]+)/(.+)")
|
||||
pattern = re.compile(r"Toot posted: http://([^/]+)/([^/]+)/(.+)")
|
||||
match = re.search(pattern, out)
|
||||
assert match
|
||||
|
||||
|
|
Loading…
Reference in a new issue