@@ -123,6 +123,7 @@ class TestOPDS2Importer(OPDS2Test):
123123 "urn:librarysimplified.org/terms/id/ProQuest%20Doc%20ID/181639"
124124 )
125125 BOOK_WITHOUT_AUTHOR_IDENTIFIER = "urn:isbn:9789523565593"
126+ BOOK_AUTHOR_EMPTY_STRING_IDENTIFIER = "urn:isbn:978-0-06-112008-4"
126127
127128 @pytest .mark .parametrize (
128129 "name,manifest_type" ,
@@ -164,7 +165,7 @@ def test_opds2_importer_correctly_imports_valid_opds2_feed(
164165
165166 # 1. Make sure that editions contain all required metadata
166167 assert isinstance (imported_editions , list )
167- assert 4 == len (imported_editions )
168+ assert 5 == len (imported_editions )
168169
169170 # 1.1. Edition with open-access links (Moby-Dick)
170171 moby_dick_edition = self ._get_edition_by_identifier (
@@ -258,7 +259,7 @@ def test_opds2_importer_correctly_imports_valid_opds2_feed(
258259
259260 # 2. Make sure that license pools have correct configuration
260261 assert isinstance (pools , list )
261- assert 4 == len (pools )
262+ assert 5 == len (pools )
262263
263264 # 2.1. Edition with open-access links (Moby-Dick)
264265 moby_dick_license_pool = self ._get_license_pool_by_identifier (
@@ -365,7 +366,7 @@ def test_opds2_importer_correctly_imports_valid_opds2_feed(
365366
366367 # 3. Make sure that work objects contain all the required metadata
367368 assert isinstance (works , list )
368- assert 4 == len (works )
369+ assert 5 == len (works )
369370
370371 # 3.1. Work (Moby-Dick)
371372 moby_dick_work = self ._get_work_by_identifier (
@@ -390,7 +391,7 @@ def test_opds2_importer_correctly_imports_valid_opds2_feed(
390391 == huckleberry_finn_work .summary_text
391392 )
392393
393- # 4.1 Author name is null
394+ # 4.1 Author name is null or empty string
394395 edition_author_null = self ._get_edition_by_identifier (
395396 imported_editions , self .BOOK_WITHOUT_AUTHOR_IDENTIFIER
396397 )
@@ -408,6 +409,12 @@ def test_opds2_importer_correctly_imports_valid_opds2_feed(
408409 assert isinstance (book_without_author , Work )
409410 assert "[Unknown]" == book_without_author .author
410411
412+ edition_author_empty_string = self ._get_edition_by_identifier (
413+ imported_editions , self .BOOK_AUTHOR_EMPTY_STRING_IDENTIFIER
414+ )
415+ assert isinstance (edition_author_empty_string , Edition )
416+ assert "[Unknown]" == edition_author_empty_string .author
417+
411418 @pytest .mark .parametrize (
412419 "this_identifier_type,ignore_identifier_type,identifier" ,
413420 [
@@ -473,7 +480,7 @@ def test_opds2_importer_skips_publications_with_unsupported_identifier_types(
473480 assert isinstance (imported_editions , list )
474481
475482 if this_identifier_type == IdentifierType .ISBN :
476- assert 2 == len (imported_editions )
483+ assert 3 == len (imported_editions )
477484 assert (
478485 imported_editions [0 ].primary_identifier .type
479486 == this_identifier_type .value
0 commit comments