mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-23 01:51:08 +00:00
Adds test for delete activity
This commit is contained in:
parent
cad19ee878
commit
94e95dc39d
1 changed files with 6 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
||||||
''' test for app action functionality '''
|
''' test for app action functionality '''
|
||||||
|
import json
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.test.client import RequestFactory
|
from django.test.client import RequestFactory
|
||||||
|
@ -236,7 +237,11 @@ class StatusViews(TestCase):
|
||||||
self.assertFalse(status.deleted)
|
self.assertFalse(status.deleted)
|
||||||
request = self.factory.post('')
|
request = self.factory.post('')
|
||||||
request.user = self.local_user
|
request.user = self.local_user
|
||||||
with patch('bookwyrm.models.activitypub_mixin.broadcast_task.delay'):
|
with patch('bookwyrm.models.activitypub_mixin.broadcast_task.delay') \
|
||||||
|
as mock:
|
||||||
view(request, status.id)
|
view(request, status.id)
|
||||||
|
activity = json.loads(mock.call_args_list[0][0][1])
|
||||||
|
self.assertEqual(activity['type'], 'Delete')
|
||||||
|
self.assertEqual(activity['object']['type'], 'Tombstone')
|
||||||
status.refresh_from_db()
|
status.refresh_from_db()
|
||||||
self.assertTrue(status.deleted)
|
self.assertTrue(status.deleted)
|
||||||
|
|
Loading…
Reference in a new issue