diff --git a/federation/entities/diaspora/utils.py b/federation/entities/diaspora/utils.py index 5126680..929cdc9 100644 --- a/federation/entities/diaspora/utils.py +++ b/federation/entities/diaspora/utils.py @@ -49,16 +49,16 @@ def get_base_attributes(entity): return attributes -def get_full_xml_representation(entity, author): +def get_full_xml_representation(entity, private_key): """Get full XML representation of an entity. This contains the .. wrapper. Accepts either a Base entity or a Diaspora entity. - Author must have `private_key` that is used in signing certain entities. + Author `private_key` must be given so that certain entities can be signed. """ from federation.entities.diaspora.mappers import get_outbound_entity - diaspora_entity = get_outbound_entity(entity, author.private_key) + diaspora_entity = get_outbound_entity(entity, private_key) xml = diaspora_entity.to_xml() return "%s" % etree.tostring(xml).decode("utf-8") diff --git a/federation/tests/entities/diaspora/test_utils.py b/federation/tests/entities/diaspora/test_utils.py index 445555c..e111325 100644 --- a/federation/tests/entities/diaspora/test_utils.py +++ b/federation/tests/entities/diaspora/test_utils.py @@ -1,6 +1,5 @@ import datetime import re -from unittest.mock import Mock import arrow @@ -21,7 +20,7 @@ class TestGetBaseAttributes(): class TestGetFullXMLRepresentation(): def test_returns_xml_document(self): entity = Post() - document = get_full_xml_representation(entity, Mock(private_key="")) + document = get_full_xml_representation(entity, "") document = re.sub(r".*", "", document) # Dates are annoying to compare assert document == "" \ "false" \