示例#1
0
 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,
         ["*****@*****.**"],
     )
示例#2
0
 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/"],
     )
示例#3
0
 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,
         ["*****@*****.**"],
     )
示例#4
0
 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'}],
     )
示例#5
0
 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,
         )],
     )
示例#6
0
 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)],
     )
示例#7
0
 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,
     )
示例#8
0
 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,
         )],
     )
示例#9
0
 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,
         )],
     )
示例#10
0
 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)
示例#11
0
 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)
示例#12
0
 def test_content_not_sent_in_debug_mode(self, mock_send):
     send_content(self.public_content.id)
     self.assertTrue(mock_send.called is False)
示例#13
0
 def test_warning_is_logged_on_no_entity(self, mock_logger, mock_maker):
     send_content(self.public_content.id)
     self.assertTrue(mock_logger.called)
示例#14
0
 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")
示例#15
0
 def test_content_not_sent_in_debug_mode(self, mock_send):
     send_content(self.public_content.id)
     mock_send.assert_not_called()
示例#16
0
 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')])
示例#17
0
 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)
示例#18
0
 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)
示例#19
0
 def test_content_not_sent_in_debug_mode(self, mock_send):
     send_content(self.public_content.id)
     self.assertTrue(mock_send.called is False)
示例#20
0
 def test_warning_is_logged_on_no_entity(self, mock_logger, mock_maker):
     send_content(self.public_content.id)
     self.assertTrue(mock_logger.called)