diff tests/test_silos_twitter.py @ 25:fb93d3fbff4e

Support transforming twitter profile URLs into mentions.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 08 Sep 2019 16:11:26 -0700
parents a921cc2306bc
children 9e4eb3f2754e
line wrap: on
line diff
--- a/tests/test_silos_twitter.py	Sun Sep 08 16:09:40 2019 -0700
+++ b/tests/test_silos_twitter.py	Sun Sep 08 16:11:26 2019 -0700
@@ -37,6 +37,23 @@
     assert toot == ("This is a quick update.", [])
 
 
+def test_one_micropost_with_mention(cli, feedutil, tweetmock):
+    feed = cli.createTempFeed(feedutil.makeFeed(
+        """<p class="p-name">Hey <a href="https://twitter.com/jack">Jacky</a>
+you should fix your stuff!</p>
+<a class="u-url" href="/01234.html">permalink</a>"""
+    ))
+
+    cli.appendSiloConfig('test', 'twitter', url='/blah')
+    cli.setFeedConfig('feed', feed)
+    tweetmock.installTokens(cli, 'test')
+
+    ctx, _ = cli.run('process')
+    assert ctx.cache.wasPosted('test', '/01234.html')
+    toot = ctx.silos[0].client.tweets[0]
+    assert toot == ("Hey @jack you should fix your stuff!", [])
+
+
 def test_one_micropost_with_one_photo(cli, feedutil, tweetmock, monkeypatch):
     feed = cli.createTempFeed(feedutil.makeFeed(
         """<p class="p-name">This is a quick photo update.</p>