diff --git a/dsp_permissions_scripts/utils/project.py b/dsp_permissions_scripts/utils/project.py index ebd6ec29..3c474fd3 100644 --- a/dsp_permissions_scripts/utils/project.py +++ b/dsp_permissions_scripts/utils/project.py @@ -20,7 +20,7 @@ def get_project_iri_by_shortcode(shortcode: str, host: str) -> str: def get_all_resource_oaps_of_project( - project_iri: str, + project_iri: str, host: str, token: str, ) -> list[Oap]: @@ -42,7 +42,7 @@ def get_all_resource_oaps_of_project( def __get_all_resource_class_iris_of_project( - project_iri: str, + project_iri: str, host: str, token: str, ) -> list[str]: @@ -100,7 +100,7 @@ def __dereference_prefix(identifier: str, context: dict[str, str]) -> str: def __get_all_resource_oaps_of_resclass( - host: str, + host: str, resclass_iri: str, project_iri: str, token: str, @@ -147,13 +147,13 @@ def __get_next_page( # result contains several resources: return them, then continue with next page oaps = [] for r in result["@graph"]: - scope=create_scope_from_string(r["knora-api:hasPermissions"]) + scope = create_scope_from_string(r["knora-api:hasPermissions"]) oaps.append(Oap(scope=scope, object_iri=r["@id"])) return True, oaps elif "@id" in result: # result contains only 1 resource: return it, then stop (there will be no more resources) - scope=create_scope_from_string(result["knora-api:hasPermissions"]) - return False, [Oap(scope=scope, object_iri=result["@id"]), ] + scope = create_scope_from_string(result["knora-api:hasPermissions"]) + return False, [Oap(scope=scope, object_iri=result["@id"])] else: # there are no more resources return False, [] diff --git a/tests/test_scope_serialization.py b/tests/test_scope_serialization.py index 41ecc542..858981d8 100644 --- a/tests/test_scope_serialization.py +++ b/tests/test_scope_serialization.py @@ -101,9 +101,10 @@ def _resolve_prefixes_of_admin_route_object(self, admin_route_object: list[dict[ "knora-admin:", "http://www.knora.org/ontology/knora-admin#" ) return admin_route_object - + def _resolve_prefixes_of_perm_string(self, perm_string: str) -> str: return perm_string.replace("knora-admin:", "http://www.knora.org/ontology/knora-admin#") + if __name__ == "__main__": unittest.main()