Unify concept of absolute_id and remote_id
This commit is contained in:
parent
93493fc8e4
commit
e76f96eb6c
33 changed files with 263 additions and 236 deletions
|
@ -35,33 +35,3 @@ class Book(TestCase):
|
|||
|
||||
same_connector = books_manager.get_or_create_connector(remote_id)
|
||||
self.assertEqual(connector.identifier, same_connector.identifier)
|
||||
|
||||
|
||||
def test_get_by_absolute_id_local(self):
|
||||
abs_id = 'https://%s/book/%d' % (DOMAIN, self.work.id)
|
||||
work = books_manager.get_by_absolute_id(abs_id, models.Work)
|
||||
self.assertEqual(work, self.work)
|
||||
|
||||
work = books_manager.get_by_absolute_id(abs_id, models.Edition)
|
||||
self.assertIsNone(work)
|
||||
|
||||
|
||||
def test_get_by_absolute_id_remote(self):
|
||||
remote_work = models.Work.objects.create(
|
||||
title='Example Work',
|
||||
remote_id='https://example.com/book/123',
|
||||
)
|
||||
|
||||
abs_id = 'https://example.com/book/123'
|
||||
work = books_manager.get_by_absolute_id(abs_id, models.Work)
|
||||
self.assertEqual(work, remote_work)
|
||||
|
||||
|
||||
def test_get_by_absolute_id_invalid(self):
|
||||
abs_id = 'https://%s/book/34534623' % DOMAIN
|
||||
result = books_manager.get_by_absolute_id(abs_id, models.Work)
|
||||
self.assertIsNone(result)
|
||||
|
||||
abs_id = 'httook534623'
|
||||
result = books_manager.get_by_absolute_id(abs_id, models.Work)
|
||||
self.assertIsNone(result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue