The page you are looking for could not be found.
+Jean-Marie Defossez est né en 1971 ...
", - "website": "" + "website": "", } ], "media": [ @@ -179,7 +163,7 @@ def cantook_mv_record(): "id": "immateriel.frO688313-9782889055784-epub", "key": "9782889055784", "issued_on": "2019-04-30T06:00:00+02:00", - "current_holds": 0 + "current_holds": 0, }, { "nature": "paper", @@ -187,44 +171,28 @@ def cantook_mv_record(): "id": "immateriel.frO688313-9782889119714-paper", "key": "9782889119714", "issued_on": None, - "current_holds": 0 - } + "current_holds": 0, + }, ], "id": "immateriel.frO688313", - "link": "http://mediatheque-valais.cantookstation.eu/resources/" + - "5b18c6bc235794540e2cbe72", + "link": "http://mediatheque-valais.cantookstation.eu/resources/" + + "5b18c6bc235794540e2cbe72", "created_at": "2018-06-07T07:46:36+02:00", "updated_at": "2019-04-21T07:47:19+02:00", "publisher_name": "Jouvence", "classifications": [ { "standard": "bisac", - "identifiers": [ - "SEL000000" - ], - "captions": [ - { - "fr": None, - "en": None - } - ] + "identifiers": ["SEL000000"], + "captions": [{"fr": None, "en": None}], }, { "standard": "cantook", - "identifiers": [ - "self-help", - "health" - ], + "identifiers": ["self-help", "health"], "captions": [ - { - "fr": "Croissance personnelle", - "en": "Self-Help" - }, - { - "fr": "Santé", - "en": "Health" - } - ] + {"fr": "Croissance personnelle", "en": "Self-Help"}, + {"fr": "Santé", "en": "Health"}, + ], }, { "standard": "feedbooks", @@ -232,29 +200,15 @@ def cantook_mv_record(): "FBSEL000000", "FBHEA014000", "FBNFC000000", - "FBHEA000000" + "FBHEA000000", ], "captions": [ - { - "fr": "Développement Personnel", - "en": "Self-help" - }, - { - "fr": "Bien-être", - "en": "Well being" - }, - { - "fr": "Documentaires", - "en": "Non-Fiction" - }, - { - "fr": "Santé & Vie quotidienne", - "en": "Health & fitness" - } - ] - } + {"fr": "Développement Personnel", "en": "Self-help"}, + {"fr": "Bien-être", "en": "Well being"}, + {"fr": "Documentaires", "en": "Non-Fiction"}, + {"fr": "Santé & Vie quotidienne", "en": "Health & fitness"}, + ], + }, ], - "publisher": { - "name": "Jouvence" - } + "publisher": {"name": "Jouvence"}, } diff --git a/tests/api/test_api.py b/tests/api/test_api.py index 752d789..238a56b 100644 --- a/tests/api/test_api.py +++ b/tests/api/test_api.py @@ -27,87 +27,90 @@ def test_merge_and_remove_uri_records(es, db, cdf_record, mv_record): """Test merge ebook records.""" cover = "http://images.immateriel.fr/covers/X8WRJB3.png" - cdf = 'http://la-chaux-de-fonds.ebibliomedia.ch/resources/'\ - '5788be89dde6b2d458f42b35' + cdf = ( + "http://la-chaux-de-fonds.ebibliomedia.ch/resources/" "5788be89dde6b2d458f42b35" + ) - mv = 'http://mediatheque-valais.ebibliomedia.ch/resources/'\ - '5788be89dde6b2d458f42b35' + mv = ( + "http://mediatheque-valais.ebibliomedia.ch/resources/" + "5788be89dde6b2d458f42b35" + ) orig_mv_record = deepcopy(mv_record) orig_cdf_record = deepcopy(cdf_record) - cdf_record_pid = build_ebook_pid(cdf_record, 'cantook') + cdf_record_pid = build_ebook_pid(cdf_record, "cantook") cdf_record_exists = Ebook.get_record_by_pid(cdf_record_pid) assert cdf_record_exists is None new_cdf_record, cdf_status = Ebook.create_or_update( - cdf_record, vendor='cantook', dbcommit=True, reindex=True + cdf_record, vendor="cantook", dbcommit=True, reindex=True ) - assert cdf_status == 'CREATE' - assert new_cdf_record['electronic_location_and_access'][0][ - 'uniform_resource_identifier' + assert cdf_status == "CREATE" + assert new_cdf_record["electronic_location_and_access"][0][ + "uniform_resource_identifier" ] merged_record, merged_record_status = Ebook.create_or_update( - mv_record, vendor='cantook', dbcommit=True, reindex=True + mv_record, vendor="cantook", dbcommit=True, reindex=True ) - assert merged_record_status == 'UPDATE' - ela = merged_record['electronic_location_and_access'] + assert merged_record_status == "UPDATE" + ela = merged_record["electronic_location_and_access"] assert len(ela) == 3 - assert mv == ela[0]['uniform_resource_identifier'] - assert cover == ela[1]['uniform_resource_identifier'] - assert cdf == ela[2]['uniform_resource_identifier'] + assert mv == ela[0]["uniform_resource_identifier"] + assert cover == ela[1]["uniform_resource_identifier"] + assert cdf == ela[2]["uniform_resource_identifier"] removed_uri_record, removed_uri_record_status = Ebook.remove_uri( orig_mv_record, - vendor='cantook', - url='http://mediatheque-valais.ebibliomedia.ch', + vendor="cantook", + url="http://mediatheque-valais.ebibliomedia.ch", dbcommit=True, - reindex=True + reindex=True, ) - ela = removed_uri_record['electronic_location_and_access'] + ela = removed_uri_record["electronic_location_and_access"] assert len(ela) == 2 - assert removed_uri_record_status == 'REMOVE URIs: 1' - assert cover == ela[0]['uniform_resource_identifier'] - assert cdf == ela[1]['uniform_resource_identifier'] + assert removed_uri_record_status == "REMOVE URIs: 1" + assert cover == ela[0]["uniform_resource_identifier"] + assert cdf == ela[1]["uniform_resource_identifier"] removed_uri_record, removed_uri_record_status = Ebook.remove_uri( orig_cdf_record, - vendor='cantook', - url='http://la-chaux-de-fonds.ebibliomedia.ch', + vendor="cantook", + url="http://la-chaux-de-fonds.ebibliomedia.ch", dbcommit=True, - reindex=True + reindex=True, ) - ela = removed_uri_record['electronic_location_and_access'] + ela = removed_uri_record["electronic_location_and_access"] assert len(ela) == 1 - assert removed_uri_record_status == 'REMOVE URIs: 1' - assert cover == ela[0]['uniform_resource_identifier'] + assert removed_uri_record_status == "REMOVE URIs: 1" + assert cover == ela[0]["uniform_resource_identifier"] def test_merge_records_same(es, db, cdf_record, dojson_like_cdf_record): """Test merge ebook records.""" - cdf_record_pid = build_ebook_pid(cdf_record, 'cantook') + cdf_record_pid = build_ebook_pid(cdf_record, "cantook") new_cdf_record, cdf_status = Ebook.create_or_update( - cdf_record, vendor='cantook', dbcommit=True, reindex=True + cdf_record, vendor="cantook", dbcommit=True, reindex=True ) merged_record, merged_record_status = Ebook.create_or_update( - dojson_like_cdf_record, vendor='cantook', dbcommit=True, reindex=True + dojson_like_cdf_record, vendor="cantook", dbcommit=True, reindex=True ) - assert merged_record_status == 'UPDATE' - ela = merged_record['electronic_location_and_access'] + assert merged_record_status == "UPDATE" + ela = merged_record["electronic_location_and_access"] assert len(ela) == 2 def test_create_or_update_record(db, cdf_record): """Test create record.""" - record = Ebook.get_record_by_pid('cantook-5788be89dde6b2d458f42b35') + record = Ebook.get_record_by_pid("cantook-5788be89dde6b2d458f42b35") assert record is None new_record, status = Ebook.create_or_update( - cdf_record, vendor='cantook', dbcommit=True, reindex=True + cdf_record, vendor="cantook", dbcommit=True, reindex=True ) - assert status == 'CREATE' - record = Ebook.get_record_by_pid('cantook-5788be89dde6b2d458f42b35') - assert record['pid'] == 'cantook-5788be89dde6b2d458f42b35' - record['title'] = 'The Nest' + assert status == "CREATE" + record = Ebook.get_record_by_pid("cantook-5788be89dde6b2d458f42b35") + assert record["pid"] == "cantook-5788be89dde6b2d458f42b35" + record["title"] = "The Nest" mod_record, status = Ebook.create_or_update( - record, vendor='cantook', dbcommit=True, reindex=True + record, vendor="cantook", dbcommit=True, reindex=True ) - assert status == 'UPDATE' + assert status == "UPDATE" diff --git a/tests/api/test_cantook.py b/tests/api/test_cantook.py index 6325d60..629e34f 100644 --- a/tests/api/test_cantook.py +++ b/tests/api/test_cantook.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see