kopia lustrzana https://gitlab.com/jaywink/federation
Ensure get_outbound_entity checks correctly for DiasporaRelayableMixin
rodzic
999c27cd5c
commit
ac2eddf23e
|
@ -206,7 +206,7 @@ def get_outbound_entity(entity, private_key):
|
|||
outbound = DiasporaRetraction.from_base(entity)
|
||||
if not outbound:
|
||||
raise ValueError("Don't know how to convert this base entity to Diaspora protocol entities.")
|
||||
if issubclass(cls, DiasporaRelayableMixin) and not outbound.signature:
|
||||
if isinstance(outbound, DiasporaRelayableMixin) and not outbound.signature:
|
||||
# Sign by author if not signed yet. We don't want to overwrite any existing signature in the case
|
||||
# that this is being sent by the parent author
|
||||
outbound.sign(private_key)
|
||||
|
|
|
@ -221,3 +221,9 @@ class TestGetOutboundEntity(object):
|
|||
def test_retraction_is_converted_to_diasporaretraction(self):
|
||||
entity = Retraction()
|
||||
assert isinstance(get_outbound_entity(entity, get_dummy_private_key()), DiasporaRetraction)
|
||||
|
||||
def test_signs_relayable_if_no_signature(self):
|
||||
entity = DiasporaComment()
|
||||
dummy_key = get_dummy_private_key()
|
||||
outbound = get_outbound_entity(entity, dummy_key)
|
||||
assert outbound.signature != ""
|
||||
|
|
Ładowanie…
Reference in New Issue