def test_sets_id(self): """sets 'id' equal to 'Item ARK'/'ark_ssi'""" result = feed_ursus.map_record( {"Item ARK": "ark:/123/abc"}, config=self.CONFIG, ) assert result["id"] == "ark:/123/abc"
def test_sets_iiif_manifest_url(self): """sets a IIIF manifest URL based on the ARK""" result = feed_ursus.map_record( {"Item ARK": "ark:/123/abc"}, config=self.CONFIG, ) assert (result["iiif_manifest_url_ssi"] == "https://iiif.library.ucla.edu/ark%3A%2F123%2Fabc/manifest")
def test_sets_access(self): """sets permissive values for blacklight-access-control""" result = feed_ursus.map_record( {"Item ARK": "ark:/123/abc"}, self.solr_client, config=self.CONFIG, ) assert result["discover_access_group_ssim"] == ["public"] assert result["read_access_group_ssim"] == ["public"] assert result["download_access_person_ssim"] == ["public"]
def test_sets_facet_fields(self, column_name, facet_field_name): """Copies *_tesim to *_sim fields for facets""" value = "value aksjg" result = feed_ursus.map_record( {"Item ARK": "ark:/123/abc", column_name: value}, self.solr_client, config=self.CONFIG, ) assert result[facet_field_name] == [value]
def test_maps_record(self, monkeypatch): """maps the record for Ursus""" monkeypatch.setattr( feed_ursus.mapper, "FIELD_MAPPING", { "id": lambda r: r["Item ARK"], "test_ursus_field_tesim": "Test DLCS Field", }, ) result = feed_ursus.map_record( {"Item ARK": "ark:/123/abc", "Test DLCS Field": "lasigd|~|asdfg"}, self.solr_client, config=self.CONFIG, ) assert result == { "features_sim": None, "genre_sim": None, "human_readable_language_sim": None, "human_readable_resource_type_sim": None, "id": "ark:/123/abc", "location_sim": None, "member_of_collections_ssim": None, "named_subject_sim": None, "place_of_origin_sim": None, "script_sim": None, "subject_sim": None, "support_sim": None, "test_ursus_field_tesim": ["lasigd", "asdfg"], "thumbnail_url_ss": None, "writing_system_sim": None, "year_isim": [], "names_sim": None, "architect_sim": None, "author_sim": None, "calligrapher_sim": None, "commentator_sim": None, "composer_sim": None, "editor_sim": None, "engraver_sim": None, "illuminator_sim": None, "illustrator_sim": None, "lyricist_sim": None, "printmaker_sim": None, "rubricator_sim": None, "scribe_sim": None, "uniform_title_sim": None, "translator_sim": None, "associated_name_sim": None, "form_sim": None, "date_dtsim": [], "header_index_tesim": [], "name_fields_index_tesim": [], "keywords_tesim": [], "keywords_sim": [] }
def test_sets_collection(self): """sets the collection name by using the collection row""" result = feed_ursus.map_record( {"Item ARK": "ark:/123/abc", "Parent ARK": "ark:/123/collection"}, self.solr_client, config=self.CONFIG, ) assert result["dlcs_collection_name_tesim"] == ["Test Collection KGSL"] assert result["member_of_collections_ssim"] == ["Test Collection KGSL"]
def test_sets_thumbnail(self): """sets a thumbnail URL""" result = feed_ursus.map_record( { "Item ARK": "ark:/123/abc", "IIIF Access URL": "https://test.iiif.server/url", }, config=self.CONFIG, ) assert (result["thumbnail_url_ss"] == "https://test.iiif.server/url/full/!200,200/0/default.jpg")
def test_maps_record(self, monkeypatch): """maps the record for Ursus""" monkeypatch.setattr( feed_ursus.mapper, "FIELD_MAPPING", { "id": lambda r: r["Item ARK"], "test_ursus_field_tesim": "Test DLCS Field", }, ) result = feed_ursus.map_record( { "Item ARK": "ark:/123/abc", "Test DLCS Field": "lasigd|~|asdfg" }, config=self.CONFIG, ) assert result == { "features_sim": None, "genre_sim": None, "human_readable_language_sim": None, "human_readable_resource_type_sim": None, "id": "ark:/123/abc", "location_sim": None, "member_of_collections_ssim": None, "named_subject_sim": None, "place_of_origin_sim": None, "script_sim": None, "subject_sim": None, "support_sim": None, "test_ursus_field_tesim": ["lasigd", "asdfg"], "thumbnail_url_ss": None, "writing_system_sim": None, "year_isim": [], }