Add a test for statusless posts

pull/677/head
Jamie Bliss 2023-12-07 17:24:41 +00:00
rodzic fd6842aa87
commit 126129d681
Nie znaleziono w bazie danych klucza dla tego podpisu
1 zmienionych plików z 26 dodań i 0 usunięć

Wyświetl plik

@ -56,6 +56,32 @@ def test_post_status(api_client, identity):
assert response.status_code == 404
@pytest.mark.django_db
def test_post_statusless(api_client, identity):
"""
Tests we can post with media but no status
"""
# Create media attachment
attachment = PostAttachment.objects.create(
mimetype="image/webp",
name=None,
state=PostAttachmentStates.fetched,
author=identity,
)
# Post new one
response = api_client.post(
"/api/v1/statuses",
content_type="application/json",
data={
"media_ids": [attachment.id],
},
)
assert 200 <= response.status_code < 300
body = response.json()
assert body["content"] == "<p></p>"
assert body["media_attachments"][0]["description"] is None
@pytest.mark.django_db
def test_mention_format(api_client, identity, remote_identity):
"""