def test_handle_send_is_called(self, mock_maker, mock_send): send_content(self.public_content.id) mock_send.assert_called_once_with( "entity", self.public_content.author.federable, ["*****@*****.**"], )
def test_handle_send_is_called(self, mock_maker, mock_send): send_content(self.public_content.id) mock_send.assert_called_once_with( "entity", self.public_content.author, ["diaspora://[email protected]/profile/"], )
def test_handle_send_is_called(self, mock_maker, mock_send): send_content(self.public_content.id) mock_send.assert_called_once_with( "entity", self.public_content.author.federable, ["*****@*****.**"], )
def test_handle_send_is_called(self, mock_maker, mock_send): post = Post() mock_maker.return_value = post send_content(self.public_content.id, self.public_content.activities.first().fid) mock_send.assert_called_once_with( post, self.public_content.author.federable, [{'endpoint': 'https://relay.iliketoast.net/receive/public', 'fid': '', 'public': True, 'protocol': 'diaspora'}], )
def test_handle_send_is_called__limited_content(self, mock_maker, mock_send): send_content(self.limited_content.id, recipient_id=self.remote_profile.id) mock_send.assert_called_once_with( "entity", self.limited_content.author.federable, [( self.remote_profile.handle, self.remote_profile.key, self.remote_profile.guid, )], )
def test_handle_send_is_called__limited_content(self, mock_maker, mock_send): post = Post() mock_maker.return_value = post send_content( self.limited_content.id, self.limited_content.activities.first().fid, recipient_id=self.remote_profile.id, ) mock_send.assert_called_once_with( post, self.limited_content.author.federable, [self.remote_profile.get_recipient_for_visibility(Visibility.LIMITED)], )
def test_handle_send_is_called(self, mock_maker, mock_send): post = Post() mock_maker.return_value = post send_content(self.public_content.id, self.public_content.activities.first().fid) mock_send.assert_called_once_with( post, self.public_content.author.federable, [ {'endpoint': 'https://matrix.127.0.0.1:8000', 'fid': self.public_content.author.mxid, 'public': True, 'protocol': 'matrix'}, ], payload_logger=None, )
def test_handle_send_is_called__limited_content(self, mock_maker, mock_send): send_content(self.limited_content.id, recipient_id=self.remote_profile.id) mock_send.assert_called_once_with( "entity", self.limited_content.author, [( generate_diaspora_profile_id(self.remote_profile.handle, guid=self.remote_profile.guid), self.remote_profile.key, )], )
def test_handle_send_is_called__limited_content(self, mock_maker, mock_send): send_content(self.limited_content.id, recipient_id=self.remote_profile.id) mock_send.assert_called_once_with( "entity", self.limited_content.author.federable, [( self.remote_profile.handle, self.remote_profile.key, self.remote_profile.guid, )], )
def test_only_limited_and_public_content_calls_make_federable_content(self, mock_maker): send_content(self.self_content.id) self.assertTrue(mock_maker.called is False) send_content(self.site_content.id) self.assertTrue(mock_maker.called is False) send_content(self.limited_content.id) mock_maker.assert_called_once_with(self.limited_content) mock_maker.reset_mock() send_content(self.public_content.id) mock_maker.assert_called_once_with(self.public_content)
def test_only_limited_and_public_content_calls_make_federable_content(self, mock_maker): send_content(self.self_content.id, "foo") self.assertTrue(mock_maker.called is False) send_content(self.site_content.id, "foo") self.assertTrue(mock_maker.called is False) send_content(self.limited_content.id, self.limited_content.activities.first().fid) mock_maker.assert_called_once_with(self.limited_content) mock_maker.reset_mock() send_content(self.public_content.id, self.public_content.activities.first().fid) mock_maker.assert_called_once_with(self.public_content)
def test_content_not_sent_in_debug_mode(self, mock_send): send_content(self.public_content.id) self.assertTrue(mock_send.called is False)
def test_warning_is_logged_on_no_entity(self, mock_logger, mock_maker): send_content(self.public_content.id) self.assertTrue(mock_logger.called)
def test_send_document_is_called(self, mock_sender, mock_payloader): send_content(self.public_content.id) url = "https://%s/receive/public" % settings.SOCIALHOME_RELAY_DOMAIN mock_sender.assert_called_once_with(url, "payload")
def test_content_not_sent_in_debug_mode(self, mock_send): send_content(self.public_content.id) mock_send.assert_not_called()
def test_handle_send_is_called(self, mock_maker, mock_send): send_content(self.public_content.id) mock_send.assert_called_once_with( "entity", self.public_content.author, [('relay.iliketoast.net', 'diaspora')])
def test_only_public_content_calls_make_federable_content( self, mock_maker): send_content(self.limited_content.id) mock_maker.assert_not_called() send_content(self.public_content.id) mock_maker.assert_called_once_with(self.public_content)
def test_handle_create_payload_is_called(self, mock_maker, mock_sender, mock_handler): send_content(self.public_content.id) mock_handler.assert_called_once_with("entity", self.public_content.author)
def test_content_not_sent_in_debug_mode(self, mock_send): send_content(self.public_content.id) self.assertTrue(mock_send.called is False)
def test_warning_is_logged_on_no_entity(self, mock_logger, mock_maker): send_content(self.public_content.id) self.assertTrue(mock_logger.called)