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 '''
|
''' testing book data connectors '''
|
||||||
|
from unittest.mock import patch
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
import responses
|
import responses
|
||||||
|
|
||||||
|
@ -104,8 +105,10 @@ class AbstractConnector(TestCase):
|
||||||
'https://example.com/book/abcd',
|
'https://example.com/book/abcd',
|
||||||
json=self.edition_data
|
json=self.edition_data
|
||||||
)
|
)
|
||||||
result = self.connector.get_or_create_book(
|
with patch(
|
||||||
'https://example.com/book/abcd')
|
'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(result, self.book)
|
||||||
self.assertEqual(models.Edition.objects.count(), 1)
|
self.assertEqual(models.Edition.objects.count(), 1)
|
||||||
self.assertEqual(models.Edition.objects.count(), 1)
|
self.assertEqual(models.Edition.objects.count(), 1)
|
||||||
|
|
|
@ -165,9 +165,11 @@ class ImportJob(TestCase):
|
||||||
status=200)
|
status=200)
|
||||||
|
|
||||||
with patch(
|
with patch(
|
||||||
'bookwyrm.connectors.connector_manager.first_search_result'
|
'bookwyrm.connectors.abstract_connector.load_more_data.delay'):
|
||||||
) as search:
|
with patch(
|
||||||
search.return_value = result
|
'bookwyrm.connectors.connector_manager.first_search_result'
|
||||||
book = self.item_1.get_book_from_isbn()
|
) as search:
|
||||||
|
search.return_value = result
|
||||||
|
book = self.item_1.get_book_from_isbn()
|
||||||
|
|
||||||
self.assertEqual(book.title, 'Sabriel')
|
self.assertEqual(book.title, 'Sabriel')
|
||||||
|
|
Loading…
Reference in a new issue