From fd259a3f13e127e10a8968111eac867fed8e4caf Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com> Date: Sat, 30 Sep 2023 21:27:02 +0200 Subject: [PATCH] chore: format code with black (#18) --- dsp_permissions_scripts/models/scope.py | 1 + tests/test_scope_serialization.py | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dsp_permissions_scripts/models/scope.py b/dsp_permissions_scripts/models/scope.py index d22f1542..920180a1 100644 --- a/dsp_permissions_scripts/models/scope.py +++ b/dsp_permissions_scripts/models/scope.py @@ -8,6 +8,7 @@ class PermissionScope(BaseModel): A scope is an object encoding the information: "Which user group gets which permissions on a resource/value?" """ + CR: list[str | BuiltinGroup] = [] D: list[str | BuiltinGroup] = [] M: list[str | BuiltinGroup] = [] diff --git a/tests/test_scope_serialization.py b/tests/test_scope_serialization.py index f9e66ffb..bcc99305 100644 --- a/tests/test_scope_serialization.py +++ b/tests/test_scope_serialization.py @@ -41,22 +41,22 @@ class TestScopeSerialization(unittest.TestCase): ] scopes = [ PermissionScope( - CR=[BuiltinGroup.SYSTEM_USER], - V=["http://www.knora.org/ontology/knora-admin#CustomGroup"] + CR=[BuiltinGroup.SYSTEM_USER], + V=["http://www.knora.org/ontology/knora-admin#CustomGroup"], ), PermissionScope( - D=[BuiltinGroup.PROJECT_ADMIN], - RV=[BuiltinGroup.PROJECT_MEMBER] + D=[BuiltinGroup.PROJECT_ADMIN], + RV=[BuiltinGroup.PROJECT_MEMBER], ), PermissionScope( - M=[BuiltinGroup.PROJECT_ADMIN], - V=[BuiltinGroup.CREATOR, BuiltinGroup.KNOWN_USER], - RV=[BuiltinGroup.UNKNOWN_USER] + M=[BuiltinGroup.PROJECT_ADMIN], + V=[BuiltinGroup.CREATOR, BuiltinGroup.KNOWN_USER], + RV=[BuiltinGroup.UNKNOWN_USER], ), PermissionScope( - CR=[BuiltinGroup.SYSTEM_ADMIN, BuiltinGroup.PROJECT_ADMIN], - D=[BuiltinGroup.CREATOR], - RV=[BuiltinGroup.UNKNOWN_USER] + CR=[BuiltinGroup.SYSTEM_ADMIN, BuiltinGroup.PROJECT_ADMIN], + D=[BuiltinGroup.CREATOR], + RV=[BuiltinGroup.UNKNOWN_USER], ), ] @@ -67,7 +67,7 @@ def test_create_scope_from_string(self) -> None: scope.model_dump_json(), msg=f"Failed with permission string '{perm_string}'", ) - + def test_create_scope_from_admin_route_object(self) -> None: for admin_route_object, scope, index in zip(self.admin_route_objects, self.scopes, range(len(self.scopes))): self.assertEqual(