Exemple #1
0
 def test_deletes_content(self):
     process_entity_retraction(
         Mock(entity_type="Post",
              target_guid=self.content.guid,
              handle=self.content.author.handle), self.content.author)
     with self.assertRaises(Content.DoesNotExist):
         Content.objects.get(id=self.content.id)
Exemple #2
0
 def test_deletes_content__share(self):
     process_entity_retraction(
         Mock(entity_type="Share",
              target_id=self.share.fid,
              actor_id=self.share.author.fid), self.share.author)
     with self.assertRaises(Content.DoesNotExist):
         Content.objects.get(id=self.share.id)
 def test_deletes_content(self):
     process_entity_retraction(
         Mock(entity_type="Post", target_id=self.content.fid, actor_id=self.content.author.fid),
         self.content.author
     )
     with self.assertRaises(Content.DoesNotExist):
         Content.objects.get(id=self.content.id)
Exemple #4
0
 def test_does_nothing_if_content_is_not_local(self, mock_logger):
     process_entity_retraction(
         Mock(entity_type="Post", target_id=self.local_content.fid), Mock())
     mock_logger.assert_called_with(
         "Retracted remote content %s cannot be found",
         self.local_content.fid,
     )
Exemple #5
0
 def test_does_nothing_if_content_doesnt_exist(self, mock_logger):
     process_entity_retraction(
         Mock(entity_type="Post", target_id="https://example.com/notfound"),
         Mock())
     mock_logger.assert_called_with(
         "Retracted remote content %s cannot be found",
         "https://example.com/notfound")
Exemple #6
0
 def test_does_nothing_if_content_is_not_local(self, mock_logger):
     content = LocalContentFactory()
     process_entity_retraction(
         Mock(entity_type="Post", target_guid=content.guid), Mock())
     mock_logger.assert_called_with(
         "Local content %s cannot be retracted by a remote retraction!",
         content)
 def test_removes_follower(self):
     self.remote_profile.following.add(self.profile)
     process_entity_retraction(
         base.Retraction(entity_type="Profile", _receiving_guid=self.profile.guid),
         self.remote_profile,
     )
     self.assertEqual(self.remote_profile.following.count(), 0)
Exemple #8
0
 def test_does_nothing_if_content_author_is_not_same_as_remote_profile(
         self, mock_logger):
     remote_profile = Mock()
     process_entity_retraction(
         Mock(entity_type="Post", target_guid=self.content.guid),
         remote_profile)
     mock_logger.assert_called_with(
         "Content %s is not owned by remote retraction profile %s",
         self.content, remote_profile)
Exemple #9
0
 def test_non_post_entity_types_are_skipped(self, mock_logger):
     process_entity_retraction(Mock(entity_type="foo"), Mock())
     mock_logger.assert_called_with("Ignoring retraction of entity_type %s",
                                    "foo")
 def test_does_nothing_if_content_author_is_not_same_as_remote_profile(self, mock_logger):
     remote_profile = Mock()
     process_entity_retraction(Mock(entity_type="Post", target_id=self.content.fid), remote_profile)
     mock_logger.assert_called_with(
         "Content %s is not owned by remote retraction profile %s", self.content, remote_profile
     )
 def test_does_nothing_if_content_is_not_local(self, mock_logger):
     process_entity_retraction(Mock(entity_type="Post", target_id=self.local_content.fid), Mock())
     mock_logger.assert_called_with(
         "Retracted remote content %s cannot be found", self.local_content.fid,
     )
 def test_does_nothing_if_content_doesnt_exist(self, mock_logger):
     process_entity_retraction(Mock(entity_type="Post", target_id="https://example.com/notfound"), Mock())
     mock_logger.assert_called_with("Retracted remote content %s cannot be found", "https://example.com/notfound")
 def test_non_post_entity_types_are_skipped(self, mock_logger):
     process_entity_retraction(Mock(entity_type="foo"), Mock())
     mock_logger.assert_called_with("Ignoring retraction of entity_type %s", "foo")
Exemple #14
0
 def test_does_nothing_if_content_doesnt_exist(self, mock_logger):
     process_entity_retraction(Mock(entity_type="Post", target_guid="bar"),
                               Mock())
     mock_logger.assert_called_with("Retracted content %s cannot be found",
                                    "bar")