mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-17 21:56:36 +00:00
Set user default values
This commit is contained in:
parent
1e675384bc
commit
9c4fd1e602
2 changed files with 6 additions and 4 deletions
|
@ -275,10 +275,11 @@ class User(OrderedCollectionPageMixin, AbstractUser):
|
|||
return
|
||||
|
||||
# populate fields for local users
|
||||
self.remote_id = "%s/user/%s" % (site_link(), self.localname)
|
||||
self.inbox = "%s/inbox" % self.remote_id
|
||||
self.shared_inbox = "%s/inbox" % site_link()
|
||||
self.outbox = "%s/outbox" % self.remote_id
|
||||
self.remote_id = "{:s}/user/{:s}".format(site_link(), self.localname)
|
||||
self.followers_url = "{:s}/followers".format(self.remote_id)
|
||||
self.inbox = "{:s}/inbox".format(self.remote_id)
|
||||
self.shared_inbox = "{:s}/inbox".format(site_link())
|
||||
self.outbox = "{:s}/outbox".format(self.remote_id)
|
||||
|
||||
# an id needs to be set before we can proceed with related models
|
||||
super().save(*args, **kwargs)
|
||||
|
|
|
@ -32,6 +32,7 @@ class User(TestCase):
|
|||
self.assertEqual(self.user.shared_inbox, f"{self.protocol}{DOMAIN}/inbox")
|
||||
self.assertEqual(self.user.inbox, f"{expected_id}/inbox")
|
||||
self.assertEqual(self.user.outbox, f"{expected_id}/outbox")
|
||||
self.assertEqual(self.user.followers_url, f"{expected_id}/followers")
|
||||
self.assertIsNotNone(self.user.key_pair.private_key)
|
||||
self.assertIsNotNone(self.user.key_pair.public_key)
|
||||
|
||||
|
|
Loading…
Reference in a new issue