diff --git a/bookwyrm/tests/connectors/test_abstract_connector.py b/bookwyrm/tests/connectors/test_abstract_connector.py index f05645ab..d6e02960 100644 --- a/bookwyrm/tests/connectors/test_abstract_connector.py +++ b/bookwyrm/tests/connectors/test_abstract_connector.py @@ -30,10 +30,10 @@ class AbstractConnector(TestCase): 'series': ['one', 'two'], } self.connector.key_mappings = [ - Mapping('isbn_10', model=models.Edition), + Mapping('isbn_10'), Mapping('isbn_13'), - Mapping('lccn', model=models.Work), - Mapping('asin', remote_field='ASIN'), + Mapping('lccn'), + Mapping('asin'), ] @@ -41,7 +41,6 @@ class AbstractConnector(TestCase): mapping = Mapping('isbn') self.assertEqual(mapping.local_field, 'isbn') self.assertEqual(mapping.remote_field, 'isbn') - self.assertEqual(mapping.model, None) self.assertEqual(mapping.formatter('bb'), 'bb') @@ -49,7 +48,6 @@ class AbstractConnector(TestCase): mapping = Mapping('isbn', remote_field='isbn13') self.assertEqual(mapping.local_field, 'isbn') self.assertEqual(mapping.remote_field, 'isbn13') - self.assertEqual(mapping.model, None) self.assertEqual(mapping.formatter('bb'), 'bb') @@ -59,40 +57,4 @@ class AbstractConnector(TestCase): self.assertEqual(mapping.local_field, 'isbn') self.assertEqual(mapping.remote_field, 'isbn') self.assertEqual(mapping.formatter, formatter) - self.assertEqual(mapping.model, None) self.assertEqual(mapping.formatter('bb'), 'aabb') - - - def test_match_from_mappings(self): - edition = models.Edition.objects.create( - title='Blah', - isbn_13='blahhh', - ) - match = self.connector.match_from_mappings(self.data, models.Edition) - self.assertEqual(match, edition) - - - def test_match_from_mappings_with_model(self): - edition = models.Edition.objects.create( - title='Blah', - isbn_10='1234567890', - ) - match = self.connector.match_from_mappings(self.data, models.Edition) - self.assertEqual(match, edition) - - - def test_match_from_mappings_with_remote(self): - edition = models.Edition.objects.create( - title='Blah', - asin='A00BLAH', - ) - match = self.connector.match_from_mappings(self.data, models.Edition) - self.assertEqual(match, edition) - - - def test_match_from_mappings_no_match(self): - edition = models.Edition.objects.create( - title='Blah', - ) - match = self.connector.match_from_mappings(self.data, models.Edition) - self.assertEqual(match, None) diff --git a/bookwyrm/tests/connectors/test_openlibrary_connector.py b/bookwyrm/tests/connectors/test_openlibrary_connector.py index 4a2bc6ea..b3d97ba3 100644 --- a/bookwyrm/tests/connectors/test_openlibrary_connector.py +++ b/bookwyrm/tests/connectors/test_openlibrary_connector.py @@ -1,15 +1,16 @@ ''' testing book data connectors ''' -from dateutil import parser -from django.test import TestCase import json import pathlib +from dateutil import parser +from django.test import TestCase import pytz from bookwyrm import models from bookwyrm.connectors.openlibrary import Connector from bookwyrm.connectors.openlibrary import get_languages, get_description -from bookwyrm.connectors.openlibrary import pick_default_edition, get_openlibrary_key -from bookwyrm.connectors.abstract_connector import SearchResult, get_date +from bookwyrm.connectors.openlibrary import pick_default_edition, \ + get_openlibrary_key +from bookwyrm.connectors.abstract_connector import SearchResult class Openlibrary(TestCase): @@ -67,12 +68,6 @@ class Openlibrary(TestCase): self.assertEqual(description, expected) - def test_get_date(self): - date = get_date(self.work_data['first_publish_date']) - expected = pytz.utc.localize(parser.parse('1995')) - self.assertEqual(date, expected) - - def test_get_languages(self): languages = get_languages(self.edition_data['languages']) self.assertEqual(languages, ['English']) @@ -81,4 +76,3 @@ class Openlibrary(TestCase): def test_get_ol_key(self): key = get_openlibrary_key('/books/OL27320736M') self.assertEqual(key, 'OL27320736M') -