From 910d768e41a6830b6f1de24bf3d02d1bb59c1ebb Mon Sep 17 00:00:00 2001 From: Ronen Hilewicz Date: Tue, 5 Nov 2024 08:38:05 -0500 Subject: [PATCH 1/2] Update async directory client to match sync --- src/aserto/client/directory/v3/aio/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/aserto/client/directory/v3/aio/__init__.py b/src/aserto/client/directory/v3/aio/__init__.py index 2e5744b..90c76fd 100644 --- a/src/aserto/client/directory/v3/aio/__init__.py +++ b/src/aserto/client/directory/v3/aio/__init__.py @@ -405,38 +405,41 @@ async def get_relations( @typing.overload async def get_relation( self, + *, + with_objects: typing.Literal[False] = False, object_type: str = "", object_id: str = "", relation: str = "", subject_type: str = "", subject_id: str = "", subject_relation: str = "", - with_objects: typing.Literal[False] = False, ) -> Relation: ... @typing.overload async def get_relation( self, + *, + with_objects: typing.Literal[True], object_type: str = "", object_id: str = "", relation: str = "", subject_type: str = "", subject_id: str = "", subject_relation: str = "", - with_objects: typing.Literal[True] = True, ) -> RelationResponse: ... async def get_relation( self, + *, + with_objects: bool = False, object_type: str = "", object_id: str = "", relation: str = "", subject_type: str = "", subject_id: str = "", subject_relation: str = "", - with_objects: bool = False, ) -> typing.Union[Relation, RelationResponse]: """Retrieve a directory relation that matches the specified filters. Raises a NotFoundError no matching relation is found. From 9aeb187a355f3739f6ed862a4f77741319e1b7f8 Mon Sep 17 00:00:00 2001 From: Ronen Hilewicz Date: Tue, 5 Nov 2024 08:48:20 -0500 Subject: [PATCH 2/2] Fix async directory tests --- test/test_directory_v3_async.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/test_directory_v3_async.py b/test/test_directory_v3_async.py index 3575698..eaccef3 100644 --- a/test/test_directory_v3_async.py +++ b/test/test_directory_v3_async.py @@ -184,7 +184,12 @@ async def test_delete_object(directory: Directory): # Relations should remain intact rel = await directory.get_relation( - "user", "morty@the-citadel.com", "manager", "user", "rick@the-citadel" + with_objects=False, + object_type="user", + object_id="morty@the-citadel.com", + relation="manager", + subject_type="user", + subject_id="rick@the-citadel.com", ) assert rel is not None assert rel.object_type == "user"