Mercurial > silorider
comparison tests/test_silos_bluesky.py @ 74:08ee3ffbe508
Fix Bluesky formatting for posts too long, or with a link
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 10 Aug 2024 21:19:23 -0700 |
parents | dafbbf25bfc8 |
children |
comparison
equal
deleted
inserted
replaced
73:63bb8d716204 | 74:08ee3ffbe508 |
---|---|
140 post = ctx.silos[0].client.posts[0] | 140 post = ctx.silos[0].client.posts[0] |
141 assert post[0] == "This is yet another link" # NOQA | 141 assert post[0] == "This is yet another link" # NOQA |
142 facet = _make_link_facet('http://example.org/blah', 12, 24) | 142 facet = _make_link_facet('http://example.org/blah', 12, 24) |
143 assert post[2] == [facet] | 143 assert post[2] == [facet] |
144 | 144 |
145 | |
146 def test_one_micropost_too_long(cli, feedutil, bskymock): | |
147 cli.appendSiloConfig('test', 'bluesky') | |
148 bskymock.installCredentials(cli, 'test') | |
149 | |
150 feed = cli.createTempFeed(feedutil.makeFeed( | |
151 """<p class="p-name">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum</p> | |
152 <a class="u-url" href="/01234.html">permalink</a>""")) | |
153 | |
154 cli.setFeedConfig('feed', feed) | |
155 ctx, _ = cli.run('process') | |
156 post = ctx.silos[0].client.posts[0] | |
157 assert post[0] == "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate... /01234.html" | |
145 | 158 |
146 def _make_link_facet(url, start, end): | 159 def _make_link_facet(url, start, end): |
147 return atprotomodels.AppBskyRichtextFacet.Main( | 160 return atprotomodels.AppBskyRichtextFacet.Main( |
148 features=[atprotomodels.AppBskyRichtextFacet.Link(uri=url)], | 161 features=[atprotomodels.AppBskyRichtextFacet.Link(uri=url)], |
149 index=atprotomodels.AppBskyRichtextFacet.ByteSlice( | 162 index=atprotomodels.AppBskyRichtextFacet.ByteSlice( |