From 311b9113eb7a909f6dc92025ead00e4dcad002be Mon Sep 17 00:00:00 2001 From: Joel Auterson Date: Sat, 21 Oct 2023 23:41:54 +0100 Subject: [PATCH] Add test for include_shares --- granary/tests/test_bluesky.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/granary/tests/test_bluesky.py b/granary/tests/test_bluesky.py index ef2a58b2..08ecabfb 100644 --- a/granary/tests/test_bluesky.py +++ b/granary/tests/test_bluesky.py @@ -253,6 +253,12 @@ }, 'object': POST_AUTHOR_PROFILE_AS['object'], } +REPOST_PROFILE_AS = copy.deepcopy(REPOST_AS) +REPOST_PROFILE_AS['actor'].update({ + 'username': 'bob.com', + 'url': 'https://bsky.app/profile/bob.com', +}) + REPOST_BSKY = { '$type': 'app.bsky.feed.repost', 'subject': { @@ -948,6 +954,18 @@ def test_get_activities_with_reposts(self, mock_get): }, ) + @patch('requests.get') + def test_get_activities_include_shares(self, mock_get): + mock_get.return_value = requests_response({ + 'cursor': 'timestamp::cid', + 'feed': [POST_FEED_VIEW_BSKY, REPOST_BSKY_FEED_VIEW_POST], + }) + + self.assert_equals( + [POST_AUTHOR_PROFILE_AS, REPOST_PROFILE_AS], + self.bs.get_activities(include_shares=True) + ) + @patch('requests.get') def test_get_comment(self, mock_get):