diff --git a/bookwyrm/connectors/openlibrary.py b/bookwyrm/connectors/openlibrary.py index 3106c8bc..728401fd 100644 --- a/bookwyrm/connectors/openlibrary.py +++ b/bookwyrm/connectors/openlibrary.py @@ -100,7 +100,7 @@ class Connector(AbstractConnector): author_blob = author_blob.get('author', author_blob) # this id is "/authors/OL1234567A" author_id = author_blob['key'] - url = '%s%s.json' % (self.base_url, author_id) + url = '%s%s' % (self.base_url, author_id) yield self.get_or_create_author(url) diff --git a/bookwyrm/tests/connectors/test_openlibrary_connector.py b/bookwyrm/tests/connectors/test_openlibrary_connector.py index 6f076bea..a9ba8eb3 100644 --- a/bookwyrm/tests/connectors/test_openlibrary_connector.py +++ b/bookwyrm/tests/connectors/test_openlibrary_connector.py @@ -92,6 +92,19 @@ class Openlibrary(TestCase): self.assertEqual(edition['key'], '/books/OL9788823M') + @responses.activate + def test_get_authors_from_data(self): + ''' find authors in data ''' + responses.add( + responses.GET, + 'https://openlibrary.org/authors/OL382982A', + json={'hi': 'there'}, + status=200) + results = self.connector.get_authors_from_data(self.work_data) + for result in results: + self.assertIsInstance(result, models.Author) + + def test_format_search_result(self): ''' translate json from openlibrary into SearchResult ''' datafile = pathlib.Path(__file__).parent.joinpath(