예제 #1
0
 def test_returns_entity_for_valid_document__post__without_activity__with_images(
         self, mock_fetch):
     entity = retrieve_and_parse_document("https://example.com/foobar")
     assert isinstance(entity, ActivitypubPost)
     assert len(entity._children) == 1
     assert entity._children[0].url == "https://files.mastodon.social/media_attachments/files/017/792/237/original" \
                                       "/foobar.jpg"
예제 #2
0
 def test_returns_entity_for_valid_document__post__wrapped_in_activity(
         self, mock_fetch):
     entity = retrieve_and_parse_document("https://example.com/foobar")
     assert isinstance(entity, ActivitypubPost)
예제 #3
0
 def test_calls_fetch_document(self, mock_fetch):
     retrieve_and_parse_document("https://example.com/foobar")
     mock_fetch.assert_called_once_with(
         "https://example.com/foobar",
         extra_headers={'accept': 'application/activity+json'},
     )
예제 #4
0
 def test_returns_entity_for_valid_document__follow(self, mock_post_receive,
                                                    mock_fetch):
     entity = retrieve_and_parse_document("https://example.com/foobar")
     assert isinstance(entity, ActivitypubFollow)
예제 #5
0
 def test_returns_none_for_invalid_document(self, mock_fetch):
     entity = retrieve_and_parse_document("https://example.com/foobar")
     assert entity is None