forked from mirrors/bookwyrm
Test absolute id for model with user
This commit is contained in:
parent
c401d537f2
commit
93493fc8e4
1 changed files with 12 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
''' testing models '''
|
||||
from django.test import TestCase
|
||||
|
||||
from fedireads import models
|
||||
from fedireads.models.base_model import FedireadsModel
|
||||
from fedireads.settings import DOMAIN
|
||||
|
||||
|
@ -17,3 +18,14 @@ class BaseModel(TestCase):
|
|||
instance.remote_id = 'boop doop'
|
||||
expected = instance.absolute_id
|
||||
self.assertEqual(expected, 'boop doop')
|
||||
|
||||
def test_absolute_id_with_user(self):
|
||||
user = models.User.objects.create_user(
|
||||
'mouse', 'mouse@mouse.com', 'mouseword')
|
||||
instance = FedireadsModel()
|
||||
instance.user = user
|
||||
instance.id = 1
|
||||
expected = instance.absolute_id
|
||||
self.assertEqual(
|
||||
expected,
|
||||
'https://%s/user/mouse/fedireadsmodel/1' % DOMAIN)
|
||||
|
|
Loading…
Reference in a new issue