From 78f4147cb89fcf7b56bdbf0e396f739626e39e22 Mon Sep 17 00:00:00 2001 From: Ryan Barrett Date: Sun, 19 May 2024 14:22:37 -0700 Subject: [PATCH] test_bluesky: test to_as1 with image without alt text for snarfed/bridgy-fed#1000 --- granary/tests/test_bluesky.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/granary/tests/test_bluesky.py b/granary/tests/test_bluesky.py index 58d1ba99..ccde1d88 100644 --- a/granary/tests/test_bluesky.py +++ b/granary/tests/test_bluesky.py @@ -1428,6 +1428,20 @@ def test_to_as1_post_with_image_repo_did(self): 'author': 'did:plc:foo', }), to_as1(POST_BSKY_IMAGES, repo_did='did:plc:foo')) + def test_to_as1_post_with_image_blank_alt_text(self): + record = copy.deepcopy(POST_BSKY_IMAGES) + record['embed']['images'][0]['alt'] = '' + + expected = { + **POST_AS_IMAGES['object'], + 'author': 'did:plc:foo', + 'id': None, + 'url': None, + 'image': ['https://bsky.social/xrpc/com.atproto.sync.getBlob?did=did:plc:foo&cid=bafkreim'], + } + + self.assert_equals(trim_nulls(expected), to_as1(record, repo_did='did:plc:foo')) + def test_to_as1_post_view_with_image(self): self.assert_equals(POST_AS_IMAGES['object'], to_as1(POST_VIEW_BSKY_IMAGES))