diff --git a/ckanext/dcatapchharvest/tests/fixtures/1901.xml b/ckanext/dcatapchharvest/tests/fixtures/1901.xml index bc573b8..cb46db4 100644 --- a/ckanext/dcatapchharvest/tests/fixtures/1901.xml +++ b/ckanext/dcatapchharvest/tests/fixtures/1901.xml @@ -16,6 +16,12 @@ 346265-fr@bundesamt-fur-statistik-bfs HTML NonCommercialAllowed-CommercialWithPermission-ReferenceRequired + + + + + + de diff --git a/ckanext/dcatapchharvest/tests/fixtures/dataset.json b/ckanext/dcatapchharvest/tests/fixtures/dataset.json index 665e46a..37d7d00 100644 --- a/ckanext/dcatapchharvest/tests/fixtures/dataset.json +++ b/ckanext/dcatapchharvest/tests/fixtures/dataset.json @@ -94,8 +94,18 @@ "it": "" }, "documentation": [ - "http://dataset.info.org/doc1", - "http://dataset.info.org/doc2" + "https://example.com/distribution-dataset-1", + "https://example.com/distribution-dataset-2" + ], + "resources": [ + { + "id": "e2c50e70-67ad-4f86-bb1b-3f93867eadaa", + "package_id": "4b6fe9ca-dc77-4cec-92a4-55c6624a5bd6", + "documentation": [ + "https://example.com/resource-dataset-1", + "https://example.com/resource-dataset-2" + ] + } ], "extras": [ { diff --git a/ckanext/dcatapchharvest/tests/test_dcatap_ch_serialize.py b/ckanext/dcatapchharvest/tests/test_dcatap_ch_serialize.py index 30ee88a..5caa799 100644 --- a/ckanext/dcatapchharvest/tests/test_dcatap_ch_serialize.py +++ b/ckanext/dcatapchharvest/tests/test_dcatap_ch_serialize.py @@ -70,6 +70,14 @@ def test_graph_from_dataset(self): for value in values: assert self._triple(g, dataset_ref, item[1], item[2](value)) + # Resources + eq_(len([t for t in g.triples((dataset_ref, DCAT.distribution, None))]), len(dataset["resources"])) + for resource_dict in dataset.get("resources", []): + distribution = URIRef(dh.resource_uri(resource_dict)) + assert self._triple(g, distribution, RDF.type, DCAT.Distribution) + for link in resource_dict.get("documentation", []): + assert self._triple(g, distribution, FOAF.page, URIRef(link)) + def test_graph_from_dataset_uri(self): """Tests that datasets (resources) with a uri from the test system have that uri changed to reference the prod system when they are output