Skip to content

Commit

Permalink
add rss.from_activities() test for repost header
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Apr 18, 2023
1 parent 5ae5d2a commit 33e0a90
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions granary/tests/test_rss.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,37 @@ def test_from_activities_hashtag(self):
}], feed_url='http://this')
self.assertNotIn(field, got)

def test_from_activities_share_string_object(self):
def test_from_activities_share_string_object_with_content(self):
got = rss.from_activities([{
'objectType': 'activity',
'verb': 'share',
'object': 'https://fireburn.ru/posts/1617172734',
'content': 'foo bar',
}], feed_url='http://this')
# TODO: finish implementing reposts in rss
self.assertIn('foo bar', got)

def test_from_activities_share_string_object(self):
got = rss.from_activities([{
'objectType': 'activity',
'verb': 'share',
'object': {
'author': {
'objectType': 'person',
'displayName': 'Bob',
'url': 'http://example.com/bob',
},
'content': 'The original post',
'url': 'http://example.com/original/post',
'objectType': 'article',
},
}], feed_url='http://this')
self.assert_multiline_in("""
<description><![CDATA[Shared <a href="http://example.com/original/post">a post</a> by <span class="h-card">
<a class="p-name u-url" href="http://example.com/bob">Bob</a>
</span>
The original post]]></description>
""", got, ignore_blanks=True)

def test_item_with_two_enclosures(self):
got = rss.from_activities([{
'attachments': [{
Expand Down

0 comments on commit 33e0a90

Please sign in to comment.