Fixes model deduplication from data

This commit is contained in:
Mouse Reeve
2020-12-31 12:22:00 -08:00
parent 141e7b90e8
commit a444c5f6fc
4 changed files with 189 additions and 70 deletions

View File

@ -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)