mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 11:31:08 +00:00
Patches celery call in field tests and fixes tag field
This commit is contained in:
parent
0a576c325c
commit
d0c1a68df6
2 changed files with 10 additions and 4 deletions
|
@ -179,6 +179,8 @@ class TagField(ManyToManyField):
|
|||
return tags
|
||||
|
||||
def field_from_activity(self, value):
|
||||
if not isinstance(value, list):
|
||||
return None
|
||||
items = []
|
||||
for link_json in value:
|
||||
link = activitypub.Link(**link_json)
|
||||
|
|
|
@ -4,6 +4,7 @@ from collections import namedtuple
|
|||
import json
|
||||
import pathlib
|
||||
import re
|
||||
from unittest.mock import patch
|
||||
|
||||
from PIL import Image
|
||||
import responses
|
||||
|
@ -113,7 +114,9 @@ class ActivitypubFields(TestCase):
|
|||
'https://example.com/user/mouse',
|
||||
json=userdata,
|
||||
status=200)
|
||||
value = instance.field_from_activity('https://example.com/user/mouse')
|
||||
with patch('bookwyrm.models.user.set_remote_server.delay'):
|
||||
value = instance.field_from_activity(
|
||||
'https://example.com/user/mouse')
|
||||
|
||||
# test recieving activity json
|
||||
value = instance.field_from_activity(userdata)
|
||||
|
@ -173,6 +176,7 @@ class ActivitypubFields(TestCase):
|
|||
'https://example.com/user/mouse',
|
||||
json=userdata,
|
||||
status=200)
|
||||
with patch('bookwyrm.models.user.set_remote_server.delay'):
|
||||
value = instance.field_from_activity(
|
||||
['https://example.com/user/mouse', 'bleh']
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue