Skip to content

Commit

Permalink
add more checks
Browse files Browse the repository at this point in the history
  • Loading branch information
petrkalos committed Dec 4, 2024
1 parent c6d2536 commit 44353cd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
UPDATE_PIPELINE,
)
from dataall.modules.datasets_base.services.dataset_list_permissions import LIST_ENVIRONMENT_DATASETS
from dataall.modules.maintenance.api.enums import MaintenanceModes
from dataall.modules.metadata_forms.services.metadata_form_permissions import (
MANAGE_METADATA_FORMS,
ATTACH_METADATA_FORM,
Expand Down Expand Up @@ -489,7 +490,7 @@ def __post_init__(self):
),
field_id('Mutation', 'deleteNetwork'): TestData(tenant_perm=MANAGE_ENVIRONMENTS, resource_perm=DELETE_NETWORK),
field_id('Mutation', 'deleteNotification'): TestData(
tenant_ignore=IgnoreReason.APPSUPPORT, resource_ignore=IgnoreReason.NOTREQUIRED
tenant_ignore=IgnoreReason.APPSUPPORT, resource_ignore=IgnoreReason.APPSUPPORT
),
field_id('Mutation', 'deleteOmicsRun'): TestData(
tenant_perm=MANAGE_OMICS_RUNS, resource_ignore=IgnoreReason.NOTREQUIRED
Expand Down Expand Up @@ -538,7 +539,7 @@ def __post_init__(self):
tenant_perm=MANAGE_ORGANIZATIONS, resource_perm=INVITE_ORGANIZATION_GROUP
),
field_id('Mutation', 'markNotificationAsRead'): TestData(
tenant_ignore=IgnoreReason.APPSUPPORT, resource_ignore=IgnoreReason.NOTREQUIRED
tenant_ignore=IgnoreReason.APPSUPPORT, resource_ignore=IgnoreReason.APPSUPPORT
),
field_id('Mutation', 'postFeedMessage'): TestData(
tenant_ignore=IgnoreReason.APPSUPPORT, resource_ignore=IgnoreReason.NOTREQUIRED
Expand Down Expand Up @@ -575,7 +576,7 @@ def __post_init__(self):
),
field_id('Mutation', 'startGlueCrawler'): TestData(tenant_perm=MANAGE_DATASETS, resource_perm=CRAWL_DATASET),
field_id('Mutation', 'startMaintenanceWindow'): TestData(
tenant_ignore=IgnoreReason.TENANT, resource_ignore=IgnoreReason.NOTREQUIRED
tenant_ignore=IgnoreReason.TENANT, resource_ignore=IgnoreReason.TENANT, tenant_admin_perm=True
),
field_id('Mutation', 'startReindexCatalog'): TestData(
tenant_ignore=IgnoreReason.TENANT, resource_ignore=IgnoreReason.TENANT, tenant_admin_perm=True
Expand Down Expand Up @@ -1223,6 +1224,8 @@ def test_permissions(
mock_read_perm_name.return_value = perm

iargs = {arg: MagicMock() for arg in inspect.signature(field.resolver).parameters.keys()}
if 'mode' in iargs:
iargs['mode'] = MaintenanceModes.READONLY.value
with suppress(Exception):
field.resolver(**iargs)

Expand Down

0 comments on commit 44353cd

Please sign in to comment.