# HG changeset patch # User Ludovic Chabant # Date 1681933790 25200 # Node ID 53de06c2f97d4ce8763561004bf97819aa562d32 # Parent 20d4cf433704332d9b423114d957615229ce6955 Fix Mastodon tests, add some logging for media attachments diff -r 20d4cf433704 -r 53de06c2f97d silorider/silos/mastodon.py --- 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) diff -r 20d4cf433704 -r 53de06c2f97d tests/test_silos_mastodon.py --- 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( """

This is another link: http://example.org/blah

-permalink""")) # NOQA +permalink""")) # 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( """

This is yet another link

-permalink""")) # NOQA +permalink""")) # NOQA cli.setFeedConfig('feed', feed) ctx, _ = cli.run('process') toot = ctx.silos[0].client.toots[0]