Mercurial > silorider
changeset 30:53de06c2f97d
Fix Mastodon tests, add some logging for media attachments
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 19 Apr 2023 12:49:50 -0700 |
parents | 20d4cf433704 |
children | 6a014f7c6eea |
files | silorider/silos/mastodon.py tests/test_silos_mastodon.py |
diffstat | 2 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/silorider/silos/mastodon.py Wed Apr 19 12:48:58 2023 -0700 +++ b/silorider/silos/mastodon.py Wed Apr 19 12:49:50 2023 -0700 @@ -126,7 +126,10 @@ toottxt = self.formatEntry(entry, limit=500) logger.info("Toot would be:") logger.info(toottxt) + media_urls = entry.get('photo', [], force_list=True) + if media_urls: + logger.info("...with photos: %s" % str(media_urls)) def _media_callback(self, tmpfile, mt): with open(tmpfile, 'rb') as tmpfp: - return self.client.media_post(tmpfp, mt) + return self.client.media_post(tmpfp, mime_type=mt)
--- a/tests/test_silos_mastodon.py Wed Apr 19 12:48:58 2023 -0700 +++ b/tests/test_silos_mastodon.py Wed Apr 19 12:49:50 2023 -0700 @@ -110,7 +110,7 @@ feed = cli.createTempFeed(feedutil.makeFeed( """<p class="e-content">This is another link: <a href="http://example.org/blah">http://example.org/blah</a></p> -<a class="u-uri" href="/01234.html">permalink</a>""")) # NOQA +<a class="u-url" href="/01234.html">permalink</a>""")) # NOQA cli.setFeedConfig('feed', feed) ctx, _ = cli.run('process') toot = ctx.silos[0].client.toots[0] @@ -118,7 +118,7 @@ feed = cli.createTempFeed(feedutil.makeFeed( """<p class="e-content">This is yet <a href="http://example.org/blah">another link</a></p> -<a class="u-uri" href="/01234.html">permalink</a>""")) # NOQA +<a class="u-url" href="/01234.html">permalink</a>""")) # NOQA cli.setFeedConfig('feed', feed) ctx, _ = cli.run('process') toot = ctx.silos[0].client.toots[0]