Fixes outgoing test users

This commit is contained in:
Mouse Reeve 2021-01-04 10:20:49 -08:00
parent 15b9f62136
commit 4090b336db
2 changed files with 9 additions and 5 deletions

View file

@ -19,7 +19,7 @@ class Incoming(TestCase):
def setUp(self): def setUp(self):
''' we need basic things, like users ''' ''' we need basic things, like users '''
self.local_user = models.User.objects.create_user( self.local_user = models.User.objects.create_user(
'mouse', 'mouse@mouse.com', 'mouseword', 'mouse@example.com', 'mouse@mouse.com', 'mouseword',
local=True, localname='mouse') local=True, localname='mouse')
self.local_user.remote_id = 'https://example.com/user/mouse' self.local_user.remote_id = 'https://example.com/user/mouse'
self.local_user.save() self.local_user.save()
@ -495,6 +495,8 @@ class Incoming(TestCase):
incoming.handle_update_user({'object': userdata}) incoming.handle_update_user({'object': userdata})
user = models.User.objects.get(id=self.local_user.id) user = models.User.objects.get(id=self.local_user.id)
self.assertEqual(user.name, 'MOUSE?? MOUSE!!') self.assertEqual(user.name, 'MOUSE?? MOUSE!!')
self.assertEqual(user.username, 'mouse@example.com')
self.assertEqual(user.localname, 'mouse')
def test_handle_update_edition(self): def test_handle_update_edition(self):

View file

@ -21,14 +21,14 @@ class Outgoing(TestCase):
self.factory = RequestFactory() self.factory = RequestFactory()
with patch('bookwyrm.models.user.set_remote_server'): with patch('bookwyrm.models.user.set_remote_server'):
self.remote_user = models.User.objects.create_user( self.remote_user = models.User.objects.create_user(
'rat', 'rat@rat.com', 'ratword', 'rat', 'rat@email.com', 'ratword',
local=False, local=False,
remote_id='https://example.com/users/rat', remote_id='https://example.com/users/rat',
inbox='https://example.com/users/rat/inbox', inbox='https://example.com/users/rat/inbox',
outbox='https://example.com/users/rat/outbox', outbox='https://example.com/users/rat/outbox',
) )
self.local_user = models.User.objects.create_user( self.local_user = models.User.objects.create_user(
'mouse', 'mouse@mouse.com', 'mouseword', 'mouse@local.com', 'mouse@mouse.com', 'mouseword',
local=True, localname='mouse', local=True, localname='mouse',
remote_id='https://example.com/users/mouse', remote_id='https://example.com/users/mouse',
) )
@ -399,7 +399,8 @@ class Outgoing(TestCase):
def test_handle_status_mentions(self): def test_handle_status_mentions(self):
''' @mention a user in a post ''' ''' @mention a user in a post '''
user = models.User.objects.create_user( user = models.User.objects.create_user(
'rat', 'rat@rat.com', 'password', local=True) 'rat@local.com', 'rat@rat.com', 'password',
local=True, localname='rat')
form = forms.CommentForm({ form = forms.CommentForm({
'content': 'hi @rat', 'content': 'hi @rat',
'user': self.local_user.id, 'user': self.local_user.id,
@ -419,7 +420,8 @@ class Outgoing(TestCase):
def test_handle_status_reply_with_mentions(self): def test_handle_status_reply_with_mentions(self):
''' reply to a post with an @mention'ed user ''' ''' reply to a post with an @mention'ed user '''
user = models.User.objects.create_user( user = models.User.objects.create_user(
'rat', 'rat@rat.com', 'password', local=True) 'rat@local.com', 'rat@rat.com', 'password',
local=True, localname='rat')
form = forms.CommentForm({ form = forms.CommentForm({
'content': 'hi @rat@example.com', 'content': 'hi @rat@example.com',
'user': self.local_user.id, 'user': self.local_user.id,