mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-30 05:21:08 +00:00
Checks activity type in view test
This commit is contained in:
parent
4d7364d045
commit
e2d394d894
1 changed files with 4 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
||||||
""" test for app action functionality """
|
""" test for app action functionality """
|
||||||
|
import json
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from django.contrib.auth.models import Group, Permission
|
from django.contrib.auth.models import Group, Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
@ -117,6 +119,8 @@ class BookViews(TestCase):
|
||||||
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") as mock:
|
with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") as mock:
|
||||||
views.unfollow(request)
|
views.unfollow(request)
|
||||||
self.assertEqual(mock.call_count, 1)
|
self.assertEqual(mock.call_count, 1)
|
||||||
|
activity = json.loads(mock.call_args_list[0][0][1])
|
||||||
|
self.assertEqual(activity["type"], "Undo")
|
||||||
|
|
||||||
self.assertEqual(self.remote_user.followers.count(), 0)
|
self.assertEqual(self.remote_user.followers.count(), 0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue