takahe/tests/activities/models/test_emoji.py

45 wiersze
1.2 KiB
Python

import pytest
from activities.models import Emoji
@pytest.mark.django_db
def test_emoji_ingestion(identity):
"""
Tests that emoji ingest properly from JSON-LD
"""
emoji1 = Emoji.by_ap_tag(
identity.domain,
{
"icon": {
"type": "Image",
"url": "https://example.com/emoji/custom/emoji1.png",
"mediaType": "image/png",
},
"id": "https://example.com/emoji/custom/emoji1.png",
"name": ":emoji1:",
"type": "Emoji",
"updated": "1970-01-01T00:00:00Z",
},
create=True,
)
assert emoji1.shortcode == "emoji1"
emoji2 = Emoji.by_ap_tag(
identity.domain,
{
"icon": {
"type": "Image",
"url": "https://example.com/emoji/custom/emoji2.png",
"mediaType": "image/png",
},
"id": "https://example.com/emoji/custom/emoji2.png",
"nameMap": {"und": ":emoji2:"},
"type": "Emoji",
"updated": "1970-01-01T00:00:00Z",
},
create=True,
)
assert emoji2.shortcode == "emoji2"