Example #1
0
 def test_send_reply_to_remote_author(self, mock_make, mock_forward,
                                      mock_sender):
     send_reply(self.reply2.id)
     mock_sender.assert_called_once_with("entity", self.reply2.author, [
         (self.remote_content.author.handle, None),
     ])
     assert mock_forward.called == 0
Example #2
0
 def test_send_reply_to_remote_author(self, mock_make, mock_forward,
                                      mock_sender):
     send_reply(self.reply2.id)
     mock_sender.assert_called_once_with(
         "entity", self.reply2.author.federable, [
             self.remote_content.author.handle,
         ])
     self.assertTrue(mock_forward.called is False)
Example #3
0
 def test_send_reply_to_remote_author(self, mock_make, mock_forward,
                                      mock_sender):
     send_reply(self.reply2.id)
     mock_sender.assert_called_once_with("entity", self.reply2.author, [
         generate_diaspora_profile_id(self.remote_content.author.handle,
                                      self.remote_content.author.guid),
     ])
     self.assertTrue(mock_forward.called is False)
Example #4
0
 def test_send_reply__to_remote_follower(self, mock_make, mock_forward, mock_sender):
     post = Post()
     mock_make.return_value = post
     send_reply(self.limited_local_reply.id, self.limited_local_reply.activities.first().fid)
     mock_sender.assert_called_once_with(post, self.limited_local_reply.author.federable, [
         self.remote_profile.get_recipient_for_visibility(self.limited_local_reply.visibility),
     ])
     self.assertTrue(mock_forward.called is False)
Example #5
0
 def test_send_reply__to_remote_author(self, mock_make, mock_forward, mock_sender):
     post = Post()
     mock_make.return_value = post
     send_reply(self.reply2.id, self.reply2.activities.first().fid)
     mock_sender.assert_called_once_with(post, self.reply2.author.federable, [
         self.remote_content.author.get_recipient_for_visibility(self.reply2.visibility),
     ], payload_logger=None)
     self.assertTrue(mock_forward.called is False)
Example #6
0
 def test_send_reply__limited_content(self, mock_make, mock_forward, mock_sender):
     post = Post()
     mock_make.return_value = post
     send_reply(self.limited_reply.id, self.limited_reply.activities.first().fid)
     mock_sender.assert_called_once_with(
         post,
         self.limited_reply.author.federable,
         [self.remote_profile.get_recipient_for_visibility(Visibility.LIMITED)],
     )
Example #7
0
 def test_send_reply__limited_content(self, mock_make, mock_forward, mock_sender):
     send_reply(self.limited_reply.id)
     mock_sender.assert_called_once_with(
         "entity",
         self.limited_reply.author.federable,
         [(
             self.remote_profile.handle,
             self.remote_profile.key,
             self.remote_profile.guid,
         )],
     )
Example #8
0
 def test_send_reply__limited_content(self, mock_make, mock_forward,
                                      mock_sender):
     send_reply(self.limited_reply.id)
     mock_sender.assert_called_once_with(
         "entity",
         self.limited_reply.author.federable,
         [(
             self.remote_profile.handle,
             self.remote_profile.key,
             self.remote_profile.guid,
         )],
     )
Example #9
0
 def test_send_reply__limited_content(self, mock_make, mock_forward,
                                      mock_sender):
     send_reply(self.limited_reply.id)
     mock_sender.assert_called_once_with(
         "entity",
         self.limited_reply.author,
         [(
             generate_diaspora_profile_id(self.remote_profile.handle,
                                          guid=self.remote_profile.guid),
             self.remote_profile.key,
         )],
     )
Example #10
0
 def test_send_reply_relaying_via_local_author(self, mock_make,
                                               mock_forward, mock_sender):
     send_reply(self.reply.id)
     mock_forward.assert_called_once_with("entity", self.public_content.id)
     self.assertTrue(mock_sender.called is False)
Example #11
0
 def test_send_reply__ignores_local_root_author(self, mock_make, mock_forward, mock_sender):
     post = Post()
     mock_make.return_value = post
     send_reply(self.reply.id, self.reply.activities.first().fid)
     self.assertTrue(mock_sender.called is False)
     self.assertTrue(mock_forward.called is False)
Example #12
0
 def test_send_reply_to_remote_author(self, mock_make, mock_forward, mock_sender):
     send_reply(self.reply2.id)
     mock_sender.assert_called_once_with("entity", self.reply2.author.federable, [
         self.remote_content.author.handle,
     ])
     self.assertTrue(mock_forward.called is False)
Example #13
0
 def test_send_reply_relaying_via_local_author(self, mock_make, mock_forward, mock_sender):
     send_reply(self.reply.id)
     mock_forward.assert_called_once_with("entity", self.public_content.id)
     self.assertTrue(mock_sender.called is False)
Example #14
0
 def test_send_reply(self, mock_sender):
     send_reply(self.reply.id)
     assert mock_sender.called == 1