Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 53 additions & 6 deletions client/python/integration_tests/test_catalog_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,51 @@ def test_policies(
assert updated_policy.policy.description == updated_policy_description
assert json.loads(updated_policy.policy.content) == updated_policy_content

# ATTACH to catalog
test_policy_api.attach_policy(
prefix=test_catalog.name,
namespace=namespace_name,
policy_name=policy_name,
attach_policy_request=AttachPolicyRequest(
target=PolicyAttachmentTarget(type="catalog")
),
)

# GET APPLICABLE on catalog
applicable_policies_catalog = test_policy_api.get_applicable_policies(
prefix=test_catalog.name
)

assert len(applicable_policies_catalog.applicable_policies) == 1
assert applicable_policies_catalog.applicable_policies[0].name == policy_name

# GET inherited APPLICABLE on table
applicable_for_table_inherit = test_policy_api.get_applicable_policies(
prefix=test_catalog.name,
namespace=format_namespace(sub_namespace_path),
target_name=table_name,
)
assert len(applicable_for_table_inherit.applicable_policies) == 1
assert applicable_for_table_inherit.applicable_policies[0].name == policy_name
assert applicable_for_table_inherit.applicable_policies[0].inherited

# DETACH from catalog
test_policy_api.detach_policy(
prefix=test_catalog.name,
namespace=namespace_name,
policy_name=policy_name,
detach_policy_request=DetachPolicyRequest(
target=PolicyAttachmentTarget(type="catalog")
),
)

# GET APPLICABLE on catalog after DETACH
applicable_policies_catalog_after_detach = (
test_policy_api.get_applicable_policies(prefix=test_catalog.name)
)

assert len(applicable_policies_catalog_after_detach.applicable_policies) == 0

# ATTACH to namespace
test_policy_api.attach_policy(
prefix=test_catalog.name,
Expand All @@ -282,11 +327,11 @@ def test_policies(
)

# GET APPLICABLE on namespace
applicable_policies = test_policy_api.get_applicable_policies(
applicable_policies_namespace = test_policy_api.get_applicable_policies(
prefix=test_catalog.name, namespace=format_namespace(sub_namespace_path)
)
assert len(applicable_policies.applicable_policies) == 1
assert applicable_policies.applicable_policies[0].name == policy_name
assert len(applicable_policies_namespace.applicable_policies) == 1
assert applicable_policies_namespace.applicable_policies[0].name == policy_name

# DETACH from namespace
test_policy_api.detach_policy(
Expand All @@ -299,10 +344,12 @@ def test_policies(
)

# GET APPLICABLE on namespace after DETACH
applicable_policies_after_detach = test_policy_api.get_applicable_policies(
prefix=test_catalog.name, namespace=format_namespace(sub_namespace_path)
applicable_policies_namespace_after_detach = (
test_policy_api.get_applicable_policies(
prefix=test_catalog.name, namespace=format_namespace(sub_namespace_path)
)
)
assert len(applicable_policies_after_detach.applicable_policies) == 0
assert len(applicable_policies_namespace_after_detach.applicable_policies) == 0

# ATTACH to table
test_policy_api.attach_policy(
Expand Down
2 changes: 1 addition & 1 deletion site/content/in-dev/unreleased/command-line-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ options:
--consent-url (Only for Azure) A consent URL granting permissions for the Azure Storage location
--service-account (Only for GCS) The service account to use when connecting to GCS
--property A key/value pair such as: tag=value. Multiple can be provided by specifying this option more than once
--catalog-connection-type The type of external catalog in [ICEBERG, HADOOP].
--catalog-connection-type The type of external catalog in [iceberg-rest, hadoop].
--iceberg-remote-catalog-name The remote catalog name when federating to an Iceberg REST catalog
--hadoop-warehouse The warehouse to use when federating to a HADOOP catalog
--catalog-authentication-type The type of authentication in [OAUTH, BEARER, SIGV4, IMPLICIT]
Expand Down