forked from mirrors/bookwyrm
Removes update user test
This commit is contained in:
parent
27c45c0584
commit
bbbfbe721e
2 changed files with 0 additions and 55 deletions
|
@ -75,24 +75,3 @@ class IncomingFollow(TestCase):
|
||||||
# the follow relationship should not exist
|
# the follow relationship should not exist
|
||||||
follow = models.UserFollows.objects.all()
|
follow = models.UserFollows.objects.all()
|
||||||
self.assertEqual(list(follow), [])
|
self.assertEqual(list(follow), [])
|
||||||
|
|
||||||
|
|
||||||
def test_nonexistent_user_follow(self):
|
|
||||||
activity = {
|
|
||||||
"@context": "https://www.w3.org/ns/activitystreams",
|
|
||||||
"id": "https://example.com/users/rat/follows/123",
|
|
||||||
"type": "Follow",
|
|
||||||
"actor": "https://example.com/users/rat",
|
|
||||||
"object": "http://local.com/user/nonexistent-user"
|
|
||||||
}
|
|
||||||
|
|
||||||
with patch('bookwyrm.broadcast.broadcast_task.delay') as _:
|
|
||||||
incoming.handle_follow(activity)
|
|
||||||
|
|
||||||
# do nothing
|
|
||||||
notifications = models.Notification.objects.all()
|
|
||||||
self.assertEqual(list(notifications), [])
|
|
||||||
requests = models.UserFollowRequest.objects.all()
|
|
||||||
self.assertEqual(list(requests), [])
|
|
||||||
follows = models.UserFollows.objects.all()
|
|
||||||
self.assertEqual(list(follows), [])
|
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
''' when a remote user changes their profile '''
|
|
||||||
import json
|
|
||||||
import pathlib
|
|
||||||
from unittest.mock import patch
|
|
||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
from bookwyrm import models, incoming
|
|
||||||
|
|
||||||
|
|
||||||
class UpdateUser(TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
with patch('bookwyrm.models.user.set_remote_server.delay'):
|
|
||||||
with patch('bookwyrm.models.user.get_remote_reviews.delay'):
|
|
||||||
self.user = models.User.objects.create_user(
|
|
||||||
'mouse', 'mouse@mouse.com', 'mouseword',
|
|
||||||
remote_id='https://example.com/user/mouse',
|
|
||||||
local=False,
|
|
||||||
localname='mouse'
|
|
||||||
)
|
|
||||||
|
|
||||||
datafile = pathlib.Path(__file__).parent.joinpath(
|
|
||||||
'../data/ap_user.json'
|
|
||||||
)
|
|
||||||
self.user_data = json.loads(datafile.read_bytes())
|
|
||||||
|
|
||||||
def test_handle_update_user(self):
|
|
||||||
self.assertIsNone(self.user.name)
|
|
||||||
self.assertEqual(self.user.localname, 'mouse')
|
|
||||||
|
|
||||||
incoming.handle_update_user({'object': self.user_data})
|
|
||||||
self.user = models.User.objects.get(id=self.user.id)
|
|
||||||
|
|
||||||
self.assertEqual(self.user.name, 'MOUSE?? MOUSE!!')
|
|
||||||
self.assertEqual(self.user.localname, 'mouse')
|
|
Loading…
Reference in a new issue