forked from mirrors/bookwyrm
Patches celery calls in connector tests
This commit is contained in:
parent
86060f795d
commit
1e7aa283c2
2 changed files with 11 additions and 6 deletions
|
@ -1,4 +1,5 @@
|
|||
''' testing book data connectors '''
|
||||
from unittest.mock import patch
|
||||
from django.test import TestCase
|
||||
import responses
|
||||
|
||||
|
@ -104,8 +105,10 @@ class AbstractConnector(TestCase):
|
|||
'https://example.com/book/abcd',
|
||||
json=self.edition_data
|
||||
)
|
||||
result = self.connector.get_or_create_book(
|
||||
'https://example.com/book/abcd')
|
||||
with patch(
|
||||
'bookwyrm.connectors.abstract_connector.load_more_data.delay'):
|
||||
result = self.connector.get_or_create_book(
|
||||
'https://example.com/book/abcd')
|
||||
self.assertEqual(result, self.book)
|
||||
self.assertEqual(models.Edition.objects.count(), 1)
|
||||
self.assertEqual(models.Edition.objects.count(), 1)
|
||||
|
|
|
@ -165,9 +165,11 @@ class ImportJob(TestCase):
|
|||
status=200)
|
||||
|
||||
with patch(
|
||||
'bookwyrm.connectors.connector_manager.first_search_result'
|
||||
) as search:
|
||||
search.return_value = result
|
||||
book = self.item_1.get_book_from_isbn()
|
||||
'bookwyrm.connectors.abstract_connector.load_more_data.delay'):
|
||||
with patch(
|
||||
'bookwyrm.connectors.connector_manager.first_search_result'
|
||||
) as search:
|
||||
search.return_value = result
|
||||
book = self.item_1.get_book_from_isbn()
|
||||
|
||||
self.assertEqual(book.title, 'Sabriel')
|
||||
|
|
Loading…
Reference in a new issue