forked from mirrors/bookwyrm
More fixes for more tests
This commit is contained in:
parent
c3a09a6331
commit
8946332023
2 changed files with 16 additions and 22 deletions
|
@ -385,7 +385,7 @@ class Status(TestCase):
|
|||
user=self.local_user, notification_type="GLORB"
|
||||
)
|
||||
|
||||
def test_create_broadcast(self, _, broadcast_mock):
|
||||
def test_create_broadcast(self, broadcast_mock, *_):
|
||||
"""should send out two verions of a status on create"""
|
||||
models.Comment.objects.create(
|
||||
content="hi", user=self.local_user, book=self.book
|
||||
|
|
|
@ -8,6 +8,9 @@ from bookwyrm import models, views
|
|||
|
||||
|
||||
@patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay")
|
||||
@patch(
|
||||
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||
)
|
||||
class InteractionViews(TestCase):
|
||||
"""viewing and creating statuses"""
|
||||
|
||||
|
@ -40,7 +43,7 @@ class InteractionViews(TestCase):
|
|||
parent_work=work,
|
||||
)
|
||||
|
||||
def test_favorite(self, _):
|
||||
def test_favorite(self, *_):
|
||||
"""create and broadcast faving a status"""
|
||||
view = views.Favorite.as_view()
|
||||
request = self.factory.post("")
|
||||
|
@ -58,7 +61,7 @@ class InteractionViews(TestCase):
|
|||
self.assertEqual(notification.user, self.local_user)
|
||||
self.assertEqual(notification.related_user, self.remote_user)
|
||||
|
||||
def test_unfavorite(self, _):
|
||||
def test_unfavorite(self, *_):
|
||||
"""unfav a status"""
|
||||
view = views.Unfavorite.as_view()
|
||||
request = self.factory.post("")
|
||||
|
@ -75,7 +78,7 @@ class InteractionViews(TestCase):
|
|||
self.assertEqual(models.Favorite.objects.count(), 0)
|
||||
self.assertEqual(models.Notification.objects.count(), 0)
|
||||
|
||||
def test_boost(self, _):
|
||||
def test_boost(self, *_):
|
||||
"""boost a status"""
|
||||
view = views.Boost.as_view()
|
||||
request = self.factory.post("")
|
||||
|
@ -83,10 +86,7 @@ class InteractionViews(TestCase):
|
|||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||
|
||||
with patch(
|
||||
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||
):
|
||||
view(request, status.id)
|
||||
view(request, status.id)
|
||||
|
||||
boost = models.Boost.objects.get()
|
||||
|
||||
|
@ -100,7 +100,7 @@ class InteractionViews(TestCase):
|
|||
self.assertEqual(notification.related_user, self.remote_user)
|
||||
self.assertEqual(notification.related_status, status)
|
||||
|
||||
def test_self_boost(self, _):
|
||||
def test_self_boost(self, *_):
|
||||
"""boost your own status"""
|
||||
view = views.Boost.as_view()
|
||||
request = self.factory.post("")
|
||||
|
@ -124,7 +124,7 @@ class InteractionViews(TestCase):
|
|||
|
||||
self.assertFalse(models.Notification.objects.exists())
|
||||
|
||||
def test_boost_unlisted(self, _):
|
||||
def test_boost_unlisted(self, *_):
|
||||
"""boost a status"""
|
||||
view = views.Boost.as_view()
|
||||
request = self.factory.post("")
|
||||
|
@ -139,7 +139,7 @@ class InteractionViews(TestCase):
|
|||
boost = models.Boost.objects.get()
|
||||
self.assertEqual(boost.privacy, "unlisted")
|
||||
|
||||
def test_boost_private(self, _):
|
||||
def test_boost_private(self, *_):
|
||||
"""boost a status"""
|
||||
view = views.Boost.as_view()
|
||||
request = self.factory.post("")
|
||||
|
@ -152,7 +152,7 @@ class InteractionViews(TestCase):
|
|||
view(request, status.id)
|
||||
self.assertFalse(models.Boost.objects.exists())
|
||||
|
||||
def test_boost_twice(self, _):
|
||||
def test_boost_twice(self, *_):
|
||||
"""boost a status"""
|
||||
view = views.Boost.as_view()
|
||||
request = self.factory.post("")
|
||||
|
@ -160,24 +160,18 @@ class InteractionViews(TestCase):
|
|||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||
|
||||
with patch(
|
||||
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||
):
|
||||
view(request, status.id)
|
||||
view(request, status.id)
|
||||
view(request, status.id)
|
||||
view(request, status.id)
|
||||
self.assertEqual(models.Boost.objects.count(), 1)
|
||||
|
||||
def test_unboost(self, _):
|
||||
def test_unboost(self, *_):
|
||||
"""undo a boost"""
|
||||
view = views.Unboost.as_view()
|
||||
request = self.factory.post("")
|
||||
request.user = self.remote_user
|
||||
with patch("bookwyrm.activitystreams.ActivityStream.add_status"):
|
||||
status = models.Status.objects.create(user=self.local_user, content="hi")
|
||||
with patch(
|
||||
"bookwyrm.activitystreams.ActivityStream.remove_object_from_related_stores"
|
||||
):
|
||||
views.Boost.as_view()(request, status.id)
|
||||
views.Boost.as_view()(request, status.id)
|
||||
|
||||
self.assertEqual(models.Boost.objects.count(), 1)
|
||||
self.assertEqual(models.Notification.objects.count(), 1)
|
||||
|
|
Loading…
Reference in a new issue