From f18c1516e410d7c4d39ad86c0599f0e962ae72b5 Mon Sep 17 00:00:00 2001 From: Shahzad Lone Date: Fri, 6 Dec 2024 06:01:35 +0800 Subject: [PATCH] PR(FEEDBACK): Do the PR review suggestions --- .../doc_actor/add/with_manager_gql_test.go | 33 ++++++++++++------- .../doc_actor/add/with_manager_test.go | 3 ++ .../doc_actor/add/with_only_write_gql_test.go | 11 ++++--- .../doc_actor/add/with_only_write_test.go | 1 + .../doc_actor/add/with_reader_gql_test.go | 11 ++++--- .../add/with_target_all_actors_gql_test.go | 6 ++-- .../add/with_target_all_actors_test.go | 2 ++ .../doc_actor/add/with_update_test.go | 2 ++ 8 files changed, 47 insertions(+), 22 deletions(-) diff --git a/tests/integration/acp/relationship/doc_actor/add/with_manager_gql_test.go b/tests/integration/acp/relationship/doc_actor/add/with_manager_gql_test.go index 757053f365..813294a7fd 100644 --- a/tests/integration/acp/relationship/doc_actor/add/with_manager_gql_test.go +++ b/tests/integration/acp/relationship/doc_actor/add/with_manager_gql_test.go @@ -26,10 +26,13 @@ func TestACP_OwnerMakesAManagerThatGivesItSelfReadAndWriteAccess_GQL_ManagerCanR Description: "Test acp, owner makes a manager that gives itself read and write access", - SupportedMutationTypes: immutable.Some([]testUtils.MutationType{ - // GQL mutation will return no error when wrong identity is used so test that separately. - testUtils.GQLRequestMutationType, - }), + SupportedMutationTypes: immutable.Some( + []testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used (only for update requests), + // so test that separately. + testUtils.GQLRequestMutationType, + }, + ), Actions: []any{ testUtils.AddPolicy{ @@ -274,10 +277,13 @@ func TestACP_OwnerMakesManagerButManagerCanNotPerformOperations_GQL_ManagerCantR Description: "Test acp, owner makes a manager, manager can't read or write", - SupportedMutationTypes: immutable.Some([]testUtils.MutationType{ - // GQL mutation will return no error when wrong identity is used so test that separately. - testUtils.GQLRequestMutationType, - }), + SupportedMutationTypes: immutable.Some( + []testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used (only for update requests), + // so test that separately. + testUtils.GQLRequestMutationType, + }, + ), Actions: []any{ testUtils.AddPolicy{ @@ -442,10 +448,13 @@ func TestACP_ManagerAddsRelationshipWithRelationItDoesNotManageAccordingToPolicy Description: "Test acp, manager adds relationship with relation it does not manage according to policy, error", - SupportedMutationTypes: immutable.Some([]testUtils.MutationType{ - // GQL mutation will return no error when wrong identity is used so test that separately. - testUtils.GQLRequestMutationType, - }), + SupportedMutationTypes: immutable.Some( + []testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used (only for update requests), + // so test that separately. + testUtils.GQLRequestMutationType, + }, + ), Actions: []any{ testUtils.AddPolicy{ diff --git a/tests/integration/acp/relationship/doc_actor/add/with_manager_test.go b/tests/integration/acp/relationship/doc_actor/add/with_manager_test.go index 485c130805..b50b74a04d 100644 --- a/tests/integration/acp/relationship/doc_actor/add/with_manager_test.go +++ b/tests/integration/acp/relationship/doc_actor/add/with_manager_test.go @@ -602,6 +602,7 @@ func TestACP_OwnerMakesAManagerThatGivesItSelfReadAndWriteAccess_ManagerCanReadA Description: "Test acp, owner makes a manager that gives itself read and write access", SupportedMutationTypes: immutable.Some([]testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used with gql (only for update requests), testUtils.CollectionNamedMutationType, testUtils.CollectionSaveMutationType, }), @@ -850,6 +851,7 @@ func TestACP_ManagerAddsRelationshipWithRelationItDoesNotManageAccordingToPolicy Description: "Test acp, manager adds relationship with relation it does not manage according to policy, error", SupportedMutationTypes: immutable.Some([]testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used with gql (only for update requests), testUtils.CollectionNamedMutationType, testUtils.CollectionSaveMutationType, }), @@ -1018,6 +1020,7 @@ func TestACP_OwnerMakesManagerButManagerCanNotPerformOperations_ManagerCantReadO Description: "Test acp, owner makes a manager, manager can't read or write", SupportedMutationTypes: immutable.Some([]testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used with gql (only for update requests), testUtils.CollectionNamedMutationType, testUtils.CollectionSaveMutationType, }), diff --git a/tests/integration/acp/relationship/doc_actor/add/with_only_write_gql_test.go b/tests/integration/acp/relationship/doc_actor/add/with_only_write_gql_test.go index 6a3f02f4ba..9391bb5b4d 100644 --- a/tests/integration/acp/relationship/doc_actor/add/with_only_write_gql_test.go +++ b/tests/integration/acp/relationship/doc_actor/add/with_only_write_gql_test.go @@ -26,10 +26,13 @@ func TestACP_OwnerGivesUpdateWriteAccessToAnotherActorWithoutExplicitReadPerm_GQ Description: "Test acp, owner gives write(update) access without explicit read permission, can still update", - SupportedMutationTypes: immutable.Some([]testUtils.MutationType{ - // GQL mutation will return no error when wrong identity is used so test that separately. - testUtils.GQLRequestMutationType, - }), + SupportedMutationTypes: immutable.Some( + []testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used (only for update requests), + // so test that separately. + testUtils.GQLRequestMutationType, + }, + ), Actions: []any{ testUtils.AddPolicy{ diff --git a/tests/integration/acp/relationship/doc_actor/add/with_only_write_test.go b/tests/integration/acp/relationship/doc_actor/add/with_only_write_test.go index ccac9cd232..8a3eeabe24 100644 --- a/tests/integration/acp/relationship/doc_actor/add/with_only_write_test.go +++ b/tests/integration/acp/relationship/doc_actor/add/with_only_write_test.go @@ -27,6 +27,7 @@ func TestACP_OwnerGivesUpdateWriteAccessToAnotherActorWithoutExplicitReadPerm_Ot Description: "Test acp, owner gives write(update) access without explicit read permission, can still update", SupportedMutationTypes: immutable.Some([]testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used with gql (only for update requests), testUtils.CollectionNamedMutationType, testUtils.CollectionSaveMutationType, }), diff --git a/tests/integration/acp/relationship/doc_actor/add/with_reader_gql_test.go b/tests/integration/acp/relationship/doc_actor/add/with_reader_gql_test.go index f51861ec5c..7ca1c30e09 100644 --- a/tests/integration/acp/relationship/doc_actor/add/with_reader_gql_test.go +++ b/tests/integration/acp/relationship/doc_actor/add/with_reader_gql_test.go @@ -26,10 +26,13 @@ func TestACP_OwnerGivesOnlyReadAccessToAnotherActor_GQL_OtherActorCanReadButNotU Description: "Test acp, owner gives read access to another actor, but the other actor can't update", - SupportedMutationTypes: immutable.Some([]testUtils.MutationType{ - // GQL mutation will return no error when wrong identity is used so test that separately. - testUtils.GQLRequestMutationType, - }), + SupportedMutationTypes: immutable.Some( + []testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used (only for update requests), + // so test that separately. + testUtils.GQLRequestMutationType, + }, + ), Actions: []any{ testUtils.AddPolicy{ diff --git a/tests/integration/acp/relationship/doc_actor/add/with_target_all_actors_gql_test.go b/tests/integration/acp/relationship/doc_actor/add/with_target_all_actors_gql_test.go index 48179c9abf..2a421dc74d 100644 --- a/tests/integration/acp/relationship/doc_actor/add/with_target_all_actors_gql_test.go +++ b/tests/integration/acp/relationship/doc_actor/add/with_target_all_actors_gql_test.go @@ -28,7 +28,8 @@ func TestACP_OwnerGivesOnlyReadAccessToAllActors_GQL_AllActorsCanReadButNotUpdat SupportedMutationTypes: immutable.Some( []testUtils.MutationType{ - // GQL mutation will return no error when wrong identity is used so test that separately. + // GQL mutation will return no error when wrong identity is used (only for update requests), + // so test that separately. testUtils.GQLRequestMutationType, }, ), @@ -258,7 +259,8 @@ func TestACP_OwnerGivesOnlyReadAccessToAllActors_GQL_CanReadEvenWithoutIdentityB SupportedMutationTypes: immutable.Some( []testUtils.MutationType{ - // GQL mutation will return no error when wrong identity is used so test that separately. + // GQL mutation will return no error when wrong identity is used (only for update requests), + // so test that separately. testUtils.GQLRequestMutationType, }, ), diff --git a/tests/integration/acp/relationship/doc_actor/add/with_target_all_actors_test.go b/tests/integration/acp/relationship/doc_actor/add/with_target_all_actors_test.go index 5780edde4a..ad587232f9 100644 --- a/tests/integration/acp/relationship/doc_actor/add/with_target_all_actors_test.go +++ b/tests/integration/acp/relationship/doc_actor/add/with_target_all_actors_test.go @@ -28,6 +28,7 @@ func TestACP_OwnerGivesOnlyReadAccessToAllActors_AllActorsCanReadButNotUpdateOrD SupportedMutationTypes: immutable.Some( []testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used with gql (only for update requests), testUtils.CollectionNamedMutationType, testUtils.CollectionSaveMutationType, }, @@ -258,6 +259,7 @@ func TestACP_OwnerGivesOnlyReadAccessToAllActors_CanReadEvenWithoutIdentityButNo SupportedMutationTypes: immutable.Some( []testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used with gql (only for update requests), testUtils.CollectionNamedMutationType, testUtils.CollectionSaveMutationType, }, diff --git a/tests/integration/acp/relationship/doc_actor/add/with_update_test.go b/tests/integration/acp/relationship/doc_actor/add/with_update_test.go index f6bf553356..6830c6a9c7 100644 --- a/tests/integration/acp/relationship/doc_actor/add/with_update_test.go +++ b/tests/integration/acp/relationship/doc_actor/add/with_update_test.go @@ -27,6 +27,7 @@ func TestACP_OwnerGivesUpdateWriteAccessToAnotherActorTwice_ShowThatTheRelations Description: "Test acp, owner gives write(update) access to another actor twice, no-op", SupportedMutationTypes: immutable.Some([]testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used with gql (only for update requests), testUtils.CollectionNamedMutationType, testUtils.CollectionSaveMutationType, }), @@ -185,6 +186,7 @@ func TestACP_OwnerGivesUpdateWriteAccessToAnotherActor_OtherActorCanUpdate(t *te Description: "Test acp, owner gives write(update) access to another actor", SupportedMutationTypes: immutable.Some([]testUtils.MutationType{ + // GQL mutation will return no error when wrong identity is used with gql (only for update requests), testUtils.CollectionNamedMutationType, testUtils.CollectionSaveMutationType, }),