From 220a132a96e4466e99b1f8550e8b429322e9c74c Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Tue, 8 Oct 2024 22:13:51 +0200 Subject: [PATCH] Ensure pydantic AnyUrl values are converted to fairgraph IRIs --- .../validation_service/data_models.py | 6 +++--- .../validation_service/tests/README.md | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/validation_service_api/validation_service/data_models.py b/validation_service_api/validation_service/data_models.py index b2209dd0..c3d0a51a 100644 --- a/validation_service_api/validation_service/data_models.py +++ b/validation_service_api/validation_service/data_models.py @@ -437,8 +437,8 @@ def from_kg_object(cls, instance, client, model_id, scope): def to_kg_object(self, model_project): repository = omcore.FileRepository( - name=self.source, - iri=self.source, + name=str(self.source), + iri=IRI(str(self.source)), #hosted_by= #repository_type= hash=omcore.Hash(algorithm="SHA-1", digest=self.hash) # are we sure we're using SHA-1? @@ -1220,7 +1220,7 @@ def to_kg_object(self, client): return omcore.File( id=client.uri_from_uuid(self.id) if self.id else None, name=self.local_path, - iri=IRI(self.download_url), + iri=IRI(str(self.download_url)), format=get_term("ContentType", self.content_type), hash=omcore.Hash(algorithm="SHA-1", digest=self.hash), # are we sure we're using SHA-1? storage_size=self.size, diff --git a/validation_service_api/validation_service/tests/README.md b/validation_service_api/validation_service/tests/README.md index d16a8909..58731d23 100644 --- a/validation_service_api/validation_service/tests/README.md +++ b/validation_service_api/validation_service/tests/README.md @@ -12,6 +12,19 @@ The token should be stored in an environment variable `VF_TEST_TOKEN`. - pytest - pytest-asyncio +## Environment + +The following environment variables need to be set: + +- KG_SERVICE_ACCOUNT_CLIENT_ID +- KG_SERVICE_ACCOUNT_SECRET +- EBRAINS_IAM_BASE_URL +- EBRAINS_IAM_CLIENT_ID +- EBRAINS_IAM_SECRET +- SESSIONS_SECRET_KEY +- KG_CORE_API_HOST +- VALIDATION_SERVICE_BASE_URL + ## Running tests From the "validation_service_api" subdirectory, run: