From e7eca335a1ed0a247cabf8f239e71b70809d1fb6 Mon Sep 17 00:00:00 2001 From: Ryan Barrett Date: Thu, 6 Feb 2025 22:38:40 -0800 Subject: [PATCH] integration test for converting AP contentMap to HTML for #1609, snarfed/granary@dd071c857c7b29b10629d83d5b09e42da1b99c25 --- tests/test_integrations.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/test_integrations.py b/tests/test_integrations.py index fd093799..8554dc87 100644 --- a/tests/test_integrations.py +++ b/tests/test_integrations.py @@ -996,3 +996,31 @@ def test_atproto_convert_hashtag_to_activitypub_preserves_bsky_app_link(self): 'href': 'https://bsky.app/search?q=%23original', }], }, ActivityPub.convert(obj), ignore=['@context', 'attributedTo', 'to']) + + def test_atproto_convert_link_to_activitypub_contentMap(self): + obj = Object(id='at://xyz', source_protocol='atproto', bsky={ + '$type': 'app.bsky.feed.post', + 'text': 'foo bar', + 'langs': ['en'], + 'facets': [{ + '$type': 'app.bsky.richtext.facet', + 'features': [{ + '$type': 'app.bsky.richtext.facet#link', + 'uri': 'http://bar', + }], + 'index': { + 'byteStart': 4, + 'byteEnd': 7, + }, + }], + }) + self.assert_equals({ + 'type': 'Note', + 'id': 'https://bsky.brid.gy/convert/ap/at://xyz', + 'url': 'http://localhost/r/https://bsky.app/profile/xyz', + 'content': '

foo bar

', + 'contentMap': { + 'en': '

foo bar

', + }, + 'tag': [{'name': 'bar', 'type': 'Article', 'url': 'http://bar'}], + }, ActivityPub.convert(obj), ignore=['@context', 'attributedTo', 'to'])