forked from mirrors/bookwyrm
Fixes foreign key test
This commit is contained in:
parent
aa6e312cfb
commit
f116ce378d
1 changed files with 5 additions and 2 deletions
|
@ -1,4 +1,6 @@
|
|||
''' testing models '''
|
||||
from collections import namedtuple
|
||||
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import models
|
||||
from django.test import TestCase
|
||||
|
@ -73,5 +75,6 @@ class ActivitypubFields(TestCase):
|
|||
|
||||
def test_foreign_key(self):
|
||||
instance = fields.ForeignKey('User', on_delete=models.CASCADE)
|
||||
item = namedtuple('Serializable', ('to_activity'))(lambda: {'a': 'b'})
|
||||
self.assertEqual(instance.field_to_activity(item), {'a': 'b'})
|
||||
Serializable = namedtuple('Serializable', ('to_activity', 'remote_id'))
|
||||
item = Serializable(lambda: {'a': 'b'}, 'https://e.b/c')
|
||||
self.assertEqual(instance.field_to_activity(item), 'https://e.b/c')
|
||||
|
|
Loading…
Reference in a new issue