Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support includeFoldersAsPrefixes #1223

Merged
merged 4 commits into from
Mar 18, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
sys test
  • Loading branch information
cojenco committed Feb 9, 2024
commit 9fbd8f19fca195c58539ff5d4b353c93fa9ee118
36 changes: 0 additions & 36 deletions tests/system/test_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,42 +653,6 @@ def test_bucket_list_blobs_w_match_glob(
assert [blob.name for blob in blobs] == expected_names


def test_bucket_list_blobs_include_managed_folders(
storage_client,
buckets_to_delete,
blobs_to_delete,
hierarchy_filenames,
):
bucket_name = _helpers.unique_name("ubla-mf")
bucket = storage_client.bucket(bucket_name)
bucket.iam_configuration.uniform_bucket_level_access_enabled = True
_helpers.retry_429_503(bucket.create)()
buckets_to_delete.append(bucket)

payload = b"helloworld"
for filename in hierarchy_filenames:
blob = bucket.blob(filename)
blob.upload_from_string(payload)
blobs_to_delete.append(blob)

# Make API call to create a managed folder.
# TODO: change to use storage control client once available.
path = f"/b/{bucket_name}/managedFolders"
properties = {"name": "managedfolder1"}
storage_client._post_resource(path, properties)

expected_prefixes = set(["parent/"])
blob_iter = bucket.list_blobs(delimiter="/")
list(blob_iter)
assert blob_iter.prefixes == expected_prefixes

# Test that managed folders are only included when IncludeFoldersAsPrefixes is set.
expected_prefixes = set(["parent/", "managedfolder1/"])
blob_iter = bucket.list_blobs(delimiter="/", include_folders_as_prefixes=True)
list(blob_iter)
assert blob_iter.prefixes == expected_prefixes


def test_bucket_update_retention_period(
storage_client,
buckets_to_delete,
Expand Down