Skip to content

Commit

Permalink
test_bluesky: test to_as1 with image without alt text
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed May 19, 2024
1 parent 0418f80 commit 78f4147
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions granary/tests/test_bluesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit 78f4147

Please sign in to comment.