Skip to content

Commit

Permalink
Fixes #271
Browse files Browse the repository at this point in the history
  • Loading branch information
recalcitrantsupplant committed Oct 9, 2024
1 parent 7ceebfd commit 3b25330
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
6 changes: 5 additions & 1 deletion prez/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ def assemble_app(
app.include_router(sparql_router)
if _settings.configuration_mode:
app.include_router(config_router)
app.mount("/static", StaticFiles(directory=Path(__file__).parent / "static"), name="static")
app.mount(
"/static",
StaticFiles(directory=Path(__file__).parent / "static"),
name="static",
)
if _settings.enable_ogc_features:
app.mount(
"/catalogs/{catalogId}/collections/{recordsCollectionId}/features",
Expand Down
8 changes: 4 additions & 4 deletions test_data/catprez.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ ex:CatalogOne a dcat:Catalog ;

ex:DCATDataset a dcat:Dataset ;
rdfs:label "DCAT Resource" ;
dcterms:hasPart ex:RDFResource ;
dcterms:hasPart ex:DCATResource ;
ex:property "DCAT Resource property"
.

ex:RDFResource a rdf:Resource ;
ex:DCATResource a dcat:Resource ;
rdfs:label "RDF Resource" ;
ex:property "RDF resource property" ;
.
Expand All @@ -29,11 +29,11 @@ ex:CatalogTwo a dcat:Catalog ;

ex:DCATDatasetTwo a dcat:Dataset ;
rdfs:label "rightful" ;
dcterms:hasPart ex:RDFResourceTwo ;
dcterms:hasPart ex:DCATResourceTwo ;
ex:property "exposure"
.

ex:RDFResourceTwo a rdf:Resource ;
ex:DCATResourceTwo a dcat:Resource ;
rdfs:label "salty" ;
ex:property "proficient" ;
.
14 changes: 12 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,18 @@ def a_catprez_catalog_link(client):


@pytest.fixture()
def a_resource_link(client, a_catprez_catalog_link):
r = client.get(a_catprez_catalog_link)
def a_dataset_link(client, a_catprez_catalog_link):
r = client.get(f"{a_catprez_catalog_link}/collections")
g = Graph().parse(data=r.text)
links = g.objects(subject=None, predicate=URIRef(f"https://prez.dev/link"))
for link in links:
if link != a_catprez_catalog_link:
return link


@pytest.fixture()
def a_resource_link(client, a_dataset_link):
r = client.get(f"{a_dataset_link}/items")
g = Graph().parse(data=r.text)
links = g.objects(subject=None, predicate=URIRef(f"https://prez.dev/link"))
for link in links:
Expand Down
11 changes: 11 additions & 0 deletions tests/test_endpoints_catprez.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,14 @@ def test_lower_level_listing_anot(client, a_catprez_catalog_link):
DCAT.Dataset,
)
assert next(response_graph.triples(expected_response))


def test_dcat_record(client, a_resource_link):
r = client.get(f"{a_resource_link}?_mediatype=text/turtle")
response_graph = Graph().parse(data=r.text)
expected_response = (
URIRef("https://example.com/DCATResource"),
RDF.type,
DCAT.Resource,
)
assert next(response_graph.triples(expected_response))

0 comments on commit 3b25330

Please sign in to comment.