Fixes model deduplication from data
This commit is contained in:
parent
141e7b90e8
commit
a444c5f6fc
4 changed files with 189 additions and 70 deletions
|
@ -200,3 +200,15 @@ class BaseModel(TestCase):
|
|||
# test subclass match
|
||||
result = models.Status.find_existing_by_remote_id(
|
||||
'https://comment.net')
|
||||
|
||||
|
||||
def test_find_existing(self):
|
||||
''' match a blob of data to a model '''
|
||||
book = models.Edition.objects.create(
|
||||
title='Test edition',
|
||||
openlibrary_key='OL1234',
|
||||
)
|
||||
|
||||
result = models.Edition.find_existing(
|
||||
{'openlibraryKey': 'OL1234'})
|
||||
self.assertEqual(result, book)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue