def test_to_graph_should_return_access_service_skolemized( mocker: MockFixture) -> None: """It returns a access service graph isomorphic to spec.""" distribution = Distribution() distribution.identifier = "http://example.com/distributions/1" service = DataService() distribution.access_service = service src = """ @prefix dct: <http://purl.org/dc/terms/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix dcat: <http://www.w3.org/ns/dcat#> . <http://example.com/distributions/1> a dcat:Distribution ; dcat:accessService <http://wwww.digdir.no/.well-known/skolem/284db4d2-80c2-11eb-82c3-83e80baa2f94> . """ mocker.patch( "skolemizer.Skolemizer.add_skolemization", return_value=skolemization, ) g1 = Graph().parse(data=distribution.to_rdf(), format="turtle") g2 = Graph().parse(data=src, format="turtle") _isomorphic = isomorphic(g1, g2) if not _isomorphic: _dump_diff(g1, g2) pass assert _isomorphic
def test_to_graph_should_return_access_service() -> None: """It returns a access service graph isomorphic to spec.""" distribution = Distribution() distribution.identifier = "http://example.com/distributions/1" service = DataService() service.identifier = "http://example.com/dataservices/1" distribution.access_service = service src = """ @prefix dct: <http://purl.org/dc/terms/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix dcat: <http://www.w3.org/ns/dcat#> . <http://example.com/distributions/1> a dcat:Distribution ; dcat:accessService <http://example.com/dataservices/1> ; . """ g1 = Graph().parse(data=distribution.to_rdf(), format="turtle") g2 = Graph().parse(data=src, format="turtle") _isomorphic = isomorphic(g1, g2) if not _isomorphic: _dump_diff(g1, g2) pass assert _isomorphic