Don't broadcast from inbox tests

This commit is contained in:
Mouse Reeve 2021-02-17 14:37:20 -08:00
parent 3f02b5f6f2
commit e707374888
2 changed files with 13 additions and 14 deletions

View file

@ -5,7 +5,8 @@ from django.db.models import Q
from django.dispatch import receiver
from bookwyrm import activitypub
from .activitypub_mixin import ActivitypubMixin, ActivityMixin, generate_activity
from .activitypub_mixin import ActivitypubMixin, ActivityMixin
from .activitypub_mixin import generate_activity
from .base_model import BookWyrmModel
from . import fields
@ -143,14 +144,15 @@ class UserFollowRequest(ActivitypubMixin, UserRelationship):
def reject(self):
''' generate a Reject for this follow request '''
user = self.user_object
activity = activitypub.Reject(
id=self.get_remote_id(status='rejects'),
actor=self.user_object.remote_id,
object=self.to_activity()
).serialize()
if self.user_object.local:
activity = activitypub.Reject(
id=self.get_remote_id(status='rejects'),
actor=self.user_object.remote_id,
object=self.to_activity()
).serialize()
self.broadcast(activity, self.user_object)
self.delete()
self.broadcast(activity, user)
class UserBlocks(ActivityMixin, UserRelationship):

View file

@ -379,11 +379,8 @@ class Inbox(TestCase):
views.inbox.activity_task(activity)
# request should be deleted
self.assertEqual(models.UserFollowRequest.objects.count(), 0)
# relationship should be created
follows = self.remote_user.followers
self.assertEqual(follows.count(), 0)
self.assertFalse(models.UserFollowRequest.objects.exists())
self.assertFalse(self.remote_user.followers.exists())
def test_handle_update_list(self):
@ -580,7 +577,7 @@ class Inbox(TestCase):
'object': {
'type': 'Announce',
'id': boost.remote_id,
'actor': self.local_user.remote_id,
'actor': self.remote_user.remote_id,
'object': self.status.remote_id,
}
}