mirror of
https://github.com/ihabunek/toot.git
synced 2025-10-21 19:44:16 -04:00
Fix several tests when running on Pleroma
This commit is contained in:
@@ -25,7 +25,6 @@ from os import path
|
|||||||
from toot import CLIENT_NAME, CLIENT_WEBSITE, api, App, User
|
from toot import CLIENT_NAME, CLIENT_WEBSITE, api, App, User
|
||||||
from toot.console import run_command
|
from toot.console import run_command
|
||||||
from toot.exceptions import ConsoleError, NotFoundError
|
from toot.exceptions import ConsoleError, NotFoundError
|
||||||
from toot.tui.utils import parse_datetime
|
|
||||||
from toot.utils import get_text
|
from toot.utils import get_text
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
@@ -131,13 +130,15 @@ def test_post(app, user, run):
|
|||||||
|
|
||||||
status = api.fetch_status(app, user, status_id)
|
status = api.fetch_status(app, user, status_id)
|
||||||
assert text == get_text(status["content"])
|
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["visibility"] == "public"
|
||||||
assert status["sensitive"] is False
|
assert status["sensitive"] is False
|
||||||
assert status["spoiler_text"] == ""
|
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):
|
def test_post_visibility(app, user, run):
|
||||||
for visibility in ["public", "unlisted", "private", "direct"]:
|
for visibility in ["public", "unlisted", "private", "direct"]:
|
||||||
@@ -217,6 +218,8 @@ def test_media_attachments(app, user, run):
|
|||||||
|
|
||||||
[a1, a2, a3, a4] = status["media_attachments"]
|
[a1, a2, a3, a4] = status["media_attachments"]
|
||||||
|
|
||||||
|
# Pleroma doesn't send metadata
|
||||||
|
if "meta" in a1:
|
||||||
assert a1["meta"]["original"]["size"] == "50x50"
|
assert a1["meta"]["original"]["size"] == "50x50"
|
||||||
assert a2["meta"]["original"]["size"] == "50x60"
|
assert a2["meta"]["original"]["size"] == "50x60"
|
||||||
assert a3["meta"]["original"]["size"] == "50x70"
|
assert a3["meta"]["original"]["size"] == "50x70"
|
||||||
@@ -245,8 +248,11 @@ def test_media_attachment_without_text(mock_read, mock_ml, app, user, run):
|
|||||||
assert status["content"] == ""
|
assert status["content"] == ""
|
||||||
|
|
||||||
[attachment] = status["media_attachments"]
|
[attachment] = status["media_attachments"]
|
||||||
|
assert not attachment["description"]
|
||||||
|
|
||||||
|
# Pleroma doesn't send metadata
|
||||||
|
if "meta" in attachment:
|
||||||
assert attachment["meta"]["original"]["size"] == "50x50"
|
assert attachment["meta"]["original"]["size"] == "50x50"
|
||||||
assert attachment["description"] is None
|
|
||||||
|
|
||||||
|
|
||||||
def test_delete_status(app, user, run):
|
def test_delete_status(app, user, run):
|
||||||
@@ -418,7 +424,7 @@ def strip_ansi(string):
|
|||||||
|
|
||||||
|
|
||||||
def _posted_status_id(out):
|
def _posted_status_id(out):
|
||||||
pattern = re.compile(r"Toot posted: http://([^/]+)/@([^/]+)/(.+)")
|
pattern = re.compile(r"Toot posted: http://([^/]+)/([^/]+)/(.+)")
|
||||||
match = re.search(pattern, out)
|
match = re.search(pattern, out)
|
||||||
assert match
|
assert match
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user