def test_handle_send_is_called(self, mock_make, mock_send):
     send_profile_retraction(self.public_profile)
     mock_send.assert_called_once_with(
         "entity",
         self.public_profile,
         ['diaspora://[email protected]/profile/'],
     )
Exemple #2
0
def federate_profile_retraction(instance, **kwargs):
    """Send out local profile retractions to the federation layer."""
    if instance.is_local:
        logger.debug('federate_profile_retraction: Got local profile %s delete, sending out retraction', instance)
        try:
            # Don't enqueue, we must complete this before doing the delete
            send_profile_retraction(instance)
        except Exception as ex:
            logger.exception("Failed to federate_profile_retraction %s: %s", instance, ex)
Exemple #3
0
 def test_limited_profile_retraction_not_sent_to_relay(self, mock_make, mock_send):
     send_profile_retraction(self.limited_profile)
     mock_send.assert_called_once_with(
         "entity",
         self.limited_profile.federable,
         [
             self.remote_profile.get_recipient_for_visibility(Visibility.LIMITED),
         ],
     )
Exemple #4
0
 def test_limited_profile_retraction_not_sent_to_relay(self, mock_make, mock_send):
     send_profile_retraction(self.limited_profile)
     mock_send.assert_called_once_with(
         "entity",
         self.limited_profile.federable,
         [
             self.remote_profile.handle,
         ],
     )
Exemple #5
0
 def test_handle_send_is_called(self, mock_make, mock_send):
     send_profile_retraction(self.public_profile)
     mock_send.assert_called_once_with(
         "entity",
         self.public_profile.federable,
         [
             self.remote_profile.get_recipient_for_visibility(Visibility.PUBLIC),
         ],
     )
Exemple #6
0
 def test_limited_profile_retraction_not_sent_to_relay(
         self, mock_make, mock_send):
     send_profile_retraction(self.limited_profile)
     mock_send.assert_called_once_with(
         "entity",
         self.limited_profile.federable,
         [
             self.remote_profile.handle,
         ],
     )
Exemple #7
0
 def test_handle_send_is_called(self, mock_make, mock_send):
     send_profile_retraction(self.public_profile)
     mock_send.assert_called_once_with(
         "entity",
         self.public_profile.federable,
         [
             '*****@*****.**',
             self.remote_profile.handle,
         ],
     )
Exemple #8
0
 def test_handle_send_is_called(self, mock_make, mock_send):
     send_profile_retraction(self.public_profile)
     mock_send.assert_called_once_with(
         "entity",
         self.public_profile.federable,
         [
             '*****@*****.**',
             self.remote_profile.handle,
         ],
     )
Exemple #9
0
 def test_limited_profile_retraction_not_sent_to_relay(
         self, mock_make, mock_send):
     send_profile_retraction(self.limited_profile)
     mock_send.assert_called_once_with(
         "entity",
         self.limited_profile,
         [
             generate_diaspora_profile_id(self.remote_profile.handle,
                                          self.remote_profile.guid),
         ],
     )
Exemple #10
0
def federate_profile_retraction(instance, **kwargs):
    """Send out local profile retractions to the federation layer."""
    if instance.is_local:
        logger.debug(
            'federate_profile_retraction: Got local profile %s delete, sending out retraction',
            instance)
        try:
            # Don't enqueue, we must complete this before doing the delete
            send_profile_retraction(instance)
        except Exception as ex:
            logger.exception("Failed to federate_profile_retraction %s: %s",
                             instance, ex)
Exemple #11
0
 def test_non_public_or_limited_profile_does_not_get_sent(
         self, mock_make, mock_send):
     send_profile_retraction(self.profile)
     self.assertTrue(mock_send.called is False)
Exemple #12
0
 def test_non_local_profile_does_not_get_sent(self, mock_make, mock_send):
     send_profile_retraction(self.remote_profile)
     self.assertTrue(mock_send.called is False)
Exemple #13
0
 def test_get_remote_followers_is_called(self, mock_followers, mock_make,
                                         mock_send):
     send_profile_retraction(self.public_profile)
     mock_followers.assert_called_once_with(self.public_profile)
Exemple #14
0
 def test_non_public_or_limited_profile_does_not_get_sent(self, mock_make, mock_send):
     send_profile_retraction(self.profile)
     self.assertTrue(mock_send.called is False)
Exemple #15
0
 def test_non_local_profile_does_not_get_sent(self, mock_make, mock_send):
     send_profile_retraction(self.remote_profile)
     self.assertTrue(mock_send.called is False)
Exemple #16
0
 def test_get_remote_followers_is_called(self, mock_followers, mock_make, mock_send):
     send_profile_retraction(self.public_profile)
     mock_followers.assert_called_once_with(self.public_profile)