def test_forward_relayable(self, mock_send): entity = Comment(handle=self.reply.author.handle) entity.sign_with_parent = Mock() forward_relayable(entity, self.public_content.id) mock_send.assert_called_once_with(entity, self.public_content.author, [ (settings.SOCIALHOME_RELAY_DOMAIN, "diaspora"), (self.remote_reply.author.handle, None), ])
def test_forward_relayable(self, mock_send): entity = Comment(handle=self.reply.author.handle, guid=self.reply.guid) forward_entity(entity, self.public_content.id) mock_send.assert_called_once_with(entity, self.reply.author, [ generate_diaspora_profile_id(self.remote_reply.author.handle, self.remote_reply.author.guid), generate_diaspora_profile_id(self.share.author.handle, self.share.author.guid), generate_diaspora_profile_id(self.share_reply.author.handle, self.share_reply.author.guid), ], parent_user=self.public_content.author)
def test_forward_entity(self, mock_send): entity = Comment(actor_id=self.reply.author.fid, id=self.reply.fid) forward_entity(entity, self.public_content.id) mock_send.assert_called_once_with( entity, self.reply.author.federable, [ self.remote_reply.author.handle, self.share.author.handle, self.share_reply.author.handle, ], parent_user=self.public_content.author.federable)
def test_forward_entity__limited_content(self, mock_send): entity = Comment(actor_id=self.limited_reply.author.fid, id=self.limited_reply.fid) forward_entity(entity, self.limited_content.id) mock_send.assert_called_once_with( entity, self.limited_reply.author.federable, [( self.remote_limited_reply.author.handle, self.remote_limited_reply.author.key, self.remote_limited_reply.author.guid, )], parent_user=self.limited_content.author.federable)
def test_forward_entity(self, mock_send): entity = Comment(actor_id=self.reply.author.fid, id=self.reply.fid) forward_entity(entity, self.public_content.id) expected = { self.share_reply.author.get_recipient_for_visibility(Visibility.PUBLIC)["fid"], self.remote_reply.author.get_recipient_for_visibility(Visibility.PUBLIC)["fid"], self.share.author.get_recipient_for_visibility(Visibility.PUBLIC)["fid"], } mock_send.assert_called_once_with( entity, self.reply.author.federable, ANY, parent_user=self.public_content.author.federable, ) args, kwargs = mock_send.call_args_list[0] self.assertEqual({recipient["fid"] for recipient in args[2]}, expected)
def test_forward_entity__limited_content(self, mock_send): entity = Comment(handle=self.limited_reply.author.handle, guid=self.limited_reply.guid) forward_entity(entity, self.limited_content.id) mock_send.assert_called_once_with( entity, self.limited_reply.author, [( generate_diaspora_profile_id( self.remote_limited_reply.author.handle, self.remote_limited_reply.author.guid, ), self.remote_limited_reply.author.key, )], parent_user=self.limited_content.author)
def test_returns_entity_if_outbound_doc_on_entity(self, private_key): entity = Comment() entity.outbound_doc = "foobar" assert get_outbound_entity(entity, private_key) == entity
def test_comment_is_converted_to_diasporacomment(self, private_key): entity = Comment() assert isinstance(get_outbound_entity(entity, private_key), DiasporaComment)
def test_forward_entity__limited_content(self, mock_send): entity = Comment(actor_id=self.limited_reply.author.fid, id=self.limited_reply.fid) forward_entity(entity, self.limited_content.id) mock_send.assert_called_once_with(entity, self.limited_reply.author.federable, [ self.remote_limited_reply.author.get_recipient_for_visibility(Visibility.LIMITED), ], parent_user=self.limited_content.author.federable)
def test_returns_entity_if_outbound_doc_on_entity(self, private_key, diasporacomment): entity = Comment() entity.outbound_doc = diasporacomment.to_xml() assert get_outbound_entity(entity, private_key) == entity