Updates tests

This commit is contained in:
Mouse Reeve 2021-09-06 12:30:11 -07:00
parent cb21099e0b
commit 8382d1a684
2 changed files with 12 additions and 1 deletions

View file

@ -135,6 +135,7 @@ class InboxActivities(TestCase):
book_list = models.List.objects.create( book_list = models.List.objects.create(
name="test list", name="test list",
user=self.remote_user, user=self.remote_user,
remote_id="https://example.com/list/1",
) )
activity = { activity = {
"@context": "https://www.w3.org/ns/activitystreams", "@context": "https://www.w3.org/ns/activitystreams",
@ -142,7 +143,16 @@ class InboxActivities(TestCase):
"type": "Delete", "type": "Delete",
"actor": "https://example.com/users/test-user", "actor": "https://example.com/users/test-user",
"to": ["https://www.w3.org/ns/activitystreams#Public"], "to": ["https://www.w3.org/ns/activitystreams#Public"],
"object": {"id": book_list.remote_id, "type": "List"} "object": {
"id": book_list.remote_id,
"owner": self.remote_user.remote_id,
"type": "BookList",
"totalItems": 0,
"first": "",
"name": "test list",
"to": [],
"cc": [],
},
} }
views.inbox.activity_task(activity) views.inbox.activity_task(activity)
self.assertFalse(models.List.objects.exists()) self.assertFalse(models.List.objects.exists())

View file

@ -91,6 +91,7 @@ class ListActionViews(TestCase):
self.assertEqual(activity["type"], "Delete") self.assertEqual(activity["type"], "Delete")
self.assertEqual(activity["actor"], self.local_user.remote_id) self.assertEqual(activity["actor"], self.local_user.remote_id)
self.assertEqual(activity["object"]["id"], self.list.remote_id) self.assertEqual(activity["object"]["id"], self.list.remote_id)
self.assertEqual(activity["object"]["type"], "BookList")
self.assertEqual(mock.call_count, 1) self.assertEqual(mock.call_count, 1)
self.assertFalse(models.List.objects.exists()) self.assertFalse(models.List.objects.exists())