From e2d394d89477626290f7c274734f4f5c16012e6d Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 13 Mar 2021 15:04:23 -0800 Subject: [PATCH] Checks activity type in view test --- bookwyrm/tests/views/test_follow.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bookwyrm/tests/views/test_follow.py b/bookwyrm/tests/views/test_follow.py index 67ac0f0b..6b4de05d 100644 --- a/bookwyrm/tests/views/test_follow.py +++ b/bookwyrm/tests/views/test_follow.py @@ -1,5 +1,7 @@ """ test for app action functionality """ +import json from unittest.mock import patch + from django.contrib.auth.models import Group, Permission from django.contrib.contenttypes.models import ContentType from django.test import TestCase @@ -117,6 +119,8 @@ class BookViews(TestCase): with patch("bookwyrm.models.activitypub_mixin.broadcast_task.delay") as mock: views.unfollow(request) 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)