kopia lustrzana https://gitlab.com/jaywink/federation
fix a few tests. update changelog
rodzic
267c2c3f0d
commit
bdf914ee23
|
@ -13,6 +13,10 @@
|
|||
* GET requests are now signed if the django configuration includes FEDERATION_USER which is used to fetch that
|
||||
user's private key.
|
||||
|
||||
* Added Video and Audio objects.
|
||||
|
||||
* Process Activitypub reply collections.
|
||||
|
||||
### Fixed
|
||||
|
||||
* Signatures are not verified and the corresponding payload is dropped is no public key is found.
|
||||
|
|
|
@ -943,7 +943,7 @@ def model_to_objects(payload):
|
|||
try:
|
||||
entity = model.schema().load(payload)
|
||||
except (KeyError, jsonld.JsonLdError, exceptions.ValidationError) as exc : # Just give up for now. This must be made robust
|
||||
logger.warning(f"Error parsing jsonld payload ({exc})")
|
||||
logger.error(f"Error parsing jsonld payload ({exc})")
|
||||
return None
|
||||
|
||||
if isinstance(getattr(entity, 'object_', None), Object):
|
||||
|
|
|
@ -127,7 +127,8 @@ class TestActivitypubEntityMappersReceive:
|
|||
assert len(entities) == 1
|
||||
post = entities[0]
|
||||
assert isinstance(post, ActivitypubPost)
|
||||
assert len(post._children) == 1
|
||||
# TODO: test video and audio attachment
|
||||
assert len(post._children) == 2
|
||||
photo = post._children[0]
|
||||
assert isinstance(photo, Image)
|
||||
assert photo.url == "https://files.mastodon.social/media_attachments/files/017/642/079/original/" \
|
||||
|
@ -270,6 +271,8 @@ class TestActivitypubEntityMappersReceive:
|
|||
entities = message_to_objects(ACTIVITYPUB_PROFILE, "http://example.com/1234")
|
||||
assert entities[0]._source_protocol == "activitypub"
|
||||
|
||||
@pytest.mark.skip
|
||||
# since calamus turns the whole payload into objects, the source payload is not kept
|
||||
def test_source_object(self):
|
||||
entities = message_to_objects(ACTIVITYPUB_PROFILE, "http://example.com/1234")
|
||||
entity = entities[0]
|
||||
|
|
|
@ -47,7 +47,7 @@ class TestRetrieveAndParseDocument:
|
|||
# auth argument is passed with kwargs
|
||||
auth = mock_fetch.call_args.kwargs.get('auth', None)
|
||||
mock_fetch.assert_called_once_with(
|
||||
"https://example.com/foobar", extra_headers={'accept': 'application/activity+json'}, auth=auth,
|
||||
"https://example.com/foobar", cache=True, extra_headers={'accept': 'application/activity+json'}, auth=auth,
|
||||
)
|
||||
|
||||
@patch("federation.utils.activitypub.fetch_document", autospec=True, return_value=(
|
||||
|
|
|
@ -127,7 +127,7 @@ class TestRetrieveAndParseContent:
|
|||
@patch("federation.utils.diaspora.get_fetch_content_endpoint", return_value="https://example.com/fetch/spam/eggs")
|
||||
def test_calls_fetch_document(self, mock_get, mock_fetch):
|
||||
retrieve_and_parse_content(id="eggs", guid="eggs", handle="user@example.com", entity_type="spam")
|
||||
mock_fetch.assert_called_once_with("https://example.com/fetch/spam/eggs")
|
||||
mock_fetch.assert_called_once_with("https://example.com/fetch/spam/eggs", cache=True)
|
||||
|
||||
@patch("federation.utils.diaspora.fetch_document", return_value=(None, 404, None))
|
||||
@patch("federation.utils.diaspora.get_fetch_content_endpoint")
|
||||
|
|
Ładowanie…
Reference in New Issue