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

View file

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